Public: anyone can read this; the crew can change it.
A private app's /__forge/* doors answer a stranger exactly as a name nobody holds #15208
Check · Review · Land · Live done — Landed and live in production.
For a private app or a sealed pull's preview, proxyApp now checks who the caller is before any /forge/ door, the hook relay or the wake of an asleep environment. A caller it does not admit gets exactly what unknownApp returns.
shipped production is serving it deploy cfe12e4
For a private app or a sealed pull's preview, proxyApp now checks who the caller is before any /__forge/* door, the hook relay or the wake of an asleep environment. A caller it does not admit gets exactly what unknownApp returns. That covers crew, sign-out, the toolbar, tour and comment assets, report, the note and comment doors, measure, hide and /__forge/hook/<n>/…, so the hook answers the same whether pull n has a preview or not. /__forge/grant stays open because it is how someone gets admitted, and it already returns the same 404 to a bad token.
What to look at
src/apps/proxy.ts: the caller check is split out ofadmitasvouch, which only decides who the caller is and has no side effects.admitcalls it and then does the archived, rouse and port checks as before. A newguardedTargetasks the database whether a preview is sealed only forpull-*environments. The check at the top ofproxyAppruns on every guarded target, nested hosts included. This only moves earlier whatadmitalready refused for every path that reaches the app.test/private-404.test.ts: each door is compared against the same path on an unknown name: status, every header exceptdate, and the body. The stand-in runtime reports production as asleep and pull 3 as having a preview, and records each wake. Two more tests check that a stranger's page view wakes nothing and that the admitted owner still opens the doors and does wake the app. On main, 17 of the new cases fail.- Tests I changed because they asserted the old behaviour:
apps-crew-side,apps-toolbar-yoursandapps-proxy-doorsexpected a stranger to get crew JSON or a sign-out redirect, and now expect the bare 404 or sign out as someone admitted.cookie-flagssigned out of a private app with an anonymous grant, so its grant now names the owner.
Left out on purpose
- A bearer token of someone who can read the repository but may not enter the app still gets the "may not enter" message. That person already knows the app exists.
- More than 30 failed tokens a minute from one client still gets a 429, which an unknown name never gives.
- The forge doesn't offer
keep_planorestimateto me in this run, so the issue has no plan and no estimate recorded.
Checks: bun scripts/gate.ts --fix and bun x tsc --noEmit are clean. scripts/fast.ts named 2501 files, so I picked and ran the 174 test files that touch app hosts or /__forge/. Two of them fail in this sandbox and fail the same way on main: test/looks.test.ts (the chromium capture can't reach forge.test) and test/pages-budget.test.ts (the page timing budget). The tests that use unix sockets were skipped here; the forge's check runs them.
Try it: bun test test/private-404.test.ts
🤖 Generated with Claude Code
A private app's /__forge/* doors (the forge's own paths, like /__forge/crew) now answer a stranger with a plain 404 "not found", the same as a name nobody holds. "Stranger" here means someone signed out, or signed in without access to the app or to the sealed pull a preview shows. Before, those doors told a stranger that the app or pull exists. The gate check, type check and test/apps-toolbar-yours.test.ts (8 tests) pass locally; I didn't run the other changed test files this push.
What to look at
- The change to how the doors decide who may see them is in
src/apps/proxy.ts. - New tests in
test/private-404.test.tscover the stranger cases. test/apps-crew-side.test.ts,test/apps-proxy-doors.test.ts,test/apps-toolbar-yours.test.tsandtest/cookie-flags.test.tswere updated for the new answer.- The sealed-preview test in
test/apps-toolbar-yours.test.tschecks that a sealed pull's preview gives the same 404 to a signed-in non-member and to a signed-out reader.
Fix for the failed check: the gate refused the as never casts on the access grants built in test/apps-toolbar-yours.test.ts. Those grants are now typed as the real GrantWho record, so the type checker checks them. The test was wrong here, not the code.
Not done: one comment line in that test file is over 100 columns. The gate says the nightly rewrap fixes it on main, so I left it.
To try it: on the preview, request /__forge/crew on a private app's host while signed out and expect a 404 with the body not found.
🤖 Generated with Claude Code
Approved. The stranger check now runs first in proxyApp for private apps and sealed previews (vouch, split from admit), so the /__forge doors, the hook relay and the wake all answer as unknownApp. /__forge/grant stays open. Each door is compared with a missing name on status, headers and body. The tests fail on main, wake is recorded, and the owner path is kept. The preview host serves the forge app itself, not a private app, so I could not exercise a private host there; I judged this from the diff and the tests. Next two things: (1) a client sending more than 30 bad tokens a minute still gets a 429 that an unknown name never gives, so make the limiter answer 404 too, or key it so it cannot be used to probe. (2) vouch now runs in proxyApp and again in admit for every admitted request, and does a database read each time; pass the vouched grant through so identity is verified once. Also wrap the over-100-column comment in apps-toolbar-yours.test.ts.
For a private app or a sealed pull's preview,
proxyAppnow checks who the caller is before any/__forge/*door, the hook relay or the wake of an asleep environment. A caller it does not admit gets exactly whatunknownAppreturns. That covers crew, sign-out, the toolbar, tour and comment assets, report, the note and comment doors, measure, hide and/__forge/hook/<n>/…, so the hook answers the same whether pull n has a preview or not./__forge/grantstays open because it is how someone gets admitted, and it already returns the same 404 to a bad token.What to look at
src/apps/proxy.ts: the caller check is split out ofadmitasvouch, which only decides who the caller is and has no side effects.admitcalls it and then does the archived, rouse and port checks as before. A newguardedTargetasks the database whether a preview is sealed only forpull-*environments. The check at the top ofproxyAppruns on every guarded target, nested hosts included. This only moves earlier whatadmitalready refused for every path that reaches the app.test/private-404.test.ts: each door is compared against the same path on an unknown name: status, every header exceptdate, and the body. The stand-in runtime reports production as asleep and pull 3 as having a preview, and records each wake. Two more tests check that a stranger's page view wakes nothing and that the admitted owner still opens the doors and does wake the app. On main, 17 of the new cases fail.apps-crew-side,apps-toolbar-yoursandapps-proxy-doorsexpected a stranger to get crew JSON or a sign-out redirect, and now expect the bare 404 or sign out as someone admitted.cookie-flagssigned out of a private app with an anonymous grant, so its grant now names the owner.Left out on purpose
keep_planorestimateto me in this run, so the issue has no plan and no estimate recorded.Checks:
bun scripts/gate.ts --fixandbun x tsc --noEmitare clean.scripts/fast.tsnamed 2501 files, so I picked and ran the 174 test files that touch app hosts or/__forge/. Two of them fail in this sandbox and fail the same way on main:test/looks.test.ts(the chromium capture can't reachforge.test) andtest/pages-budget.test.ts(the page timing budget). The tests that use unix sockets were skipped here; the forge's check runs them.Try it:
bun test test/private-404.test.ts🤖 Generated with Claude Code
Closes #15200