interplane.Get Omega
Read in your language

interplane-forge

INTERPLANE Forge

Brought by drakestapleton

branch main Branches Tags History

interplane-forge / docs / collab-write.md

146 lines · 11156 bytes Raw Blame History Source

Collab writes (wave 2): comments, reviews and opening patches from the web

Status: Phase A IMPLEMENTED and HOST_TESTED (wave 2); Phase B PROPOSED, waiting for Drake. Owner: ForgePatches. The server has no Radicle write path; Phase B needs Manager and Drake approval.

The rule this design keeps

"Agents express intent. The forge retains authority." On Radicle, authority over a change is the author's key: every COB change is a git commit signed by the author's node key, and every namespace's refs are signed by its owner (refs/rad/sigrefs). So the forge server must never hold, derive or ask for a user's private key, and must never write a change in the forge node's name for someone else. A web comment that the forge signed would show the forge node as the author. That is false, so it is not built.

What Radicle requires (measured on spark, rad 1.10.3)

Phase A: compose on the web, run with rad (no server write path)

The web composes and checks the action; the user's own node signs and publishes it. Built in collab/co9comp.om (form decoder, text checks, compose store), collab/co9form.om (forms, POST handlers) and collab/co9page.om (compose page, download).

  1. A signed-in user (Radicle-key session, docs/social.md) gets a form under a patch page (comment on the shown revision, or review it: no verdict, accept, reject) and under an issue page (comment), and the forms <o>/<r>/issues/new (title, description) and <o>/<r>/patches/new (title, description, draft). Lists link the two new forms. Signed out, each place shows a sign-in link instead.
  2. POST <o>/<r>/issues/<id>/compose, <o>/<r>/patches/<id>/compose, <o>/<r>/issues/new and <o>/<r>/patches/new pass the contract section 5 gate in order: signed out → 303 to login; CSRF token wrong or missing → 403; more than 30 writes a minute from the address → 429. Then: the target id (a unique prefix of 4..40 hex) is a COB of this repo, else 404; the revision (field rev, default the latest) is an unredacted revision of the patch, else 400; verdict is comment, review, accept or reject, else 400. Text: CRLF and CR become LF; it must be UTF-8 (no overlong forms, surrogates or code points above U+10FFFF) without NUL, control bytes or DEL (tab and LF allowed in a body; none in a title); trailing blanks and leading blank lines are trimmed; body ≤ 60000 bytes and required for comments and the no-verdict review; title 1..256 bytes on one line. A refusal is a 400 page naming the rule; nothing is kept.
  3. A checked compose is kept in memory (32 slots, oldest reused) for 15 minutes, bound to the session's CSRF token, the repo and a 128-bit id from /dev/urandom; the POST answers 303 to <o>/<r>/compose/<id>. Another session, a signed-out visitor, another repo or an expired or altered id gets 404.
  4. The compose page shows the Markdown preview (the same renderer as the pages), the file to download (<o>/<r>/compose/<id>/<file>, text/markdown, attachment) and the exact command for sh, bash or zsh. The command holds only fixed words, hex ids and the RID; the user's text reaches rad or git only through the downloaded file and "$(...)", so nothing in it is ever parsed by the shell:
    • issue comment (comment.md): rad issue comment <issue> --repo rad:<RID> --message="$(cat comment.md)"
    • patch comment (comment.md, on the revision): rad patch comment <revision> --repo rad:<RID> --message="$(cat comment.md)"
    • review (review.md): rad patch review <patch> --repo rad:<RID> --revision <revision> [--accept|--reject] --message="$(cat review.md)", or --no-message without text (no file)
    • new issue (issue.md: title, blank line, description): rad issue open --repo rad:<RID> --title="$(head -n 1 issue.md)" --description="$(tail -n +3 issue.md)"
    • new patch (patch.md, same layout), from the clone on the proposed branch: git push -o patch.message="$(head -n 1 patch.md)" [-o patch.message="$(tail -n +3 patch.md)"] [-o patch.draft] rad HEAD:refs/patches. git-remote-rad refuses a push option with a line break, so a one-line description goes in the second patch.message; a longer one is set afterwards with rad patch edit PATCH_ID --repo rad:<RID> --message="$(head -n 1 patch.md)" --message="$(tail -n +3 patch.md)", with the id git push printed.
  5. The user runs it from a clone; their node signs the change and sigrefs and announces them. The forge's node fetches as it does today; the page shows the change once it is in storage, read by the same wave 1 code.

Phase A adds no trust path: the server only validates and renders text, and the POST handlers never run rad or git. Replies, labels and state changes are not composed yet (the forms cover comment, review, new issue and new patch).

Measured with rad 1.10.3 in a throwaway profile (collab/tests/compose.sh): every command above, run as shown, published its change and the forge then showed it; a title beginning with - or holding quotes, $(...) or backticks is passed through unchanged; rad patch review without --accept/--reject records a review without a verdict.

Phase B: one-click writes signed in the user's own tool

For users who do not want a terminal step per action, a small first-party signer (seeded Omega, with ed25519 from the seed crypto) runs on the user's machine. The forge never sees the key.

  1. The web builds the unsigned change commit bytes for the composed action (tree, parents = current tips of that COB in the user's namespace or the root change, related commits, author <alias> <alias@nid> <ts> +0000) and the new refs blob for the user's namespace, and offers both as one download forge-intent-<compose id>.txt (hash of each part shown on the page).
  2. forge-sign forge-intent-….txt shows the user what will be signed (action JSON, COB, repo), signs the commit (SSHSIG, namespace radicle) and the refs blob (raw ed25519), and prints one armored block.
  3. The user pastes the block into the page. POST …/submit (session + CSRF + compose id, block ≤ 8 KiB) checks, in order: compose id unused and unexpired; the session DID equals the commit's signing key and the sigrefs key; ssh-keygen -Y verify -n radicle on the commit with an allowed-signers line built from the DID; the raw signature over refs; the parents are still the current tips (else 409 and a fresh compose); the action JSON is byte-equal to what was composed.
  4. Only then does the server write: git hash-object -w for the blobs and the exact commit bytes, and a compare-and-swap ref update (git update-ref <ref> <new> <old>) for the COB ref and refs/rad/sigrefs, inside the user's own namespace only. All argv execs on the allow-listed storage, no shell.
  5. The node announces the user's refs (rad sync --announce, or the node's own refs-announce), which other peers verify against the user's signatures, not the forge's.

Phase B is a Radicle storage write and a new trust path. It needs Manager approval, a negative-control suite (forged commit signature, forged sigrefs signature, DID mismatch, stale parents, replayed compose id, tampered action, oversized block, CSRF missing, unsigned session, rate floods) and an independent replay of the verification with heartwood's own radicle-cli reading the result back.

Opening a patch from the web

A patch needs its head commit in storage. rad 1.10.3 has no rad patch open; a patch is opened by pushing to the magic ref git push rad HEAD:refs/patches (git-remote-rad). Phase A: the page gives that command with the push options measured on rad 1.10.3 (-o patch.message= once for the title and once for a one-line description, -o patch.draft; an unknown option or a line break is refused) and rad patch edit for a longer description (step 4 above). Phase B: only for heads already in the user's namespace (pushed with git push rad), the web composes the revision action against that head and signs it as above. The web never accepts uploaded git objects.

Limits and safety (both phases)

Status

PieceStatus
Read-only patches, issues, verdicts, diffs (wave 1)IMPLEMENTED, HOST_TESTED (collab/tests/check.sh)
Verdict line: only an exact first line VERDICT <word> head=<revision head>, word MERGE, MERGE_AFTER_FIX or REJECT, no folder or file name (sec P3-1); patch page names the commit forged was built from (corr P1; run.sh writes tcbldc)IMPLEMENTED, HOST_TESTED (collab/tests/verdict.sh, 11 checks)
Markdown descriptions, comments and review bodies (browse renderer)IMPLEMENTED, HOST_TESTED (collab/tests/check.sh, browse md fixtures)
Phase A compose + rad/git commandIMPLEMENTED, HOST_TESTED (collab/tests/compose.sh, 89 checks)
Raw diff cache bound (2 GiB LRU, 512 MiB per file)IMPLEMENTED, HOST_TESTED (collab/tests/cache.sh, 16 checks)
Phase B web submit with user signaturesPROPOSED, needs Manager approval