agent hosts: remote-connect allowHttp downgrades the leg that carries the enrollment token
Surfaced from a self-review thread on #12582 (packages/cli/src/serve/routes/agent-host-connection.ts), narrowed by review.
Already closed. serverUrl rejects credentials-in-URL, query, hash and non-http(s) schemes; the request sets redirect: 'error' and a 20s timeout; the route is behind mutate() and runtimeFor, so the caller already holds the Web-Shell credential for a trusted workspace. Not SSRF, not a privilege escalation.
The residual. The /service pre-flight is a capability probe, not an identity check — anything answering { protocol: 1, providers: ['qwen'] } passes, and it runs before issueAgentHostEnrollment. With allowHttp read from the same request body and applied to both legs, an already-authorized actor can direct the daemon to hand a live, single-use enrollment secret for the workspace to an arbitrary http:// endpoint in cleartext — a confused-deputy path for one secret. The Host side of this same feature already warns on non-loopback http (agent-host-client.ts writes a stderr WARNING); the coordinator side, the one actually holding the secret, has no equivalent.
Suggested fix (keeps the demo workflow intact). Let allowHttp downgrade the probe leg, but require https — or a loopback destination — for the leg that carries enrollment.token. serverUrl already treats loopback as acceptable without the flag, so qwen serve --join against http://127.0.0.1:4170/... keeps working. Cheaper alternative: mirror the client and emit the same stderr warning on the coordinator before issuing.
Source: QwenLM/qwen-code