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)
- A change commit (
refs/namespaces/<nid>/refs/cobs/xyz.radicle.patch|issue/<id>) has a tree with blobs0,1, … (one JSON action each) andmanifest; parents are the previous tips of that COB plus the commits the actions name (Rad-Related:trailers) and the identity root (Rad-Resource:). It carries agpgsigSSH signature (SSHSIG, namespaceradicle, sha256) by the author's ed25519 key. Collab wave 1 reads the author DID from that key (cosig). - The namespace's
refs/rad/sigrefscommit holds blobsrefs(the ref list) andsignature(64 bytes, a raw ed25519 signature overrefs). Peers reject refs that do not match it. ssh-keygen -Y signproduces SSHSIG, which fits the change commit but not the raw sigrefs signature. A complete web-signed write therefore needs two signatures, one of them raw.
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).
- 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. POST <o>/<r>/issues/<id>/compose,<o>/<r>/patches/<id>/compose,<o>/<r>/issues/newand<o>/<r>/patches/newpass the contract section 5 gate in order: signed out → 303 tologin; 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 (fieldrev, default the latest) is an unredacted revision of the patch, else 400;verdictis 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.- 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. - 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 reachesradorgitonly 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-messagewithout 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 secondpatch.message; a longer one is set afterwards withrad 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.
- issue comment (
- 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.
- 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 newrefsblob for the user's namespace, and offers both as one downloadforge-intent-<compose id>.txt(hash of each part shown on the page). forge-sign forge-intent-….txtshows the user what will be signed (action JSON, COB, repo), signs the commit (SSHSIG, namespaceradicle) and the refs blob (raw ed25519), and prints one armored block.- 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 radicleon the commit with an allowed-signers line built from the DID; the raw signature overrefs; the parents are still the current tips (else 409 and a fresh compose); the action JSON is byte-equal to what was composed. - Only then does the server write:
git hash-object -wfor the blobs and the exact commit bytes, and a compare-and-swap ref update (git update-ref <ref> <new> <old>) for the COB ref andrefs/rad/sigrefs, inside the user's own namespace only. All argv execs on the allow-listed storage, no shell. - 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)
- Inputs (Phase A as built): comment, review and description ≤ 60000 bytes, title ≤ 256 bytes; the request body is capped at 64 KiB by the server. Proposed for later: label ≤ 64 bytes and ≤ 16 labels. All HTML output escaped as in wave 1; Markdown through the browse renderer.
- Rate: 30 writes per minute per IP and per DID (shared with the social gate), 60 signature verifications per minute globally.
- Pages stay JavaScript-free: forms, 303 redirects and downloads only; CSP unchanged.
- Allow-listed repos only; a non-listed repo is 404 before any collab code runs.
- Email-only accounts cannot write: a write always needs the DID's signature.
- Raw diff cache (
<data>/collab/<rid>/<base>-<head>.full.diff,git diff --full-index,collab/co8cache.om): at most 2 GiB in total (UnitConvert[Quantity[2, "Gibibytes"], "Bytes"] -> 2147483648) and 512 MiB per file (536870912 bytes); after each new file the least recently used files (status-change time, which a cache hit refreshes) are removed until the total fits, as dl does for archives. A diff over the per-file limit is refused with a page saying so and is not kept. Tested with the caps cut to 560000 and 21000000 bytes (collab/tests/cache.sh).
Status
| Piece | Status |
|---|---|
| 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 command | IMPLEMENTED, 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 signatures | PROPOSED, needs Manager approval |