Repository navigation
fix(faucet): take each repository rename once and never keep a stale name - #83
Conversation
A rename or transfer whose store write fails is acknowledged, a transfer after a missed rename leaves the old name bound, and a replayed transfer body gives a repository a name back (Vercel findings faucet/3, faucet/4). The sample-transfer-and-rename test passes already; it pins the happy path with GitHub's published payload examples. --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_
…name A service's repo: grant resolves through the name that rename and transfer deliveries give a repository (Vercel findings faucet/3, faucet/4). - A rename or transfer whose store write fails answers 500, and redelivery now asks again for one (Service.RedeliveryWants). - Store.RenameRepository records the SHA-256 of each rename body in the transaction that writes the names (migration 000019_repo_renames), so the same body under another delivery GUID changes nothing. - A fresh rename from a name that faucet does not hold replaces the stale name and logs a warning. One that redelivery asked for still moves a name only from the name that faucet holds. docs/security.md names what faucet still cannot tell apart: a signed rename body that it never took, and renames that arrive out of order. --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_
--- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_
|
PASS+NOTES at 2c66e26 Independent check of faucet/3 and faucet/4 at this head against base 157e81b (main). Gates at head: gofmt clean; build, vet and golangci-lint (0 issues) pass; Attack tests ran through the real router (
Notes (each is disclosed in docs/security.md; none blocks):
Generated with |
--- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
Vercel's review of this PR found that a kept signed rename, which faucet never judged, rebinds a repository to a former name when its from does not match. These tests pin the quarantine that replaces that path: such a rename binds neither name until the next fresh rename from one of them. --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
A fresh rename or transfer whose from names neither name that faucet holds may follow a missed rename or be a kept old body, and faucet cannot tell which. It now keeps the rename's names as a candidate and resolves no name for the repository, so neither the stale name nor a former name from an old body reads it. The next fresh rename from the held name or the candidate takes its names and lifts the quarantine; a late one never does. Migration 000019 adds the candidate columns. This closes the finding that Vercel's review raised against the earlier head, where such a rename took the delivered names. --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
|
FAIL at a350e83 Independent check of faucet/3, faucet/4 and the PR finding superblink-events/14 at this head, against base 157e81b (main) and the earlier head 2c66e26. Stopped early at the root's request once the bypass below was confirmed; the verify/ e2e suite did not run. Gates at head: gofmt clean; build, vet and golangci-lint (0 issues) pass; Attack tests through the real router (
Why CHAIN works: the first kept body fails the Doc made wrong: docs/security.md#repository-names says a body from any other name "only stops the repository from answering to a name, which denies a grant and gives none". CHAIN shows it also gives the candidate that the next kept body lifts. Notes:
Generated with |
The verifier of a350e83 found that a kept body which quarantines a repository sets the candidate that a second kept body, renamed from it, then lifts. These tests pin a quarantine that only a fresh rename from the name faucet holds can lift. --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
A quarantine kept the names of the rename that caused it, and a rename from them lifted it, so two kept bodies that chain gave a former name back. A quarantine now keeps no name: faucet_repos.quarantined_at marks the row, and only a fresh rename from the name that the row holds lifts it. An operator lifts one by deleting the row. --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
|
PASS+NOTES at 0c1328c (independent verifier; base 157e81b) Findings 3, 4 and pr83-14 are closed, and so is the chain that failed a350e83. No sequence of kept bodies that I tried binds a name that main would not also bind from the same bodies. Gates at headgofmt clean · Attacks (real router,
|
| Case | base | head |
|---|---|---|
| F3: missed rename, then transfer | repo:old/r and org:old read the moved repo |
quarantined; old and new names refused |
| F4: away, back, replay first (new GUID and same GUID) | repo:old/t reads |
seen before, new/t stays bound |
pr83-14: one kept body, mismatched from |
no bind | quarantined, no bind |
| Chain a350e83 (old/a→old/r, then old/r→old/s) | no bind | quarantined, no bind |
| Chains in orders 21, 12, 121, T12, T21, 1T2, 2T1 (T = the transfer replayed) | no bind | quarantined, nothing bound |
| Chain racing a legit rename (8 runs) | new/t | new/t (quarantined in 6 of 8, by order), never old/s |
| Quarantine, then ordinary delivery / late rename from the held name | – | stays quarantined (RecordRepository and Late never lift) |
Late rename with mismatched from |
no change | no change, no quarantine |
| Older row holding the same name as a quarantined row | stale row resolves | refused |
| Write fails → 500, then faucet redelivery | 202, applied | 500, then applied |
| Same fresh body ×4 at once | – | 1 digest row, applied once |
I also drove the live faucet_e2e binary over HTTP with signed webhooks, OAuth client credentials and MCP wait_for_github_events. Base leaks for F3 and F4. Head refuses F3, F4 and the chain, and binds the normal rename-then-transfer.
Legitimate users: a rename then a transfer, a 4-step rename/transfer/rename/transfer-back chain, an owner renamed (and seen) before a transfer, and a case-different from all bind the current name, and org: follows. Wire values match octokit/webhooks repository/renamed and repository/transferred payload examples. The docs I checked (security.md#repository-names, service-accounts.md, upgrading.md 000019, verify-faucet features/service-accounts.md) match what I observed.
Notes (none block)
- The operator remedy reopens a window. After
DELETE FROM faucet_repos WHERE repo_id = …, the next delivery inserts the name that it gives. That delivery can be a kept rename body with anyfrom: a pre-migration body or one that never reached faucet. Later ordinary deliveries do not correct the name (RecordRepository is DO NOTHING). In my test, kept chain bodies sent after the delete boundold/s, and bothrepo:old/sandorg:oldread the repo. Base has the same insert-on-no-row behaviour, and security.md describes it literally, so I did not block. Still, someone who can force a quarantine with a kept body can re-poison the row while the operator is undoing it. Suggestion: tell operators to rotate the webhook secret before deleting the row, or make the remedy an UPDATE to the known-current name. - Quarantine is sticky, as documented, and a legitimate user can hit it. One case: an owner is renamed, faucet gets no delivery from it, and then the repo is transferred (from = new login). Another: the new owner renames after a quarantine, and that does not lift it. In both cases base left the stale name bound.
- The refusal message is misleading. A quarantined repo answers "faucet has received no webhook delivery from X yet", which is misleading for operators. Only the server log says that the repo is quarantined.
- Base has the same problem (one line): a kept body under a fresh GUID moves the owner's login back. A kept transfer from that old login then matches "under the owner's current login".
Reproducers: vattack_internal_test.go and vattack2_internal_test.go, dropped into cmd/faucet (go test -run TestV -v ./cmd/faucet).
Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high
… row The verifier of 0c1328c showed that deleting the row lets the next delivery, which can be a kept body, give the repository any name. --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
Why
Goal: a service's
repo:grant (and anorg:grant, through the repository's owner ID) must never authorize a repository through a stale name binding. This fixes two Vercel Security Review findings, which share the binding code:What changed
repositoryrenamed/transferreddelivery whose write fails answers 500.Service.RedeliveryWants(wired incmd/faucet) makes redelivery ask for a failed one again; other deliveries keep their answers.Store.RenameRepositorytakes aRepositoryRenameand records the SHA-256 of the signed body in the same transaction as the names (migration000019_repo_renames). A body that the store judged before changes nothing, whatever its GUID.faucet_repos.quarantined_at) and logs a warning: it answers to no name, so neither a stale name nor a former name from a kept old body reads it. Only a fresh rename from the held name lifts it, or an operator writing its current name to the row; a quarantine keeps no name, because kept bodies can chain. A rename that faucet's redelivery asked for changes nothing then. (Earlier heads took the delivered names, then kept them as a candidate; Vercel's review and the verifier showed that each let kept bodies rebind a former name.)security.mdgains "Repository names" with the limits below;service-accounts.md,redelivery.md,upgrading.mdand the verify-faucet feature page follow.Scope
Repository names only. An owner's login moves with any delivery, and a manual GitHub redelivery can move it back: that limit is unchanged and already in
service-accounts.md.Tradeoffs
GitHub signs only the body, and the body holds no time that orders deliveries. So a signed rename body that faucet never took (one that never reached it, one from before this migration, or a manual GitHub redelivery of one it answered 500 to) still binds its names until the next rename when it moves the repository from the name faucet holds (from any other name it only quarantines, which denies and grants nothing), and two renames that arrive out of order leave the older name.
security.mdsays so. Digests are kept for good: a body stays signed.Blast Radius
Only hosts that record repositories (
FAUCET_PUBLIC_URL). A rolling deploy: a build before 000019 can't start against it. Embedders: newRenameRepositorysignature and storetest subtests; passRedeliveryWantsinstead ofRawWants.Verification
repositorytransferred/renamedexamples (octokit/webhookspayload-examplesat bc5f6fd).go test -race ./...with Postgres,-tags faucet_e2e, golangci-lint, sqlc/mod tidy clean, verify-docs checks, verify/ e2e suite.Generated with
xum• Model:anthropic:claude-opus-5-5• Thinking:xhigh