Repository navigation
action: send X-Blacksmith-VM-Token on metadata reads so testbox keeps working once the host requires it - #18
Conversation
… working once the host requires it The host agent identifies a VM by the token it puts on the kernel cmdline (vm_token=) and answers metadata requests only when that token is presented in X-Blacksmith-VM-Token. The three metadata reads in the phone-home step (installationModelID, backendURL, stickyDiskToken) sent no header, so they are the tokenless requests the host counts today and would be 401s under enforcement. Read the token the same way as metadata_port, mask it in the job log, and send it on every read. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
|
The runner exports the host-minted token into every step's environment on Linux, Windows and macOS, so the step relies on that variable and does not fall back to parsing vm_token= from /proc/cmdline. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>


Summary
The Blacksmith host agent identifies a guest VM by a per-VM token, which the runner exports into every step's environment as
BLACKSMITH_VM_TOKEN, and its metadata service is moving to answering only requests that present that token inX-Blacksmith-VM-Token. The three metadata reads in the "Phone home and configure testbox" step sent no header, so onmainevery Testbox job would fail at phone-home withCould not read required metadataonce the host enforces the token; with this PR the reads carry it and keep working.Read the VM token from the runner environment
Send it on every metadata read
installationModelID,backendURLandstickyDiskTokennow go through onemetadata_get <key>helper that adds-H "X-Blacksmith-VM-Token: ${VM_TOKEN}"; timeouts and the|| trueempty-on-error behaviour are unchanged, so the existing "missing metadata" error path still handles a host that rejects the request (including a runner that does not export the token).Verified against a stub metadata server that 401s without the header: with the token the step resolves all three values; without it the step exits through the existing
::error::Could not read required metadatapath.Link to Devin session: https://app.devin.ai/sessions/4ab0ed86d68d464ca01a4c44527f2658
Open in Devin Desktop: https://app.devin.ai/desktop/session/4ab0ed86d68d464ca01a4c44527f2658?variant=devin
Requested by: @max-blacksmith
🟢 Devin Review found nothing to fix · View findings
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.