Threat model: censorship resistance (v0, 2026-11-28)
The claim in
docs/SPEC.md is "no silent removal or alteration, and no single point of control", not "unreachable".
This file says what the jit-trust code supports today, what it does not, and what a client must do to get it.Built and tested in
crates/jit-trust: keys and ids (id.rs), the ref log (log.rs), Merkle proofs (merkle.rs),
git object checks (objects.rs), bundles (bundle.rs), mirroring (mirror.rs), tokens (token.rs) and agent
certificates (principal.rs), and the wiring of the log into jit-store ref updates (host.rs). Not built: any
witness network or gossip, and root key rotation. Statements about those are marked "(designed)".1. What is protected, and from whom
Assets:
- The history of every ref: which commit each ref pointed to, in which order, by whose hand.
- Git objects reachable from the refs, and non-git records (changes, reviews, issues) anchored by digest.
- The repository's identity,
RepoId: the root ed25519 public key, fixed at genesis. - The ability to continue the project under that identity on another host.
Adversaries:
- A hostile or coerced host. It runs the server, holds the log signer key, and may hold the root key (custodial).
- A network attacker between client and host. TLS is assumed; the log makes a TLS failure detectable, not harmless.
- A malicious mirror, or anyone handing out a bundle.
- A contributor or agent holding a valid token, possibly over-scoped or stolen.
- A thief of any one key (root, signer, principal, instance, witness).
2. Trust anchors and keys
| Key | Held by | Can do | If stolen or lost |
|---|---|---|---|
Root (RepoId) | Owner; also the host if custodial | Sign Genesis and SetSigner: choose who signs the log | Theft: the thief can SetSigner to its own key and fork the log at any point. Loss: no future signer change. No rotation or recovery in v0. |
| Log signer | Host (a self-hoster may use the root key) | Sign every RefUpdate and Record entry and every checkpoint | The thief can append any ref move or record and sign checkpoints for a fork. Evidence names the key, not the person. Loss: the log stops until a root-signed SetSigner. |
| Principal (person, agent) | That principal | Sign push certificates (sign_push); mint tokens (Token::mint); issue AgentCert | The thief can sign writes as that principal and mint tokens up to the principal's RepoAcl rights on every instance that knows it. |
| Instance key | Host | Mint tokens for any subject, bounded by that subject's RepoAcl rights | The thief can act as any principal on that instance within their rights; such writes are host-attested only. |
| Witness | Independent party | SignedCheckpoint::cosign | The thief can cosign a fork. No witness set exists yet. |
3. What a hostile or coerced host CAN do
| Action | Detectable? | By whom, with what evidence |
|---|---|---|
| Refuse service, stop serving the repository | Yes, trivially | Anyone. Not prevented. The remedy is portability (section 8). |
Append entries nobody asked for: move or delete a ref, anchor a Record | Visible, not prevented | Anyone who reads the log: the entry is permanent and signed by the signer key. |
Attribute a write to a principal who did not make it, when the entry has no actor_sig | Not distinguishable from a real write | The Actor fields are host-asserted. Only an entry with a valid actor_sig binds the principal, on whose behalf it acted and the token id. Stock git clients cannot produce one. |
| Replay a push certificate when a ref returns to an earlier value | No | Open problem 3. |
Set any time_ms | No | Entry and checkpoint times are the host's clock. Nothing verifies them. |
| Split view: show different logs to different clients | Only by comparison | Two checkpoints for one RepoId, signed by the same signer, that no consistency proof connects. Needs clients, mirrors or witnesses to compare. No gossip exists. |
| Freeze: keep serving an old valid checkpoint | Only by a client that saw a newer one | Nothing bounds checkpoint age. |
| Rewrite history after genesis for a client that holds nothing | No | A fresh client verifies a fully re-signed log as valid (shown at the end of a_mirror_detects_a_rollback_and_a_fork_and_keeps_the_evidence). |
| With the root key (custodial): anything the owner can | As above | Including SetSigner to a new key and a new fork from any point. |
Stop serving content and say so: a Withheld entry (decision 0047) | Yes, by design | Anyone who reads the log: what is withheld, since when, the reason class and reference, under the host's key. Mirrors and bundles then treat that content as optional and report it; copies that already hold it keep it. Nothing checks that the stated reason is true. |
| Stop serving content without saying so | Yes, as a failure | A mirror or a bundle check fails on the missing objects of a ref that no withholding covers. |
| Delete objects no current ref reaches; withhold record content | Content no; existence yes | The log still names every old Oid and every record digest. Bundles count earlier ref values they do not carry (history_missing) and list absent records (records_missing); a mirror does not fetch earlier values. |
| Read everything; see who pushed what and when | Not hidden, by design | Non-goal (section 8). |
4. What it CANNOT do without detection
Each row assumes the client verifies (
verify_log, verify_bundle or mirror), and where noted that it kept an
earlier checkpoint. Tests are in crates/jit-trust/tests/log.rs (L) and tests/portability.rs (P).| Attack | Mechanism | Test |
|---|---|---|
| Drop an entry from the middle | seq must equal position (BadSequence); prev must chain | L a_dropped_entry_is_detected |
| Reorder entries | BadSequence | L reordered_entries_are_detected |
| Insert or duplicate an entry | BadSequence | L an_inserted_or_duplicated_entry_is_detected |
| Alter any byte of a stored entry | Canonical decoding, strict ed25519 verification, chain | L any_altered_byte_is_detected |
| Alter one entry and re-sign it with the signer key | The next entry's prev no longer matches (BrokenChain) | L an_entry_altered_and_resigned_by_the_host_breaks_the_chain |
| Rewrite from some point and re-sign everything after (needs an earlier checkpoint) | The old checkpoint does not match; no consistency proof exists; the two checkpoints are evidence | L a_history_rewritten_from_some_point_on_fails_against_what_was_seen_before; P a_mirror_detects_a_rollback_and_a_fork_and_keeps_the_evidence |
| Drop the last entries (needs an earlier checkpoint) | CheckpointMismatch; MirrorError::Rollback | L dropped_last_entries_are_detected_against_a_checkpoint_seen_before; P as above |
| Sign entries with any key but the signer in force | WrongSigner, BadSignature | L only_the_signer_in_force_can_extend_the_log |
| Hand the log to another key without the root key | SetSigner needs the root key | L the_host_cannot_hand_the_log_to_another_key_but_the_root_can |
| Pass off another repository's log, or a genesis the root did not sign | WrongRepo; WrongSigner at 0 | L a_log_is_bound_to_its_repository_key |
| Move a ref from a value the log never gave it | Replayed compare-and-swap (RefMismatch) | L a_forged_update_from_a_value_the_ref_never_had_is_detected |
| Reuse an actor's push certificate on another write, or change for whom it acted | BadActorSignature | L an_actor_signature_binds_the_write_to_the_actor, an_actor_signature_also_covers_for_whom_and_under_which_token |
| Serve an object whose content differs from its id, or leave out an object a ref needs | Every object is re-hashed (SHA-1 with collision detection); the closure of every ref must be complete | P a_mirror_refuses_altered_or_withheld_content_and_changes_nothing, a_tampered_or_misattributed_bundle_is_refused |
| Serve different content for an anchored record | The content must hash to the digest in the log | P a_mirror_refuses_altered_or_withheld_content_and_changes_nothing |
| Edit the log file on disk behind the server | RepoLog::open re-verifies everything | L the_file_store_persists_discards_a_torn_tail_and_exposes_tampering |
"Detection" means the client gets an error and changes nothing. It does not mean the honest data is recovered: that
needs a copy elsewhere, which is what mirrors and bundles are for.
5. What a client MUST check
State to keep per
RepoId, outside the host's control: the last verified SignedCheckpoint and the log up to it (or
at least its size, root, head, signer and refs). FsRepo keeps exactly this under <data>/trust/<RepoId>/. A client
that keeps nothing gets only the first rows of section 4.(a) First clone.
- Get the
RepoIdfrom a source the host does not control (the project's site, a signed release, a person). ARepoIdread from the same host proves nothing. FsRepo::open(data, repo, format)thensync_from(&remote); or fetch all entries and the latest checkpoint and callverify_log(repo, entries, Some(&cp)), then check each object asobjects::walkdoes.- Check the refs you use equal
VerifiedLog.refs. Refs served outside the log are not covered. - If witness keys are configured, require
cp.witnessed_by(&trusted) >= k(designed; no witnesses exist). - Keep the checkpoint.
(b) Every later fetch.
mirror does all of this; a client doing it by hand must do the same.- Fetch the new checkpoint. Smaller than what you hold: rollback. Stop and keep both checkpoints.
- Equal size: require an equal root. A different root with a valid signature is equivocation evidence.
- Fetch the entries since your size and replay them on top of your state (
RepoLog::preview). A consistency proof alone is not enough: it shows append-only, not that the new entries obey the signer and compare-and-swap rules. - Check
verify_checkpoint(&new, repo, signer)with the signer in force after the replay, not the key the checkpoint names. ASetSignerin the new range changes it. Check the checkpoint's root equals the replayed root. - Fetch and re-hash the objects the new refs need; check each record against its digest.
- Only then extend your log and replace the stored checkpoint.
A light client that does not replay entries can check only
verify_consistency(old.root, new.root, proof) and
verify_inclusion for the entries it cares about. It then trusts the host on the signer in force and on ref values.(c) A mirror. As (b), and also:
- Keep the checkpoint in a separate file from the log.
FileLogStore::opendiscards a torn tail, so a log file cut short looks like a shorter valid log;FsRepo::openrefuses a log shorter than its stored checkpoint. - On
MirrorError::RollbackorMirrorError::Fork, keep the local copy unchanged and publish both checkpoints. - Know the limit:
mirrorfetches what the current refs reach. History that was force-pushed away before the first sync is not fetched, and nothing checks the remote still has it. - Serve your checkpoints to others so that views can be compared.
(d) Importing a bundle.
- Call
verify_bundle(input, Some(repo))with the out-of-bandRepoId. WithNonethe bundle proves itself under whatever key it names: checkBundleSummary.repoyourself. import_bundlerefuses a bundle that is behind the local log or diverges from it, and writes the log last.- Read
BundleSummary.records_missing: records the log anchors whose content the bundle does not carry. - A bundle says nothing about freshness. Compare its checkpoint with any other view you can reach.
6. Mirrors and malicious bundles
A mirror or a bundle maker holds no signer or root key, so it cannot forge entries or checkpoints, and it cannot pass
off another repository: everything is bound to
RepoId. It can serve an old prefix (freeze), leave out record
content (reported as missing), refuse service, or serve one side of a host's split view. It can serve a validly
signed fork that a stolen or custodial root key created; nothing in v0 says which fork is right. Objects no ref
reaches and records the log does not anchor are refused, so a bundle cannot smuggle content in. Cost limits: a bundle
is verified in memory in v0, with each object or record capped at MAX_BUNDLE_ITEM (1 GiB) and each entry at
MAX_ENTRY_BYTES (16 MiB); there is no cap on the total, so a client must bound the bytes it is willing to read.7. Tokens and agents
Tokens are Biscuit public-key bearer tokens, attenuable offline (
Token::attenuate). The verifier
(Authority::authorize) caps size (4 KiB) and blocks (8) before parsing, accepts only blocks of one fixed shape,
intersects the typed scopes itself and never runs Biscuit's Datalog engine, so a holder cannot widen a token or make
verification expensive by appending a crafted block (tests in token.rs). The issuer, the revocation list and the
RepoAcl are consulted on every call, cached tokens included.- A stolen token works for anyone until
not_after_ms, within its scope. Nothing binds a token to its holder's key. - A token authenticates one principal (
Grant.actor): its issuer, or for an instance-minted token the subject the instance vouches for. Sub-agent names in a token (Grant.delegate,chain) are written by whoever held it and prove nothing: anyone holding a token can name any principal. Ownership and permissions must key onactor(decision 0045); a delegate is proven only by a push certificate from its own key. - Attenuation narrows what a sub-agent gets. It does not protect the parent token, and the parent cannot see or revoke a child it did not record: revoking a parent block's id revokes every child; revoking one child needs its id.
- A token minted by a principal's own key is bounded by that principal's
RepoAclrights on the instance verifying it. A token minted by the instance key is bounded by its subject's rights. - An over-scoped token can make writes that are valid and permanent in the log. The log records
token_id, which identifies the token, not the hand that used it. AgentCerthas an expiry and no revocation.
Mitigations: short expiry, narrow
refs and paths, protected refs that only the merge queue moves, and push
certificates from the agent's own key.refs/queue/ is the server's own: the landing queue pins its candidates there, and no token writes under it,
an administrator's and the instance root's included (a token that may write and not read gets the answer for
a repository it cannot see). It is refused twice: at authorization, before a push is
read (the API's trust adapter, RESERVED_REFS), and inside the ref transaction (jit-collab's guard). Reading
there is as for any ref.The queue's pinning and unpinning of a candidate there (its own cause,
queue-pin, used for nothing else) are
not entries of the signed log; everything else is, a landing included, whatever ref it moves: a candidate pin is scratch state,
and what the queue did is recorded by the landing (the target's ref update and the anchored landing record
naming the rule). What this costs: a host could pin and unpin arbitrary commits there without a trace in the
log. It gains nothing by it that it did not have: a host can hold any object it likes without telling anyone,
the prefix is not advertised, and nothing under it reaches a clone, a bundle or a mirror. A ref there moved by
anyone, or by any other cause, is still logged. Under a withholding a candidate is handed out or refused by
the rules in docs/contracts/jit-trust.md ("Under a withholding").A refs withholding hides refs, not content. It covers names: the host refuses those refs and what only they
reach. Content that another served ref also reaches (a branch built on it, a change's pin, a tag) stays served.
Someone who wants a commit kept available after its branch is withheld needs only one other ref that reaches it,
made before or after; someone complying with an order about content must cover every ref that reaches it or
withhold the whole repository, and should check with a fresh clone. The stronger meaning (a ref built on withheld
content is itself not served) is decision 0070 and is not built.
8. Non-goals, concretely
The spec excludes anonymity, hiding content from the operator, and evading lawful process against a user. So: a host
that receives a lawful takedown can remove the repository at that host, and this design does not stop it. Every host
sees content and metadata. The log is readable by anyone who can read the repository: who pushed what, when, and
under which token id. What the design gives instead: a removal or alteration at one host shows up as a refusal or as
a signed entry, not silently; it cannot change what mirrors and bundles already hold; and when the owner holds the
root key, one root-signed
SetSigner on any mirror's copy continues the project under the same RepoId with no help
from the old host (P the_owner_moves_the_repository_to_a_mirror_without_the_old_host). With a custodial root key
that last property does not hold, which is why a host hands the key over on request (Trust::hand_over_root_key).An account is not needed to leave. Whoever holds the root key can present a
RootRequest (signed with that key,
addressed to the host, valid for minutes) and receive the bundle; the host consults no account, token or grant
(tests/key_holder.rs, decision 0049). A suspension therefore governs writing at that host, not access to one's
own history. It is not a way around a withholding: what the host withholds stays out of that export too. A stolen
root key gives the thief the same export.9. Open problems and planned work
Ordered by how much each weakens the headline claim.
- No comparison of views. Split view and freeze are undetectable unless clients compare checkpoints. Cosigning
exists as a type (
Cosignature,witnessed_by), butcosigndoes not itself check consistency, the cosigned message has no witness time, and there is no witness network or gossip. Until then "no silent alteration" holds only for clients that kept an earlier checkpoint. And no client keeps one today: there is no route for a consistency proof, and neitherneo verifynor the log page remembers a checkpoint. What to build, and the options for a reader who holds nothing, are decision 0073. - No fork-choice rule for migration. "The log with the root-signed
SetSignerwins" is not in the code:verify_logaccepts the old host's fork and the owner's fork alike. If the old host appended entries after the mirror's copy ends, clients that saw them hold checkpoints the moved log cannot extend, and they will reject the legitimate move as a fork. A rule is needed (for example: accept divergence only where the other branch's first entry is a root-signedSetSigner), plus tooling that hands clients the evidence. - Push certificates are optional and not bound to a position.
push_messagesigns the repository, the fullActorand the body. If a ref returns to an earlier value (revert, force-push, delete and recreate), the host can replay an old certificate. Planned: bind a nonce orprev, and make client-signed pushes the default forjit. Until then every entry made through today's clients is attributed on the host's word. - Root key: no rotation, no recovery, no shared control. Theft lets the thief fork from any point; loss freezes the
signer for ever. The root key can also equivocate: two different
SetSignerentries at one position. - Freshness. Nothing bounds checkpoint age. Planned: witness-signed times and a client maximum age.
- Records can be re-anchored. Nothing forbids a second
Recordentry with the same kind and id; bundles and mirrors carry the content matching the newest digest. The earlier digest stays in the log, so the change is visible, but a reader showing "the latest" shows the newest. Records need revision rules and actor signatures. - Retention. Objects no current ref reaches are not required by any check. The log keeps every old
Oid, so a mirror could check availability; no code does. Bundles do not carry them. - The spec sentence "a host cannot rewrite or drop history without it being provable" is true only against someone who holds an earlier checkpoint or entries. For a client with no prior state the host can serve any log after genesis, or any log at all with a custodial root.
- SHA-1. v0 repositories use
ObjectFormat::Sha1. Hashing usessha1-checkedand treats a detected collision attack as an error; the path is not exercised by a test with a real collision. The log itself is SHA-256. - Startup cost. Opening a log re-verifies every signature: about 43 µs per entry, so tens of seconds per million entries. A host under pressure to restart quickly must not skip it silently; a signed local snapshot is planned.
- Wiring.
jit-serverregistersHostLogwith the store when it starts, so every ref update, by git or by the API (the landing queue's own pins underrefs/queue/excepted, above), is logged inside the transaction that moves the ref: there is no push to a running server that is not logged (the earlier sentence here said otherwise and was stale). A ref update that names no actor is refused. A custodial root key seed sits unencrypted in the metadata store. - Leaving a hosted instance: what you can and cannot take today. A verified copy: yes. Anyone who can read
a repository can clone it with git and verify its signed log (
neo verify), pinning the repository's id, and can mirror it; the copy proves what the host said and when. A signed bundle over HTTP: not yet (the library writes one,export_bundle; the routeGET /v1/repos/{repo}/bundleis being built). The signer: not yet. Moving a repository's log to another host as the same repository needs its root key, to sign the hand-over (SetSigner). For a repository created on a hosted instance the instance made that key and holds it; the library can hand it to the owner (Trust::hand_over_root_key), and no route does. So today a hosted user can leave with everything that proves the history, and cannot yet continue that history elsewhere under the same identity; another host would start a new repository from the copy. Whether and how the key is handed over is the operator's decision, not yet taken: once the owner holds it, the host can no longer sign a hand-over on the owner's behalf, and a lost key cannot be replaced.