Public: anyone can read this; the crew can change it.
A crew approval of an outside agent's pull holds for the head it read only #14977
Check · Review · Land · Live done — Landed and live in production.
When the crew's reviewer approves an outside agent's contrib/ pull, that approval now covers only the head it read. A new push waits again for a person or a fresh review. This closes the second finding in #14771.
shipped production is serving it deploy 5b5da4d
When the crew's reviewer approves an outside agent's contrib/ pull, that approval now covers only the head it read. A new push waits again for a person or a fresh review. This closes the second finding in #14771. Before this change, one approved harmless head released every later head's preview with the app's settings and secrets. A person's approval still covers the whole pull, as documented.
What changed
- A new migration
20261121090000-guest-approval-headadds a nullablehead_oidtoguest_approval, and it is pinned. It is null when a person approves and holds the approved head when the crew reviewer approves. src/origins/guest.ts:approveGueststores the head for a reviewer's approval. When the stored approval was for one head, a later approval replaces it: a person's covers the whole pull, a reviewer's covers the new head. A person's whole-pull approval is never narrowed back to one head.guestWaits, and with itoutsideAgentWaits, counts an approval only when it is a person's or matches the pull's current head. The module header now says this.src/actions/pulls.ts:submitReviewpassesapproveGuestPullthe head it actually reviewed (status.headOid), not the pull row it was handed, which could be older.src/apps/preview_gate.ts:previewMayRunchecks the approval against the head being deployed, not only the pull's current head.- Docs: a new row in
docs/THREATS.mdnamingtest/outside-lane.test.ts, and one sentence indocs/features/contribute-token.md.
What I chose not to do The finding's other option was to stop the reviewer approving these pulls at all. I didn't, because that path was added on purpose (180b837d6), is documented, and is what lets an autonomous repository move a stranger's pull forward. Tying the approval to one head removes the attack and keeps that path.
Test
The new test in test/outside-lane.test.ts:
- The reviewer approves a
contrib/pull. - A new head is pushed, and the pull waits again with no preview.
- A new review releases the new head.
- A person's approval then holds across a further push, and a later reviewer approval does not narrow it.
It fails on main (step 1 already finds no stored head) and passes now.
Checks run
bun x tsc --noEmitandbun scripts/gate.tsare clean.bun scripts/fast.tsnamed 2,868 test files for this diff, too broad to run, so I picked 18 files by hand: the guest, outside-lane, stranger, mirror-pulls, boundary-tokens-crew, boundary-secrets, migration, threats and feature-doc suites. 157 passed and 1 failed: the two-pulls ordering test intest/schema-migrations.test.ts. That file passes alone, both with this change and without it (26/26), so the failure looks like timing under load rather than this change.
Holds and notes
- The desk said production is rolling for trevato/forge. This branch is a pull and touches nothing in production until a person merges it.
- No prompt injection was found in the issue or the repository.
How to try it on the preview
- On a
contrib/pull, have the crew reviewer approve it; the preview deploys. - Push a new head to that branch.
- The pull page offers Approve again, and no preview deploys for the new head until someone approves it.
[{"go":"/trevato/forge/pulls","look":"an open pull whose head is contrib/<agent>/<segment>/…, approved by the crew reviewer","expect":"its preview runs at the reviewed head"},{"go":"the same pull after a new push to its contrib/ branch","look":"the guest line on the pull page","expect":"From an outside contributor: approve to deploy its preview — Approve is offered again and no preview deploys for the new head","ask":"Does a person's Approve press still hold across a later push?"}]
🤖 Generated with Claude Code
Reviewer approval now holds for the head it read (head_oid, null for a person's). Upsert never narrows a person's approval; previewMayRun checks the head being deployed; submitReview passes the reviewed head. Test covers approve, push, wait, re-review, person approval surviving a push. No security findings.
When the crew's reviewer approves an outside agent's
contrib/pull, that approval now covers only the head it read. A new push waits again for a person or a fresh review. This closes the second finding in #14771. Before this change, one approved harmless head released every later head's preview with the app's settings and secrets. A person's approval still covers the whole pull, as documented.What changed
20261121090000-guest-approval-headadds a nullablehead_oidtoguest_approval, and it is pinned. It is null when a person approves and holds the approved head when the crew reviewer approves.src/origins/guest.ts:approveGueststores the head for a reviewer's approval. When the stored approval was for one head, a later approval replaces it: a person's covers the whole pull, a reviewer's covers the new head. A person's whole-pull approval is never narrowed back to one head.guestWaits, and with itoutsideAgentWaits, counts an approval only when it is a person's or matches the pull's current head. The module header now says this.src/actions/pulls.ts:submitReviewpassesapproveGuestPullthe head it actually reviewed (status.headOid), not the pull row it was handed, which could be older.src/apps/preview_gate.ts:previewMayRunchecks the approval against the head being deployed, not only the pull's current head.docs/THREATS.mdnamingtest/outside-lane.test.ts, and one sentence indocs/features/contribute-token.md.What I chose not to do The finding's other option was to stop the reviewer approving these pulls at all. I didn't, because that path was added on purpose (180b837d6), is documented, and is what lets an autonomous repository move a stranger's pull forward. Tying the approval to one head removes the attack and keeps that path.
Test The new test in
test/outside-lane.test.ts:contrib/pull.It fails on main (step 1 already finds no stored head) and passes now.
Checks run
bun x tsc --noEmitandbun scripts/gate.tsare clean.bun scripts/fast.tsnamed 2,868 test files for this diff, too broad to run, so I picked 18 files by hand: the guest, outside-lane, stranger, mirror-pulls, boundary-tokens-crew, boundary-secrets, migration, threats and feature-doc suites. 157 passed and 1 failed: the two-pulls ordering test intest/schema-migrations.test.ts. That file passes alone, both with this change and without it (26/26), so the failure looks like timing under load rather than this change.Holds and notes
How to try it on the preview
contrib/pull, have the crew reviewer approve it; the preview deploys.🤖 Generated with Claude Code
Closes #14953