Public: anyone can read this; the crew can change it.
An app preview token reads its own repository only, never the fork's parent #14986
Check · Review · Land · Live done — Landed and live in production.
A preview app's token can no longer read the parent of its app's fork. A preview runs code nobody has merged yet, and that parent can be the owner's private repository.
shipped production is serving it deploy 6dfa34b
A preview app's token can no longer read the parent of its app's fork. A preview runs code nobody has merged yet, and that parent can be the owner's private repository. In src/http/run_gate.ts, when the token's scope belongs to an app (scope.app === true, which is only set for non-production app tokens), the gate no longer looks up the parent. That shuts both ways in: the parent's API and git-upload-pack fetches, and following a moved path that leads to the parent. Crew run tokens still read the parent as before. I also updated the header comment.
The new test, test/run-gate-app-parent.test.ts, builds a private repo, forks it, and sets up an app on the fork. It then mints a preview app token and a crew run token for the same fork:
- Preview token: reads its own repository (200) but gets 404 on the parent's repo page, its issues, and git
info/refs. This test fails on main. - Run token: gets 200 on the same three addresses.
The type check passes. scripts/fast.ts named far too much to run here (a gate change touches every request), so I ran the 13 test files that use run or app tokens or the gate: 115 pass, 0 fail.
Not done: production app tokens never pass through this gate, so they are unchanged.
To try it: bun test test/run-gate-app-parent.test.ts
🤖 Generated with Claude Code
Clean. The parent lookup is skipped when scope.app is true, which closes the parent API, git-upload-pack and the moved-path 308 follow in one place. Crew run tokens keep the read-only parent. The test covers both tokens on the same fork and would fail on main. No new dependency or docs needed.
A preview app's token can no longer read the parent of its app's fork. A preview runs code nobody has merged yet, and that parent can be the owner's private repository. In
src/http/run_gate.ts, when the token's scope belongs to an app (scope.app === true, which is only set for non-production app tokens), the gate no longer looks up the parent. That shuts both ways in: the parent's API andgit-upload-packfetches, and following a moved path that leads to the parent. Crew run tokens still read the parent as before. I also updated the header comment.The new test,
test/run-gate-app-parent.test.ts, builds a private repo, forks it, and sets up an app on the fork. It then mints a preview app token and a crew run token for the same fork:info/refs. This test fails on main.The type check passes.
scripts/fast.tsnamed far too much to run here (a gate change touches every request), so I ran the 13 test files that use run or app tokens or the gate: 115 pass, 0 fail.Not done: production app tokens never pass through this gate, so they are unchanged.
To try it:
bun test test/run-gate-app-parent.test.ts🤖 Generated with Claude Code
Closes #14965