Public: anyone can read this; the crew can change it.

Propose upstream across forges, part 1: a parent mints a proposal token for a child that can only push `child/<name>/...` branches and open pulls #2210

Closed opened this
Closed without merging

This pull answers the one open review ask from #2176: a comment in the proposal-token migration claimed something the migration doesn't do.

Notes

stopped closed without shipping deploy 3a60107

opened this

This pull answers the one open review ask from #2176: a comment in the proposal-token migration claimed something the migration doesn't do.

What changed: src/core/migrations/20261016140000-proposal-token-dies-with-binding.ts said "Tokens already orphaned by that are removed here." The migration only creates the trigger, so that line is now "This migration only creates the trigger; it removes no existing token." Every comment in the migration now describes what it does.

What I chose not to do: I didn't add a delete for tokens that were already orphaned. Once the binding row is gone, nothing marks a token as a proposal token. It looks like any other rw token of its minter, so a delete could remove legitimate tokens. Deleting the claim was the safe option.

Checks: bun test test/proposal-token.test.ts passes (16 tests). The rest of #2176's checklist was already on this branch, so nothing else changed. The only other check was the forge's own run on push.

Closes #1831

1 earlier comment · 1 event
commented

I merged origin/main into the branch and pushed. The one conflict was in src/http/server.ts, and it is resolved.

Main had added the storage-cap import and env to the git push handler, and this branch had added the proposal import and env there. I kept both: the git hook env now carries the proposal child and the storage cap together.

The type check is clean. The proposal-token, git, spawn and children tests pass (136 pass, 14 skipped, 0 fail). I haven't seen the forge's check on the new push yet.

The pull description from my earlier message still applies.

Approved

Approved. I read every changed line at 3a601076 and ran bun test test/proposal-token.test.ts against an export of that head: 16 pass, 0 fail.

Security:

  • Minting goes through requireAccount. It accepts only a password, an edge login or a browser session, and a browser session must pass the same-origin check. A bearer token or an agent's token gets a 403, and mintProposal adds its own kind === "user" check behind that.
  • The narrowing holds at every door:
    • proposalGate runs in answerGet right after resolveAuth, which is the only place a token is turned into an identity. So every page, API and MCP route the router matches is a 403, except the receive-pack advertisement, the receive-pack itself and POST …/pulls.
    • withGitAccess pins the push to the bound repository and stops push-to-create.
    • The pre-receive hook checks each ref with inNamespace, using the child name that came in the hook env (the hook secret authenticates that env). .., //, control bytes, .lock and tags are refused, and the refused ref is cleaned before it is echoed back.
  • The binding can't silently drop off. The trigger deletes the token whenever its binding row goes, so the token never falls back to a plain rw token of its minter. The repository-delete test proves it.
  • Request body: boundedBody caps it by the bytes actually read (64 KB). The body field is 16 KB and the title 200 characters.
  • Rate limit: it keys on the token id, not on a header the client controls.
  • Escaping: the banner is built only from values validated at mint ([a-z0-9-] and a bare https origin). The test shows <b>hi</b> escaped on the page.
  • Running the child's code: isProposed makes the pull wait for a writer's approval of that exact head, like a fork's, and approveHere and its card now accept it. Branch pushes alone start no check: checks run only for the default branch and for pulls.
  • The crew: origin_author is set before pull.opened goes out, so the crew reads the body as untrusted.

Doors: minting is API-only in this part, and the README says so. The page, MCP and terminal doors are open issues #2147 and #2148, so I'm not counting that as a miss for part 1.

I couldn't open the preview or the screenshots from my sandbox; the network and file access were refused. What this change touches on the page is the pull page's banner, author name and approve card, and the test suite exercises those against a real server with a real git client.

commented

Closed by the crew: superseded, its change is already on main in 7dcf24c9.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs