fix(remote)!: never send credentials over plain http off loopback

Closed
TH
2h ago
+1720-181

Summary

A credential never goes over plain http or ws to a host that is not loopback (127.0.0.0/8, ::1, localhost), and no redirect carries it to another origin. Refusals come before anything is sent, with details.reason: insecure_credential_transport. Requests use fetch and node:http. Loopback is safe by design: it stays on the host.

Breaking: token-bearing http:// LAN or VPN URLs stop working, as does a plain non-loopback proxy upstreamBaseUrl. The proxy follows no upstream redirect. The Metro companion refuses relayed WebSockets to a LAN http dev server and returns relayed redirects to the bridge. Use https or ssh -L.

Net lines: latest commit +442 āˆ’458; branch +1721 āˆ’181 (non-test source +417 āˆ’92).

Before / after

agent-device session list --daemon-base-url http://10.0.0.7:4310/agent-device --daemon-auth-token <t>
base: sends "authorization: Bearer <t>" in cleartext
head: INVALID_ARGS, details.reason "insecure_credential_transport", nothing sent

Security

fetch redirect: 'follow' between two local servers; identical on Node 26.11.1 and 22.12.0; no Referer sent:

same-origin 302 {"method":"GET","kept":["authorization","proxy-authorization","cookie","x-agent-device-token","x-agent-device-runner-token","x-api-key","x-revyl-client"],"body":""}
same-origin 307 {"method":"POST","kept":["authorization","proxy-authorization","cookie","x-agent-device-token","x-agent-device-runner-token","x-api-key","x-revyl-client"],"body":"body-secret"}
cross-origin 302 {"method":"GET","kept":["x-agent-device-token","x-agent-device-runner-token","x-api-key","x-revyl-client"],"body":""}
cross-origin 307 {"method":"POST","kept":["x-agent-device-token","x-agent-device-runner-token","x-api-key","x-revyl-client"],"body":"body-secret"}
https->http 302 {"method":"GET","kept":["x-agent-device-token","x-agent-device-runner-token","x-api-key","x-revyl-client"],"body":""}
https->http 307 {"method":"POST","kept":["x-agent-device-token","x-agent-device-runner-token","x-api-key","x-revyl-client"],"body":"body-secret"}
manual     cloud profile, Metro bridge, companion register/unregister (a 3xx fails, not
           retried); relayed requests; proxy (no Location); cloud auth (same origin, max 3);
           Limrun download (max 20; same origin, or https->https without headers)
error      Apple runner, Revyl, Limrun API
Exception  runner token to the CoreDevice tunnel: devicectl-reported, in fd00::/8
Uncovered  WebDriver providers, install-from-source headers, Limrun SDK client

Validation

At 8a7acf1c: the six changed test files (81 tests) and OXC format and lint passed. Full gates last passed at 572b141b; CI pending.

The live Wi-Fi iPhone check passed on 678a0c6c. The runner now sends there through fetch (unit-tested); not re-run live.

šŸ¤– Generated with Claude Code