Repository navigation
feat(web): read private repos and manage their members - #51
Merged
Merged
Conversation
|
Warning Review limit reachedNext included review available in 35 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (54)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
PastaPastaPasta
force-pushed
the
feat/private-repos-web-read
branch
from
September 27, 2026 09:58
23ecca7 to
d6be866
Compare
Members decrypt a private repo in the browser: the vault holds the identity's encryption key, a per-repo session unwraps the reader's repo keys, resolves epochs and opens config, refs, issues, PRs, comments, reviews and sealed packs. Owners add and remove members with the key rotation of private-repos.md 5.5, and maintainers run the repair check of 5.6. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…mes out of URLs Shared helpers replace duplicated identity fetches, base58 and hex helpers, sleeps and admit loops; dead exports removed. A private repo's path, ref and oid route params become per-tab tokens so decrypted names never reach browser history. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A lock during a load no longer leaks a session or a decrypted home; the private home re-reads with the plain home and past the session TTL; only unreadable wraps are skipped; decrypted browse and fallback caches go with the session; a renewal reports a dropped encryption key; registering a key needs an unlocked vault; removing one of two roles does not rotate; rotations resume only to the held key; error codes match the CLI; the compose notes no longer point at dg. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Write flows use their own uncached sessions and never retire the page's; closed sessions are never served; each session's decrypted browse state goes with it. Removing a maintainer who stays a writer rotates without excluding them. URLs are sealed for any address form of a member's repo, tokens are opened only on sealed params and a stale one says so. Registering an encryption key refuses when the identity already has one the phrase does not derive and shows its cost. Import wipes the file's keys on every path; renewal notices are joined. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…ty review Every config of an epoch at or above 1 carries prevEpoch/prevEpochKey (tlv.ts and vectors from feat/private-repos). Removing a maintainer first re-anchors each epoch they anchored, and is refused when one cannot be read; new epochs go above every epoch number seen; a removal re-runs the repair check after its rotation. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…pped it When the remover's only accepted wraps for the current epoch come from the maintainer being removed, it posts a self-wrap of that key first (parity with the CLI's reanchor_before_removal), and the removal cost counts it. A remover holding the epoch only through the key chain is refused. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A rotation's self-wrap that already stands wins: a retry reads it back and goes on with its key, every wrap and the anchor carry a tag of their key in the write intent, standing wraps are read back and verified instead of trusted, and the confirmation requires the anchor to commit to our key and be readable as the write epoch. Every read of a removal's rotation drops the deleted membership even when a lagging node still lists it, and a rotation never chains from an epoch the removed maintainer anchored. Raw keys in opened anchors and sealed configs are wiped; encryption ops are bound to their key id; only keys usable for forge-core are adopted; the release warning says attachments are unencrypted; the remove dialog warns when the new key goes to a key this browser lacks. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
E306 no encryption key, E307 no key for this repo, E310 rotation or repair pending. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A rotation that removes anyone never resumes an earlier run, and one whose own self-wrap stands unseen stops and re-reads; before its anchor, every wrap it posted at that epoch is read back and must stay within the remaining members. No key goes out while the member list still changes between reads. A lost rotation runs the repair check. A maintainer's removal is refused when an epoch they anchored would fall to another key, and the rotation after it never chains from below the epoch that was current before it. A later rotation does not unsettle step 4. Private issue lists are keyed by the reader's session and dropped with it; switching identity ends private sessions. Pack standing is judged over all copies and a copy with no block height never qualifies. Release assets are refused on private repos, as dg does. Sealed config and wrap writes assert no plaintext. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The leak check and the resume rule agree on every remaining member, key or not. A rotation that fails after a removal runs the repair check on its own, and a refusal after the revoke points at Repair. A lost rotation reports lost. A maintainer's removal re-checks that no epoch changes key a few times before refusing, and never pays for its own re-anchor twice. Pack standing counts every copy only for a whole artifact checked against packHash; a ranged read is judged by its own copy. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Epochs exist only as a contiguous run from 0: a candidate anchor above the first gap is ignored with an epochGap alert, an anchor chains to exactly e-1, and a new epoch is always the current one plus one, so no high epoch number can stall rotations. A pending next epoch whose key already reached someone being removed is anchored burned (config tag 11): chain-only, never a write epoch, its content late unless a current member wrote it, and the repair check rotates past it. Three existing conformance vectors assert the old non-contiguous rule and fail until the shared vectors are regenerated with the spec change. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Repair rotates a burned current epoch even when no non-member holds it. A burn confirms its epoch n+1 anchor before building n+2, and stops on a lost race. Re-anchors keep the burned flag, and a fallback anchor must match the key, flag and chain pair. Epochs above the remover's readable run that the leaving maintainer set vanish instead of blocking the removal. Re-granting a maintainer whose old configs would change an anchor is refused, and so is adding a member while the current epoch is burned. The banner names who closed the epoch. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…t read Matches the CLI. The rotation after the delete chains from the epoch that stays current, so a remover who can't read it is refused before anything is deleted. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A leaving maintainer's top epochs vanish only when they anchored all of them and no maintainer who stays holds any. Each fresh read re-checks this, and the rotation never chains from below a kept epoch it saw. Re-granting a maintainer is refused when a config of theirs waits above the current epoch. Step 4 refuses when a later anchor that predates ours now follows it. Repair is offered only with the current key, and the banner names who set an unreadable current epoch. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
One short-id helper and a shared currentBurned and chainFrom. The preempted verdict carries its owner, so there is no extra read. The vanishingEpochs wrapper is gone and stale doc comments are fixed. Also fixes the 'holdss' typo in the refusal. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Under the spec's new anchor rule, a config posted before the epoch below it had its key is never a candidate, so the pre-empting config in this test is ignored instead of refused. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
… does The rotation is one loop, matching forge-core keyring::rotate. A removal burns any epoch it resumes or adopts. Any run burns an epoch whose standing wraps reached a non-member or hold a key a member no longer uses, instead of getting stuck. A burn resumes the next epoch from its pending self-wrap and re-checks the member list first. A maintainer removal predicts the fallback anchors from its first read and refuses before writing anything. The removal reports lost, pre-empted and mismatched rotations instead of swallowing them, and never runs repair twice. Remove is disabled only when the epoch the rotation chains from is unreadable. The remover is no longer named as a holder, and the Repair wording is softer. Dead fields are gone. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…held here An adopted self-wrap must be to the key this browser holds, or nothing else is paid. A lost rotation is reported even when the repair after it fails. The two refusals now say what happened: an epoch was already closed, or another maintainer's config always comes first. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…hile anchoring Before its burned anchor, a burn wraps that epoch's key to every remaining member, so any maintainer can finish it with Repair. Removing your own maintainer role is refused while you anchor an epoch. A refused re-grant suggests the writer role or a new identity. A re-run removal rotating past a burned epoch is now pinned by a test. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…n private repos Takes lib/private/epoch.ts and tlv.ts verbatim from feat/private-epochs-contiguous (b63ec2e): the stated-after anchor rule, burned anchors without a key below, skipEpochKey, and writeEpoch null while a non-member holds the current key. The rotation posts a burned anchor with prevEpoch only and the next anchor with prevEpochKey plus skipEpochKey. A re-anchor repeats the whole chain link, and a fallback anchor must match it. The plain grantMember and revokeMember refuse a private repo, whatever calls them. Only the private add and removal flows write membership documents there, through grantMembershipDoc and revokeMembershipDoc. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…tings The leaving maintainer's own wraps never keep an epoch from vanishing. Before the role goes, the remover self-wraps every epoch it holds only through the leaver's wraps. A refusal names the maintainer whose config would take over. The new Playwright spec checks that a private repo's settings never offer the plain Add or Remove. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…pre-burn wraps The key a rotation chains from is wiped even when the skip lookup refuses. A burn's pre-anchor wraps skip every member this run already wrapped or found standing, and the cost preview counts them. Staying maintainers who lose a dropped epoch are named too. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
An opened config's skipEpochKey, a raw key of an older epoch, was copied into the plaintext document the pages read. It is now dropped like prevEpochKey, and both are wiped after the open. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
PastaPastaPasta
force-pushed
the
feat/private-repos-web-read
branch
from
September 27, 2026 11:14
122a3e0 to
409ea9f
Compare
This was referenced Sep 27, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This is the web half of private repositories, part 1: reads and members. It follows
docs/security/private-repos.mdand matches the CLI (dg).Vault encryption key. Import has an opt-in "Enable private repos" checkbox. Settings → Keys → Enable private repos adds the key from an identity file or a recovery phrase, or registers a new one (one master-key signature, cost shown first). The key is sealed in the vault under its own HKDF subkey, never in plaintext. A renewal that loses it says so.
Private sessions (
lib/repo/private-session.ts). Each session:repoKeys through the SDK'sencryptedFor;open_content(§8.1), including the late-content rule (§8.2).Sessions are per tab and end when the vault locks, the identity or network changes, or the key changes. Write flows use their own uncached sessions.
Decrypted reads. Refs (the full reflog through the gate, keyed by ref-name hash), tree, blob and commit through sealed packs (
readPackRangewith a header cache; whole artifacts are checked againstpackHash), issues, PRs, comments and reviews. Decrypted paths, refs and oids never reach the URL: private route params become per-tab tokens (~+ 16 hex).Lock chip, alerts and the sealed state. Outsiders see only the public metadata. Members without a key are told how to add one.
Members panel. Add a member (their usable ENCRYPTION key is checked first, then the membership document and a wrap). Remove a member (the verbatim warning, then delete → rotate, cost shown). Maintainer removal re-anchors their epochs first. Repair (§5.6) is offered from the banner.
Release assets are refused on private repos, as
dgdoes. Sealed config and wrap writes assert no plaintext.Part 2 (feat/private-repos-web-writes) adds the
/newvisibility toggle, sealed browser writes and the Playwright spec.Merge order. The CLI follow-up (#64: contiguous and burned epochs, the stated-anchor rule, skip keys, safe maintainer changes) merged first. This PR is rebased onto it and takes its
lib/private/{epoch,tlv,doc}.tsand conformance harness as is; all 181 private vectors pass here.Traceability
Every UI element and rule traces to the spec. Nothing here is invented.
repoKeywrap, cost shownmembers + 1prevEpoch = e − 1skipEpochKey; burned keys are handed to every remaining member first so any maintainer can finish a burnwriteEpochis null while a non-member holds the current keyreanchor_before_removal)lib/repo/writes.ts)dg(CLI security review LOW-2)Reviews
The security reviews went through several rounds, and each HIGH or MEDIUM fix has a failing-first unit test.
keyring::rotate: a removal burns any resumed or adopted epoch; an unusable standing wrap burns instead of sticking; a burn resumes n+2 from its pending self-wrap.prevEpochKeyorskipEpochKey.Known limitations
Residual lag (fix: make the Testnet Nightly green and trustworthy #10, accepted for v1). The SDK can't pin one DAPI node per request (checked against evo-sdk 4.2.0-beta.4). A removal's reads may come from nodes at different heights. Mitigations:
A small window remains in which a lagging node can hide a just-posted document.
Comments and reviews on private repos are read-only in this PR ("aren't supported yet" note). Browser writes come in part 2.
A burn costs its author one config and costs the finisher
members + 1writes. The banner names who closed the epoch and points the owner at removal.Test plan
pnpm lint,pnpm exec tsc --noEmit,pnpm build(deleted.next/outafterwards).pnpm test: 1388 pass on master c47a954, with all 181 private conformance vectors.e2e/v2-private-members.spec.ts(moutai,E2E_WRITE=1): a private repo's settings never offer the plain Add or Remove (2/2).Live on moutai (
FORGE_LIVE=1):lib/private/private.live.test.tscreates a private repo with every §13 document type, andlib/repo/private-session.live.test.tsreads it back as a member and as an outsider.Browser QA on moutai (Playwright, real signing, local static build), screenshots in
/tmp/claude-501/pr3-qa/:The smoke repo's storage URI is
example.invalid, so its Verification card reads "Failed" on the storage row; refs are still proven. That comes from the fixture, not from this change.🤖 Generated with Claude Code