Public: anyone can read this; the crew can change it.
A private repository answers every read route with the same 404 as a missing one, proven by one table-driven test #13553
Check · Review · Land · Live done — Landed and live in production.
On main, a private repository already gives the same answer as a missing one on every read route. So this pull only adds the test that proves it: test/private-404-parity.test.ts. No route needed fixing, and src/http/refusal.ts is unchanged.
shipped production is serving it deploy 8e1361f
On main, a private repository already gives the same answer as a missing one on every read route. So this pull only adds the test that proves it: test/private-404-parity.test.ts. No route needed fixing, and src/http/refusal.ts is unchanged.
What the test covers:
- Routes: it walks
buildRouter()andbuildApiRouter()and takes every GET route under/:owner/:name…or/api/v1/repos/:owner/:name…, about 183. Any other parameters in the path get fixed values. - Requests: each route is requested for
alice/zqxhiddenrepoand foralice/zqxabsentrepo. The private one has a commit, an issue and amainbranch; the other was never created. Each pair is asked once as a stranger and once with a session cookie for a signed-in non-member. - MCP: every MCP tool not marked
writeswhose input takes arepois called with both names, using the non-member's bearer token. - What must match: status, headers and body, after swapping the one name for the other. The two names are the same length, so
Content-Lengthcan't tell them apart either. - What is left out: values that change on every request:
date, request id,server-timing,etag,content-lengthand the rate-limit counters. Timing is not compared, as the issue's Risks note allows. - Answers seen: for strangers, 165 routes answer 404, 12 answer 401 (they need sign-in before any repository lookup), 5 answer 301 and 1 answers 400. For the non-member, 177 answer 404. In every case the private and missing repository got the same answer.
Why it would fail on a leak: the route list comes from the tables themselves, so a read route added later is checked the day it's added. A control test checks the comparison can see a difference: the owner gets 200 for their repository and 404 for the missing one, and the MCP issues tool gives them different bodies for the two.
Checks I ran:
bun scripts/gate.ts --fix: rewrapped comments in the new file; that is committed.bun x tsc --noEmit: clean.bun test test/private-404-parity.test.ts: 5 pass.bun test test/mcp-size.test.ts: 9 pass.
Not covered: the /api/v1/user/origins/:id/browse/:owner/:name… routes, which read another forge rather than a repository here. They also showed false differences from the rate-limit counter before it was filtered out. Routes that take an owner but no repository name are not covered either.
I didn't record a plan on the issue with keep_plan, because that tool isn't available in this run.
🤖 Generated with Claude Code
Test-only pull: one new file, no UI, so nothing for a phone, keyboard or no-JS reader to meet. The walk is over the router tables, so new repo read routes are covered automatically. Both a stranger and a signed-in non-member are compared on status, headers and body, and a control test proves the comparison can see a difference. Single-purpose, no dependency, no dead code, README untouched. Two things I would do next: (1) add a stranger (no token) pass for the MCP tools, since only a non-member bearer is compared now, and cover the terminal (src/tui) read screens the same way, since the terminal is a door like the page; (2) cover the routes that take an owner but no repo name, and the origins browse routes once their rate-limit counter is filtered. Also tidy the } / else if line layout in the route loop.
On main, a private repository already gives the same answer as a missing one on every read route. So this pull only adds the test that proves it:
test/private-404-parity.test.ts. No route needed fixing, andsrc/http/refusal.tsis unchanged.What the test covers:
buildRouter()andbuildApiRouter()and takes every GET route under/:owner/:name…or/api/v1/repos/:owner/:name…, about 183. Any other parameters in the path get fixed values.alice/zqxhiddenrepoand foralice/zqxabsentrepo. The private one has a commit, an issue and amainbranch; the other was never created. Each pair is asked once as a stranger and once with a session cookie for a signed-in non-member.writeswhose input takes arepois called with both names, using the non-member's bearer token.Content-Lengthcan't tell them apart either.date, request id,server-timing,etag,content-lengthand the rate-limit counters. Timing is not compared, as the issue's Risks note allows.Why it would fail on a leak: the route list comes from the tables themselves, so a read route added later is checked the day it's added. A control test checks the comparison can see a difference: the owner gets 200 for their repository and 404 for the missing one, and the MCP
issuestool gives them different bodies for the two.Checks I ran:
bun scripts/gate.ts --fix: rewrapped comments in the new file; that is committed.bun x tsc --noEmit: clean.bun test test/private-404-parity.test.ts: 5 pass.bun test test/mcp-size.test.ts: 9 pass.Not covered: the
/api/v1/user/origins/:id/browse/:owner/:name…routes, which read another forge rather than a repository here. They also showed false differences from the rate-limit counter before it was filtered out. Routes that take an owner but no repository name are not covered either.I didn't record a plan on the issue with
keep_plan, because that tool isn't available in this run.🤖 Generated with Claude Code
Closes #13538