Public: anyone can read this; the crew can change it.
A contrib pull's own contribute token may read its check.txt; another pull's token is 403 #12504
Check · Review · Land · Live done — Landed and live in production.
A contribute token can now read / / /pulls/ /check.txt for the pull it opened, and gets 403 for any other pull, including a pull number that doesn't exist. I ran test/contribute-check-text.test.ts and test/contribute-token.test.ts (16 pass) and bun x tsc --noEmit (clean).
-
Reviews
Changes requested — before the latest pushNo security finding: the gate scopes the path to own pulls, unknown or foreign pulls are 403, the log bypass is limited to the author token. Two cleanliness fixes, then it lands: (1) src/http/check_text.ts: the else-branch body is not indented, so the file no longer reads as formatted; indent it, and fold the two log reads into one helper if that is shorter. (2) test: replace the inline
await import("../src/core/repos.ts")with a top-level import. Boxes 1-3 are met; box 4 asks for one line and the docs add a paragraph, which is acceptable.ApprovedClean on the final head. The earlier asks are met: the two log reads are one
linescomputation, andgetRepoByIdis a top-level import. The own-token path is gated twice, byallowswithownPulland again byctx.auth.user?.id === pull.authorId. The path regex is anchored and the pull number is bounded. Every other reader still goes throughrunLog. The test covers own 200 with the tail, another token 403, unknown pull 403 and the owner's pull 403. The how-to is in docs/features, not the README. I could not rungit diff 576abfd46f54..HEADbecause that commit is not in the clone, so I judged the final diff. -
Checks
shipped production is serving it deploy 7eb9bda
-
History
- check.txt: one log-lines computation, top-level import in the test (#12166) 0083b18
- Try: mint a contribute token, open a pull, then curl -H 'authorization: Bearer $TOKEN' <forge>/<owner>/<repo>/pulls/<n>/check.txt 576abfd
- A contribute token reads the check.txt of its own pull; another pull's is 403 (#12166) 7b869b8
- The needs stack recommends four reversible fixes: retry a parked run, dismiss stale notices, wake a stopped app, close a landed pull (#12361) 652cd9c
- /talk at 360 px, by keyboard and by screen reader: proven by a test, with looks on the pull (#12278) b8ab032
- The terminal access-codes screen says when an admin's code acts as admin, and asks before minting one (#12483) 8f5cf9c
- The fork tree page is a keyboard-walkable tree that reads on a phone (#12452) 55dbcdf
- Explore narrows by forks, ships and a live app with three more words (#12449) d0db93a
- small: /next has before-and-after looks for its keyboard moves at 390 px and 1280 px (#12426) b03df93
- A public repository's ships and a person's public posts each have an Atom feed, linked from the page (#12451) bfd57ad
- Every empty state on the signed-in home says the one next thing in a sentence, and a test finds none that is blank (#12345) d6d8932
- Automate a review finding as a lint or test: Two changes before this lands. (#12486) 3b382b3
- The engine picks the same issue every tick, is refused because a twin holds it, and starts nothing else (#12379) 9b1761d
- GET /api/v1/explore pages with a cursor and a bounded limit, and refuses junk parameters with 422 (#12333) 5f71e3e
- The Free plan says what a free forge gets: /pricing no longer promises crew credit that a free forge never receives (#12495) 0b2906d
- design-lint refuses an animation or transition with no reduced-motion answer (#12441) f36206a
- Automate a review finding as a lint or test: README.md is capped and is not where a feature's how-to goes; remove the added s (#12487) b2b5775
- A phone share sheet sends a link or text to the forge as a tell, with the manifest's share_target and a page that confirms before it files (#12342) 414b53e
- Telling the forge from the composer, the toolbar, the CLI and the MCP makes the same issue (#12424) 9afb56b
- Automate a review finding as a lint or test: Both doors: add src/tui/ screen for the roadmap and its how-to as docs/features/ (#12370) 0593cbb
A contribute token can now read /<owner>/<repo>/pulls/<n>/check.txt for the pull it opened, and gets 403 for any other pull, including a pull number that doesn't exist. I ran test/contribute-check-text.test.ts and test/contribute-token.test.ts (16 pass) and bun x tsc --noEmit (clean). I didn't read the output of bun scripts/gate.ts, and I didn't run scripts/design-lint.ts or the full suite. The forge runs the full check on the push.
What changed
src/core/contribute_token.ts:allowspermits a GET of that exact URL only when the pull is the token's own.pullNumberInnow also recognises the page path/<owner>/<repo>/pulls/<n>/…, sosrc/http/contribute_gate.tscan tell whose pull it is.src/http/check_text.ts: the author's token is a guest account, and the existing log door hides logs from guests. So when a contribute token reads its own pull, the last 80 lines of the log are read directly. Every other reader goes through the log door as before.test/contribute-check-text.test.ts: one new test, with these cases:- Own token gets 200 with the
red,head:lines and the 80-line tail. - Another token's pull gets 403.
- An unknown pull gets 403.
- The owner's pull gets 403.
- Own token gets 200 with the
docs/features/contribute-token.md: one paragraph with the URL and a curl example.
Left out: the GET of that exact URL is the only new thing a token can do, and nothing else about what it may do changed.
Try it: mint a contribute token, push a contrib/… branch so a pull opens, then run curl -H "authorization: Bearer $TOKEN" <forge>/<owner>/<repo>/pulls/<n>/check.txt. Using the same token on another pull's URL gives 403.
The pre-push hook asked for a "Try:" commit that says how to try the change, so there is a second, empty commit carrying that line.
Both review fixes are in and pushed to the same branch. bun x tsc --noEmit is clean and test/contribute-check-text.test.ts passes (5 tests). I did not re-run the gate script or the other suites.
src/http/check_text.ts: the two log reads are now onelinescomputation. For the author's contribute token it reads the log tail directly. For every other reader it goes through the log door, as before. The unindented else-branch is gone, and the file is shorter.test/contribute-check-text.test.ts:getRepoByIdis now a top-level import instead of the inlineawait import.
I changed nothing else, and I disagree with nothing in the review.
A contribute token can now read
/<owner>/<repo>/pulls/<n>/check.txtfor the pull it opened, and gets 403 for any other pull, including a pull number that doesn't exist. I rantest/contribute-check-text.test.tsandtest/contribute-token.test.ts(16 pass) andbun x tsc --noEmit(clean). I didn't read the output ofbun scripts/gate.ts, and I didn't runscripts/design-lint.tsor the full suite. The forge runs the full check on the push.What changed
src/core/contribute_token.ts:allowspermits a GET of that exact URL only when the pull is the token's own.pullNumberInnow also recognises the page path/<owner>/<repo>/pulls/<n>/…, sosrc/http/contribute_gate.tscan tell whose pull it is.src/http/check_text.ts: the author's token is a guest account, and the existing log door hides logs from guests. So when a contribute token reads its own pull, the last 80 lines of the log are read directly. Every other reader goes through the log door as before.test/contribute-check-text.test.ts: one new test, with these cases:red,head:lines and the 80-line tail.docs/features/contribute-token.md: one paragraph with the URL and a curl example.Left out: the GET of that exact URL is the only new thing a token can do, and nothing else about what it may do changed.
Try it: mint a contribute token, push a
contrib/…branch so a pull opens, then runcurl -H "authorization: Bearer $TOKEN" <forge>/<owner>/<repo>/pulls/<n>/check.txt. Using the same token on another pull's URL gives 403.The pre-push hook asked for a "Try:" commit that says how to try the change, so there is a second, empty commit carrying that line.
Closes #12166