Public: anyone can read this; the crew can change it.
A cell child never receives the edge token or x-plat-* headers: forward and forwardSocket strip them #15236
Check · Review · Land · Live done — Landed and live in production.
A cell child no longer receives the forge's x-plat- headers, including the edge token and x-plat-user. Before, forward() and forwardSocket() in src/spawn/cell.ts passed them through to the child. The visitor's authorization and cookies still reach the child, so signing in on a child forge keeps working.
shipped production is serving it deploy cfe12e4
A cell child no longer receives the forge's x-plat-* headers, including the edge token and x-plat-user. Before, forward() and forwardSocket() in src/spawn/cell.ts passed them through to the child. The visitor's authorization and cookies still reach the child, so signing in on a child forge keeps working.
I could not carry mason's code over. The fork commit 3c866cdb6 from pull #14938 could not be fetched from here. So I wrote the change myself from the issue's spec on today's main instead of copying it. The commit still credits mason with Co-authored-by. A reviewer who can open #14938 should compare the two.
- Code: both functions now build their headers through two plain functions,
forwardHeaders(plain requests) andsocketHeaders(websocket handshakes). Both drop every header starting withx-plat-, the same rulestripForgeCredentialsinsrc/apps/proxy.tsuses. Unlike that function, they leaveauthorizationand cookies alone. Everything else they already removed or rewrote is unchanged: hop-by-hop headers, the forwarded host and scheme, the client-address headers and the visitor'ssec-websocket-*headers. - Tests:
test/spawn-cell.test.tssends requests carryingx-plat-edge-token,x-plat-user,authorizationand a cookie.- The plain-request test goes through
forward()to a real loopback server. - The websocket test checks the output of
socketHeaders. It does not open a socket throughforwardSocket(). - In both, the child sees neither
x-plat-*header and does get the sign-in headers. With the stripping turned off, both tests fail.
- The plain-request test goes through
- Threats doc: the new row went in
docs/threats/child-forge.md, not directly indocs/THREATS.md.THREATS.mdis now assembled from the files indocs/threats/, and this is the child-forge section. The row namestest/spawn-cell.test.ts.
Checks: scripts/gate.ts --fix changed nothing and bun x tsc --noEmit passes. scripts/fast.ts said the change reaches 3227 test files, too many to run here. So I ran the two that cover it, test/spawn-cell.test.ts and test/threats-enforced.test.ts: 48 pass, 0 fail. One test was skipped because this sandbox cannot run cells; the forge's check runs it.
I did not update the plan on the issue: the keep_plan and estimate tools were not available in this run.
🤖 Generated with Claude Code
Both builders strip every x-plat-* header and leave authorization and cookies. Hop-by-hop, forwarded-host, client-address and sec-websocket handling is unchanged. The plain-request test goes through forward() to a real server. The two things I would do next: (1) have the websocket test drive forwardSocket against a loopback upstream, since it now only checks socketHeaders, so a future call site that skips the helper would not be caught; (2) make stripForgeCredentials in apps/proxy.ts and forgeOnly share one predicate so the rule lives in one place. I opened the preview: / answers 200 with 15.5 KB of server-rendered HTML and the viewport meta; the change adds no page, so nothing visual moved.
A cell child no longer receives the forge's
x-plat-*headers, including the edge token andx-plat-user. Before,forward()andforwardSocket()insrc/spawn/cell.tspassed them through to the child. The visitor'sauthorizationand cookies still reach the child, so signing in on a child forge keeps working.I could not carry mason's code over. The fork commit
3c866cdb6from pull #14938 could not be fetched from here. So I wrote the change myself from the issue's spec on today's main instead of copying it. The commit still credits mason withCo-authored-by. A reviewer who can open #14938 should compare the two.forwardHeaders(plain requests) andsocketHeaders(websocket handshakes). Both drop every header starting withx-plat-, the same rulestripForgeCredentialsinsrc/apps/proxy.tsuses. Unlike that function, they leaveauthorizationand cookies alone. Everything else they already removed or rewrote is unchanged: hop-by-hop headers, the forwarded host and scheme, the client-address headers and the visitor'ssec-websocket-*headers.test/spawn-cell.test.tssends requests carryingx-plat-edge-token,x-plat-user,authorizationand a cookie.forward()to a real loopback server.socketHeaders. It does not open a socket throughforwardSocket().x-plat-*header and does get the sign-in headers. With the stripping turned off, both tests fail.docs/threats/child-forge.md, not directly indocs/THREATS.md.THREATS.mdis now assembled from the files indocs/threats/, and this is the child-forge section. The row namestest/spawn-cell.test.ts.Checks:
scripts/gate.ts --fixchanged nothing andbun x tsc --noEmitpasses.scripts/fast.tssaid the change reaches 3227 test files, too many to run here. So I ran the two that cover it,test/spawn-cell.test.tsandtest/threats-enforced.test.ts: 48 pass, 0 fail. One test was skipped because this sandbox cannot run cells; the forge's check runs it.I did not update the plan on the issue: the
keep_planandestimatetools were not available in this run.🤖 Generated with Claude Code
Closes #15234