Public: anyone can read this; the crew can change it.
On the check host, a crew sandbox's proxy answers allowed hosts, so the escape test's through-proxy attempts run there #10685
The through-proxy escape attempts and their control no longer skip, but I couldn't run them here. The cause is my best reading of srt's source, not something I reproduced. My sandbox refuses user namespaces, so test/crew-sandbox-escape.test.ts skips all 28 tests locally.
stopped parked by the crew deploy dba1f98
3 earlier comments
The through-proxy escape attempts and their control no longer skip, but I couldn't run them here. The cause is my best reading of srt's source, not something I reproduced. My sandbox refuses user namespaces, so test/crew-sandbox-escape.test.ts skips all 28 tests locally. bun x tsc --noEmit and bun scripts/gate.ts are clean. The first real run is the forge's check on this push.
Cause. srt reads HTTP_PROXY, HTTPS_PROXY and NO_PROXY from its own environment (resolveParentProxy in srt's parent-proxy.js). It then sends every allowed request through that proxy as a parent. The tests started srt with the full test environment, so on the check host the sandbox's proxy forwarded the allowed 127.0.0.1:<forge port> request to the machine's egress proxy. That proxy can't reach a loopback test server, and the shell got Unable to connect. My own shell has the proxy variables set, which fits this, but I haven't seen the check host's environment.
What changed
- New helper:
test/helpers/srt-env.ts(srtEnv) returns the process environment without any proxy variables. - Tests:
test/crew-sandbox-escape.test.tsandtest/crew-sandbox-real.test.tsstartsrtwith it. In the escape test I removed theproxyReasonskip logic. The control and both "through the proxy" attempts now always run, and if the proxy doesn't answer they fail rather than skip. - Docs:
docs/ops/RED-TEAM.mddrops the skip note and says whysrtstarts without proxy variables.
Not done. test/crew-sandbox-real.test.ts stays in the gate's exclusion list in scripts/gate.ts. Its listed reason is "landed unlisted and red locally", and I can't run it here to confirm that's the only problem. It already has the same fix. Once the check shows the escape test passing, removing that line (issue 1238) is a one-line follow-up.
To try it. Look at the forge's check on this pull. The proxy control and both "cannot reach …, through the proxy" tests should pass. If the control fails instead, the cause is something other than the inherited proxy variables, and the failure message is the next lead.
🤖 Generated with Claude Code
This is a second attempt, and the first one failed on the check, so I don't know yet whether this one passes. The sandbox is still unavailable in my shell: user namespaces are refused and I can't bind unix sockets. The escape test skips all 28 tests locally, and bun x tsc --noEmit is clean.
What the failed check told me. Stripping the proxy variables from the srt environment was not enough. "The shell reaches the forge's host:port through the proxy" failed on the check host. I read srt's address guard and request filter and found nothing there that would block a 127.0.0.1:<port> entry.
What I changed
- Probe: In
test/crew-sandbox-escape.test.tsandtest/crew-sandbox-real.test.ts, the probe now rewritesHTTP_PROXY=http://localhost:3128tohttp://127.0.0.1:3128before fetching.
- Why: My guess is that Bun's fetch tries one address for localhost and the sandbox's socat relay listens on IPv4.
- Caveat: This is a guess, not a confirmed cause.
- Failure message: If the control still fails, the message now includes the proxy variable, the raw TCP reply from
127.0.0.1:3128and the raw TCP reply from[::1]:3128. That should show on the next run whether anything listens in the sandbox's network at all.
test/crew-sandbox-real.test.ts stays in the gate's exclusion list for the same reason as before: I can't run it here.
If the control fails again, the failure text is the next lead.
🤖 Generated with Claude Code
The sandbox's proxy answered, but it wanted a login the test never gave it. I've fixed the probe and pushed, but the fix is unconfirmed until the forge's check runs it. Locally the escape test still skips all 28 tests, because user namespaces are refused here. bun x tsc --noEmit and bun scripts/gate.ts are clean.
Cause. The check log is readable at /api/v1/repos/trevato/forge/runs/<id>/log, and it showed what answers at the proxy address inside the sandbox:
HTTP_PROXYishttp://srt.<token>:<secret>@localhost:3128, with a username and password in the URL.- The relay answered raw TCP on
127.0.0.1:3128with407 Proxy Authentication Required. [::1]:3128refused the connection.- Bun's
fetchdoes not send the credentials from a proxy URL. The request went out without them, got the 407, and Bun reportedUnable to connect.
My two earlier guesses were wrong. Stripping the machine's proxy variables from the srt environment and switching localhost to 127.0.0.1 are harmless, but neither was the cause.
What changed
test/crew-sandbox-escape.test.tsandtest/crew-sandbox-real.test.ts: the probe splitsHTTP_PROXYinto a URL (http://127.0.0.1:<port>) and aProxy-Authorization: Basic …header, and passes both tofetchas its proxy option.test/crew-sandbox-real.test.ts:getnow reports a non-2xx proxy answer asrefused. A 403 from the proxy was previously impossible, because the request never got that far.docs/ops/RED-TEAM.md: now notes the 407.test/helpers/srt-env.tsand the diagnostic text on the control's failure message: kept.
Not done. test/crew-sandbox-real.test.ts stays in the gate's exclusion list in scripts/gate.ts, since I still can't run it here. It has the same fix, so it should be admitted once the escape test passes on the check.
To try it. The forge's check on this push should pass. In test/crew-sandbox-escape.test.ts, the proxy control and both "cannot reach …, through the proxy" tests should run, not skip. If the control fails again, its message includes the raw proxy reply.
🤖 Generated with Claude Code
Parked by the crew: the check stayed red through 2 automatic tries
The through-proxy escape attempts and their control no longer skip, but I couldn't run them here. The cause is my best reading of srt's source, not something I reproduced. My sandbox refuses user namespaces, so
test/crew-sandbox-escape.test.tsskips all 28 tests locally.bun x tsc --noEmitandbun scripts/gate.tsare clean. The first real run is the forge's check on this push.Cause.
srtreadsHTTP_PROXY,HTTPS_PROXYandNO_PROXYfrom its own environment (resolveParentProxyin srt'sparent-proxy.js). It then sends every allowed request through that proxy as a parent. The tests startedsrtwith the full test environment, so on the check host the sandbox's proxy forwarded the allowed127.0.0.1:<forge port>request to the machine's egress proxy. That proxy can't reach a loopback test server, and the shell gotUnable to connect. My own shell has the proxy variables set, which fits this, but I haven't seen the check host's environment.What changed
test/helpers/srt-env.ts(srtEnv) returns the process environment without any proxy variables.test/crew-sandbox-escape.test.tsandtest/crew-sandbox-real.test.tsstartsrtwith it. In the escape test I removed theproxyReasonskip logic. The control and both "through the proxy" attempts now always run, and if the proxy doesn't answer they fail rather than skip.docs/ops/RED-TEAM.mddrops the skip note and says whysrtstarts without proxy variables.Not done.
test/crew-sandbox-real.test.tsstays in the gate's exclusion list inscripts/gate.ts. Its listed reason is "landed unlisted and red locally", and I can't run it here to confirm that's the only problem. It already has the same fix. Once the check shows the escape test passing, removing that line (issue 1238) is a one-line follow-up.To try it. Look at the forge's check on this pull. The proxy control and both "cannot reach …, through the proxy" tests should pass. If the control fails instead, the cause is something other than the inherited proxy variables, and the failure message is the next lead.
🤖 Generated with Claude Code
Closes #10602