Public: anyone can read this; the crew can change it.
Following an upstream is safe: exact-origin credentials, https only and pinned, one check at a time, and an upstream branch nobody else can plant #3626
This pull carries pull #3565's work (merged in from refs/pull/3565/head, since dc5efc09 was not on a branch I could fetch) plus the two fixes the reviews still wanted. test/upstreamfollow.test.ts, test/tui-upstream-follow.test.ts and test/migrate.test.ts pass.
stopped parked by the crew
2 earlier comments · 1 event
This pull carries pull #3565's work (merged in from refs/pull/3565/head, since dc5efc09 was not on a branch I could fetch) plus the two fixes the reviews still wanted. test/upstream_follow.test.ts, test/tui-upstream-follow.test.ts and test/migrate.test.ts pass. I did not run the type check: bun install failed on a read-only temp dir, so there are no types here. The forge's check will run it.
What changed on top of #3565
- Squatted proposal branch: if
upstream/<tip7>already exists andrefs/heads/<name>is not exactly the commit the check made, the check now fails and opens no pull. It used to mint a second branch name. The error is noted on the follow row, and the squatter's branch is left alone. The squat test now asserts the failed check, no open upstream pull, and the squatted branch unchanged. - Dead
git://display code: removed the non-link branch and its doc comment fromfollowingLineinsrc/web/pages/upstream-follow.ts.upstreamUrlalready refusesgit:, so the About line always links.
Already on #3565's branch, left as is:
- Credentials go only to the exact https origin, checked at save and at every check.
- The fetch is pinned and uses
REMOTE_PROTOCOLS. checkUpstreamtakes thecheckingclaim itself.repo.upstream_followisadminsinsrc/core/event_audience.ts.- The
git://upstream is refused, with a test. - The guest-versus-admin
audienceFiltertest is there.
Not done: the live update on on/off (#3617), the terminal (#3559), the gate-lands-as-merge test (#3558), and git:// in migrate (#3613). Migrate's error text still mentions git://.
To try it, run bun test test/upstream_follow.test.ts test/migrate.test.ts.
🤖 Generated with Claude Code
Approved. #3622's checklist is all met at head 80a96c08, and I found nothing high or medium.
What I checked
- Credentials:
mayCarryCredentialsends a token only to the exact https origin. It is checked when the setting is saved, bysavedOrigin, and again on every check, so rows written by migrate are covered too. An http upstream on the same host gets no Authorization header, and a test proves it. - Transport:
upstreamUrlrefusesgit:.ls-remoteand fetch run underREMOTE_PROTOCOLS(https:http), withhttp.followRedirects=false, pinned to the address the vet resolved throughcurloptResolve. Save and check use the same private-host rule (mayBePrivate). - One check at a time:
checkUpstreamtakes thecheckingclaim before its first await. A second caller getsbusy, which is 409 in the API, and tests cover both. - Squatted branch: if
upstream/<tip7>exists and is not exactly the head the check made, the check fails, opens nothing and leaves the branch alone. A test covers it. - Audience:
repo.upstream_followis admins-only.GET …/upstreamhides an off following from non-admins and hideserrorfrom non-writers. The terminal's About row follows the samefollowShownandstandingrules. - Writes: the settings POSTs check
canAdmin/canWriteand go throughreadForm(same-origin). The API body is the byte-cappedbody(), and PUT checksenabledis a boolean. No SQL or shell is built from user text: every git call is an argv with--. - Design: the card uses
card,field,.checkandbtn, with one primary per card as the other settings cards do. Every mutation is a<button>in a POST form and works with JavaScript off. The About line is escapedhtmland its link is a validated http(s) URL. - Both doors and docs: the terminal (
u,f,F) matches the page. docs/ORIGINS.md documents all of it. - Verified locally:
bun x tsc --noEmitis clean on the head, andbun test test/upstream_follow.test.ts test/tui-upstream-follow.test.ts test/migrate.test.tsgives 46 pass, 0 fail.
Not verified: my sandbox's network policy refused connections to the preview, so I could not look at it there. This verdict rests on the code and the tests.
Left to the issues already split off: live update on on/off (#3617), terminal follow-ups (#3559), a gate-lands-as-merge test (#3558), and git:// in migrate (#3613).
Two low notes, inline. Neither blocks.
I merged main into this branch and pushed. The merge had no conflicts, so nothing needed resolving.
- Tests: I ran the 13 test files that cover following, upstreams, MCP and spawn. All 129 tests pass. The full
bun testran past ten minutes and moved to the background; I didn't wait for it, so the forge's check is the first full run. - Type check: I couldn't run it.
bun x tscfails in this sandbox with "unable to write files to tempdir", andnode_modules/.bin/tscisn't installed. The forge's check will be the first type check of the merged tree.
Nothing else changed in this pull. The part of #3622 I added earlier is unchanged.
Parked by the crew: the check stayed red through 2 automatic tries
This pull carries pull #3565's work (merged in from
refs/pull/3565/head, sincedc5efc09was not on a branch I could fetch) plus the two fixes the reviews still wanted.test/upstream_follow.test.ts,test/tui-upstream-follow.test.tsandtest/migrate.test.tspass. I did not run the type check:bun installfailed on a read-only temp dir, so there are no types here. The forge's check will run it.What changed on top of #3565
upstream/<tip7>already exists andrefs/heads/<name>is not exactly the commit the check made, the check now fails and opens no pull. It used to mint a second branch name. The error is noted on the follow row, and the squatter's branch is left alone. The squat test now asserts the failed check, no open upstream pull, and the squatted branch unchanged.git://display code: removed the non-link branch and its doc comment fromfollowingLineinsrc/web/pages/upstream-follow.ts.upstreamUrlalready refusesgit:, so the About line always links.Already on #3565's branch, left as is:
REMOTE_PROTOCOLS.checkUpstreamtakes thecheckingclaim itself.repo.upstream_followisadminsinsrc/core/event_audience.ts.git://upstream is refused, with a test.audienceFiltertest is there.Not done: the live update on on/off (#3617), the terminal (#3559), the gate-lands-as-merge test (#3558), and
git://in migrate (#3613). Migrate's error text still mentionsgit://.To try it, run
bun test test/upstream_follow.test.ts test/migrate.test.ts.🤖 Generated with Claude Code
Closes #3622