Repository navigation
fix(repos): change a stored name only to the one that GitHub gives - #93
Conversation
…antine Failing tests for faucet/9, faucet/3 and faucet/4. A replayed signed delivery under a new GUID gives an account its former login back, a missed rename sent again lifts the quarantine that the transfer after it set, and a transfer that faucet never judged gives a public repository a name back. The tests ask a stub of GitHub's REST API that serves answers recorded from api.github.com (testdata/githubapi). Deps gains the GitHubAPIURL and GitHubClient fields, unused until the fix. --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_
GitHub signs a delivery's body and nothing else and gives it no time, so
a kept body sent again under a new GUID looks fresh, and faucet took its
names. Before a delivery changes a name that faucet holds, faucet now
asks GitHub's REST API, with no token, at FAUCET_GITHUB_API_URL:
- GET /user/{id} before an account's login moves (faucet/9). Faucet
writes the login that GitHub gives; with no answer the logins stay.
At most one lookup a minute per account.
- GET /repositories/{id} for each rename or transfer body that the store
has not judged (faucet/3, faucet/4). A public repository takes GitHub's
names and loses its quarantine (Store.ConfirmRepository). A private one
(404) or no answer falls back to the held-name rules.
- No rename lifts a quarantine any more, so a missed rename sent again
from the held name cannot bind its name after a transfer.
The lookups of one delivery share a 4 s budget. Store gains RenameSeen
and ConfirmRepository; no migration.
---
_Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_
The name check takes GET /user/{id} and GET /repositories/{id} as GitHub
API paths, and the numbers check holds the 4 s budget of a delivery's
lookups to its constant.
---
_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`_
Failing tests for Vercel faucet/15 and faucet/16. A login that GitHub does not confirm keeps resolving the old name after a rename, and an older GitHub answer written last replaces a newer one. A quarantined account must heal on the next delivery after GitHub answers. --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_
…lock Vercel faucet/15: a login that GitHub did not confirm kept resolving the old name after a rename. A delivery whose login does not match, with no answer from GitHub, now quarantines the account and the account that holds the delivered login (migration 000020_owner_quarantine). They hold no login until a later delivery of the account gets GitHub's answer; any delivery that names a quarantined account asks again, at most once a minute. Vercel faucet/16: two lookups for one repository could write an older answer last. The store now calls the lookup inside its transaction, under an advisory lock of the repository or account, so answers are written in the order asked. The lookup holds one pool connection for at most the 4 s budget, and only for deliveries that would change a name. RenameSeen and ConfirmRepository are gone; RenameRepository takes the lookup, and ConfirmOwner is new. --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_
Vercel faucet/15 stays open at 9f449b0: within the minute after a lookup, a delivery that contradicts the stored login keeps it on the strength of GitHub's last answer. The test wants such a delivery to quarantine the account until the next lookup. --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_
Within the minute after a lookup, a delivery that contradicts the stored login got no fresh answer and kept the login on the strength of the last one (Vercel faucet/15 at 9f449b0). It now gets no answer, so the account and the holder of the delivered login are quarantined until the next lookup after the minute. --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_
|
FAIL at 22bd7f5 (base a051f58) The fixes for faucet/9, faucet/3 (A+) and faucet/4 (public) hold. I am blocking for one bug that an honest user would hit: a rename of an owner quarantines the owner when two or more of its deliveries arrive at the same time, although GitHub confirmed the new login. The fix is three lines (below). Blocking: an honest owner rename followed by concurrent deliveries quarantines the owner
Attack results, base → headEach case ran in throwaway Go tests in cmd/faucet (newLoginServer-style, Postgres, stub GitHub with
Notes
Gates at headgofmt clean, build, vet, golangci-lint 0 issues, Generated with |
… fast Failing tests for the verifier's findings at 22bd7f5: a burst of deliveries after an honest owner rename quarantines the owner that GitHub confirmed; an answer that still gives a renamed repository its old name binds the old name and settles the body; and lookups waiting on a lock or a pool connection while GitHub hangs keep deliveries past GitHub's 10 s. --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_
…bound waits The independent verifier's findings at 22bd7f5: - A burst of deliveries after an honest owner rename quarantined the account that GitHub had just confirmed: each read the old row before the lock, and the waiters hit the cooldown. With the lock, ConfirmOwner now re-reads the row and asks nothing when the account holds the delivered login. - An answer that still gives the name a rename moved the repository from bound the old name and settled the body. It now quarantines the repository and leaves the body unjudged, so GitHub's next delivery of it asks again. - Lookups that waited for the lock or for a pool connection were outside the 4 s budget. The budget now starts at the first wait: a process runs at most 4 lookups at once (a slot not won in time asks nothing), and the store waits for the lock with lock_timeout set to what is left (ErrNameBusy past it). Store methods take a Lookup{Wait, Ask}. Docs say what the code now bounds, and that GitHub answers 404 without a token for Enterprise Managed Users. --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_
|
FAIL at 0e9dce8 (base a051f58) The three failures from my review of 22bd7f5 are fixed, in Go tests and over HTTP. The earlier attack table shows no regression, and every gate passes. I am blocking for one thing that the fix round added. A rename body that GitHub answers with its Blocking: an unjudged body is asked again on every replay, and can later bind a former name
Attack results (base → 22bd7f5 → head)I ran the throwaway Go tests in cmd/faucet: the real router, Postgres, a stub GitHub, and
Notes
Gates at head
Generated with |
The verifier of 0e9dce8 found that such a body stayed unjudged, so each replay asked GitHub again and could later bind a former name while GitHub refused to answer. --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
Forgetting that body let every replay ask GitHub again, spending the 60-an-hour budget, re-quarantining the repository, and binding a former name once a rate limit sent it to the held-name rules. The body now stays judged; only a later rename that GitHub answers, or the operator, lifts that quarantine. --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
--- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
|
PASS+NOTES at 543aae9. This also covers 659cd80: the code is the same, and 543aae9 changes only two lines of wording. Base is a051f58. The block from my review of 0e9dce8 is fixed. When GitHub answers a rename body with its Attack results (base → head)I ran throwaway Go tests in cmd/faucet with the real router, Postgres, a stub GitHub, and
Docs
Notes
Gates
Generated with |
Why
Goal: close the open Vercel Security Review findings faucet/9 (Replayed ordinary webhooks restore obsolete grants after owner renames), and faucet/3 and faucet/4 (a missed rename keeps a stale binding; a replayed transfer restores an obsolete name), which stayed open after #83. GitHub signs only a delivery's body and gives it no time, so a kept body sent again under a new GUID looks fresh, and faucet took its names. The first version of this PR raised faucet/15 (failed lookups keep the old login) and faucet/16 (concurrent confirmations can write an older answer last), which this head also fixes.
What changed
FAUCET_GITHUB_API_URL, with no token (faucet/repositorygithub.go):GET /user/{id}when a delivery names an account under another login, under a login that another account holds or held, or names a quarantined account. Faucet writes GitHub's login. With no answer it fails closed (migration000020_owner_quarantine): the account and the holder of the delivered login hold no login until a later delivery gets GitHub's answer. One lookup a minute per account at most.GET /repositories/{id}for each rename or transfer body that the store has not judged. A public repository takes GitHub's owner and name and loses its quarantine (RenameConfirmed). A private one (404) or no answer falls back to the held-name rules, and no rename lifts a quarantine any more.lock_timeout) included, end 4 s after the first wait, inside GitHub's 10 s. A GitHub answer that still gives the name a rename moved from quarantines the repository and leaves the body unjudged.docs/security.md#repository-names(including the fail-closed cost),docs/service-accounts.md#grants, a new top section indocs/upgrading.md, the verify-faucet feature page. The verify/ GitHub stub serves/user/{id}and/repositories/{id}, with a new e2e test.Scope
Deviations from the brief, approved by root: no per-repository cooldown (each body asks once, digest first), and a failed account lookup quarantines instead of changing nothing (faucet/15).
Tradeoffs
org:grant'sownertarget and by-name repositories included, so a hook admin's replay during a GitHub outage pauses those reads until GitHub answers.fromis the held name. Rotating the hook secret ends it.fromname (a kept body of a public rename that GitHub undid since, or GitHub lagging an honest rename) quarantines the repository and keeps the body judged, so a replay asks nothing and binds nothing. Only a later rename that GitHub answers, or the operator, lifts it.Blast Radius
Webhook handling of hosts that record repositories (
cmd/faucetalways does), and the owners table (migration 000020; its down deletes quarantined accounts). Embedders:Deps.GitHubAPIURLis required withRecordRepositories;Store.RenameRepositorytakes the lookup,ConfirmOwneris new,AddOwnerreturns whether it added.Verification
Failing tests first (27a8b4e, 5c4f835, 6a67e8d, 587df1c), then the fixes. With GitHub hanging, 30 asking deliveries answer within 4.03 s and a delivery that asks nothing within 7 ms (was 12 s and 7.9 s).
gofmt,go vet, golangci-lint v2.0.2,go test -race ./...with Postgres,-tags faucet_e2e ./cmd/faucet, sqlc/tidy clean, docgen checks, the verify/ e2e suite. GitHub happy paths replay answers recorded from api.github.com (faucet/testdata/githubapi).Generated with
xum• Model:anthropic:claude-opus-5-5• Thinking:xhigh