Public: anyone can read this; the crew can change it.

A private app's page and its preview answer a signed-out visitor with the same 404, never a hint it exists #13695

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

A signed-out visitor can no longer tell a private app or preview from a name nobody holds. Before this, two answers gave it away: Opening the app's host in a browser (production, preview, any file path, or /forge/signin): a private app sent you to /apps/open to sign in with a 303, but a missing name gave a bare 404.

Notes

shipped production is serving it deploy 59903fa

opened this

A signed-out visitor can no longer tell a private app or preview from a name nobody holds. Before this, two answers gave it away:

  • Opening the app's host in a browser (production, preview, any file path, or /__forge/signin): a private app sent you to /apps/open to sign in with a 303, but a missing name gave a bare 404.
  • /apps/open?host=…: a real host sent a signed-out visitor to sign in, but a missing one gave the forge's 404 page.

Everything else already matched: the forge's repository pages, the API, /__forge/, and requests that aren't from a browser.

The fix makes a missing name answer the way a private app does, so the sign-in hand-off still works for the owner arriving by link:

  • src/apps/proxy.ts: the "is this a person navigating" check and the redirect to sign in are pulled out into navigating and toSignIn. A new unknownApp uses them to answer an app-shaped host that names no app.
  • src/http/server.ts: sends those hosts to unknownApp instead of returning a flat 404.
  • src/web/pages/apps.ts: /apps/open now asks a signed-out visitor to sign in before it looks the host up. A signed-in owner still gets a 404 for a missing name, and a stranger still gets a 404 for a private one.

The new test/private-404.test.ts asks a private app and a missing one, signed out, for 13 places (forge page, app page, file, API, production host, preview host, files on them, /__forge/, sign-in, hand-off) under three Accept headers. It compares status, content type, redirect target and the rough body size. It also checks that the signed-in owner still reaches the page, the API and the hand-off grant. Without the fix, 13 of its 40 checks fail.

Not changed: the answer to a caller presenting a token (the token hint) still differs, but that isn't a signed-out visitor. src/http/refusal.ts didn't need touching. A missing name that looks like a hosted child's host still answers its own 404.

bun x tsc --noEmit, scripts/gate.ts --fix and design-lint are clean, and 1,057 tests across the related app and proxy suites pass. One test in test/looks.test.ts ("a real capture through the grant door") fails here with or without this change, because the sandbox blocks Chromium from reaching forge.test.

To try it: signed out, open ledger.<apps domain> and nobody.<apps domain> in a browser and both send you to sign in. With curl, both answer the same 9-byte 404.

🤖 Generated with Claude Code

Closes #13678

3 earlier comments
commented

A signed-out visitor can no longer tell a private app or preview from a name nobody holds. Before this, two answers gave it away:

  • Opening the app's host in a browser (production, preview, any file path, or /__forge/signin): a private app sent you to /apps/open to sign in with a 303, but a missing name gave a bare 404.
  • /apps/open?host=…: a real host sent a signed-out visitor to sign in, but a missing one gave the forge's 404 page.

Everything else already matched: the forge's repository pages, the API, /__forge/, and requests that aren't from a browser.

The fix makes a missing name answer the way a private app does, so the sign-in hand-off still works for the owner arriving by link:

  • src/apps/proxy.ts: the "is this a person navigating" check and the redirect to sign in are pulled out into navigating and toSignIn. A new unknownApp uses them to answer an app-shaped host that names no app.
  • src/http/server.ts: sends those hosts to unknownApp instead of returning a flat 404.
  • src/web/pages/apps.ts: /apps/open now asks a signed-out visitor to sign in before it looks the host up. A signed-in owner still gets a 404 for a missing name, and a stranger still gets a 404 for a private one.

The new test/private-404.test.ts asks a private app and a missing one, signed out, for 13 places (forge page, app page, file, API, production host, preview host, files on them, /__forge/, sign-in, hand-off) under three Accept headers. It compares status, content type, redirect target and the rough body size. It also checks that the signed-in owner still reaches the page, the API and the hand-off grant. Without the fix, 13 of its 40 checks fail.

Not changed: the answer to a caller presenting a token (the token hint) still differs, but that isn't a signed-out visitor. src/http/refusal.ts didn't need touching. A missing name that looks like a hosted child's host still answers its own 404.

bun x tsc --noEmit, scripts/gate.ts --fix and design-lint are clean, and 1,057 tests across the related app and proxy suites pass. One test in test/looks.test.ts ("a real capture through the grant door") fails here with or without this change, because the sandbox blocks Chromium from reaching forge.test.

To try it: signed out, open ledger.<apps domain> and nobody.<apps domain> in a browser and both send you to sign in. With curl, both answer the same 9-byte 404.

🤖 Generated with Claude Code

commented

<!-- look-pages 22538efe28ea --> Look pages for 22538ef, from the gate:

  • look pages (inferred): this pull changes src/web/pages/apps.ts; the forge pictures / (src/web/pages/apps.ts), /docs (src/web/pages/apps.ts), /explore (src/web/pages/apps.ts) and 22 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
commented

A private app or preview, and a name nobody holds, now give a signed-out visitor exactly the same answer. In a browser, both send you to sign in. With curl, both get the same 404, so nothing hints that a private app exists.

  • src/apps/proxy.ts: a host shaped like an app's but which nobody holds now goes through the same sign-in step a private app does. Before this, a private host went to sign-in while a missing one got a bare 404, which gave the private one away.
  • src/web/pages/apps.ts: /apps/open sends a signed-out visitor to sign in before it looks the host up. Before, it only asked for sign-in when the host was real.
  • test/private-404.test.ts: checks that private and missing names give the same answer on every page, API path, preview host, file path and sign-in step.

Following review, I added two empty commits: one with a No look: line (the pull changes no rendered page) and one with a No door: line (/apps/open shows nothing new for the terminal to mirror). bun scripts/gate.ts passes after the second; I ran no tests, since neither commit changes any code.

Try it: signed out, open ledger.<apps domain> and nobody.<apps domain> in a browser and both send you to sign in; fetch both with curl and they return the same 404.

🤖 Generated with Claude Code

commented

A private app or preview, and a name nobody holds, now give a signed-out visitor exactly the same answer. In a browser, both send you to sign in. With curl, both get the same 404, so nothing hints that a private app exists.

  • src/apps/proxy.ts: unknownApp is new. A host shaped like an app's but which nobody holds now gets the same sign-in step and 404 a private app gets. Before, a private host went to sign-in while a missing one got a bare 404, which gave the private one away.
  • src/http/server.ts: the public door returns securityFloor(unknownApp(...)). The explicit wrap is what test/security-floor-doors.test.ts checks for: every return of the public door must visibly apply the security floor. The bare return broke that check, and wrapping it again is harmless because securityFloor only adds headers that aren't already set.
  • src/web/pages/apps.ts: /apps/open sends a signed-out visitor to sign in before it looks the host up. Before, it only asked for sign-in when the host was real.
  • test/private-404.test.ts: checks that private and missing names give the same answer on every page, API path, preview host, file path and sign-in step.
  • Empty commits: two carry the No look: and No door: lines review asked for. The /apps/open change alters no rendered page and has nothing for the terminal to mirror.

The other red test, "the archive answers only what a reader may read" in test/contribute-no-forge.test.ts, is about repository archives, which this pull doesn't touch. I didn't find why it failed on the forge; it passed all four times I ran it here. I left it unchanged.

Run before pushing, all green: test/security-floor-doors.test.ts, test/contribute-no-forge.test.ts, test/private-404.test.ts, bun scripts/gate.ts --fix and bun x tsc --noEmit.

Try it: signed out, open ledger.<apps domain> and nobody.<apps domain> in a browser and both send you to sign in; fetch both with curl and they return the same 404.

🤖 Generated with Claude Code

Approved

Clean. A missing app-shaped host now answers a signed-out visitor as a private one does (303 to sign-in for a navigating GET, bare 404 otherwise), and /apps/open asks a signed-out visitor to sign in before it looks the host up. The security floor stays on every response. The sign-in return path goes through safePath, so there is no open redirect. The test compares private and missing across 13 places and 3 Accept headers, and checks the owner still gets in. Nit, not blocking: one createUser call in the test is formatted off-style. No src/web markup changed, so the design principles are not engaged.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs