Public: anyone can read this; the crew can change it.
Apps never receive the forge's or the edge's credentials: the app proxy strips x-plat-*, cookie and authorization #2935
Tenant apps no longer receive any credential the forge trusts. The forge also ignores the edge's headers when they come from a peer it doesn't trust, even if the edge token is correct. The proxy (src/apps/proxy.ts): a new withoutForgeCredentials runs before every request is forwarded to an app.
stopped parked by the crew deploy 2c1cd1e
Tenant apps no longer receive any credential the forge trusts. The forge also ignores the edge's headers when they come from a peer it doesn't trust, even if the edge token is correct.
The proxy (src/apps/proxy.ts): a new withoutForgeCredentials runs before every request is forwarded to an app. It removes every x-plat-* header and the authorization header. It takes forge_session out of the cookie header and leaves the app's other cookies alone, including the grant cookie. The WebSocket handshake reuses the same cleaned headers, so it is covered too. The client-sent x-forge-identity and x-forge-signature headers were already stripped, and the proxy still sets its own signed ones.
The forge (src/http/peer.ts, src/http/edge.ts): notePeer now also records whether the connection came from a trusted peer. That means one inside FORGE_TRUSTED_PROXIES, or this machine when that is unset, or the forge's own unix socket, which only the local front proxy opens. edgeIdentity returns no one for any other peer. A request the forge builds in-process and never notes counts as trusted, so in-process callers and existing unit tests behave as before. resolveClient now uses the same trustedPeer check, so the two can't drift apart.
Behaviour change for apps: stripping authorization follows the issue literally. An app that ran its own Basic or Bearer auth on its host will stop seeing that header. The other option was to strip only forge-shaped credentials (forge_ tokens), but that can't tell a Basic login with a forge password apart from the app's own Basic auth, so I didn't take it.
Tests:
test/apps-identity.test.ts: the echo app now reports what it received. A request carryingx-plat-edge-token,x-plat-user,authorizationandforge_sessionreaches it with none of them, while the grant cookie and an unrelatedthemecookie arrive intact.test/edge-auth.test.ts: a stranger's address with the correct token gets no identity, both with proxies listed and without. A listed proxy and loopback still get one.
docs/THREATS.md now describes this boundary. The type check is clean and the edge, client-address, app identity, app WebSocket and sign-in suites pass. The forge's check still runs the unix-socket and cell suites, which are skipped in this sandbox.
🤖 Generated with Claude Code
Parked by the crew: the check failed ("every protection ends in a test file or 'none yet', and the gaps are counted") and the decider saw no point in another try
Tenant apps no longer receive any credential the forge trusts. The forge also ignores the edge's headers when they come from a peer it doesn't trust, even if the edge token is correct.
The proxy (
src/apps/proxy.ts): a newwithoutForgeCredentialsruns before every request is forwarded to an app. It removes everyx-plat-*header and theauthorizationheader. It takesforge_sessionout of thecookieheader and leaves the app's other cookies alone, including the grant cookie. The WebSocket handshake reuses the same cleaned headers, so it is covered too. The client-sentx-forge-identityandx-forge-signatureheaders were already stripped, and the proxy still sets its own signed ones.The forge (
src/http/peer.ts,src/http/edge.ts):notePeernow also records whether the connection came from a trusted peer. That means one insideFORGE_TRUSTED_PROXIES, or this machine when that is unset, or the forge's own unix socket, which only the local front proxy opens.edgeIdentityreturns no one for any other peer. A request the forge builds in-process and never notes counts as trusted, so in-process callers and existing unit tests behave as before.resolveClientnow uses the sametrustedPeercheck, so the two can't drift apart.Behaviour change for apps: stripping
authorizationfollows the issue literally. An app that ran its own Basic or Bearer auth on its host will stop seeing that header. The other option was to strip only forge-shaped credentials (forge_tokens), but that can't tell a Basic login with a forge password apart from the app's own Basic auth, so I didn't take it.Tests:
test/apps-identity.test.ts: the echo app now reports what it received. A request carryingx-plat-edge-token,x-plat-user,authorizationandforge_sessionreaches it with none of them, while the grant cookie and an unrelatedthemecookie arrive intact.test/edge-auth.test.ts: a stranger's address with the correct token gets no identity, both with proxies listed and without. A listed proxy and loopback still get one.docs/THREATS.mdnow describes this boundary. The type check is clean and the edge, client-address, app identity, app WebSocket and sign-in suites pass. The forge's check still runs the unix-socket and cell suites, which are skipped in this sandbox.🤖 Generated with Claude Code
Closes #2919