Files
synchronicity/docs/NODE_REVOCATION.md
Greg ShuflinandClaude Opus 5.5 7a5a4024c7
Build Debug APK / build (push) Successful in 7m0s
docs: the bootstrap key is per epoch; drop the revoked-node TODO
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 03:29:51 -08:00

58 KiB

Node Revocation Design

Status

Phases 1, 2, 3a and 3b are implemented; 3c and 3d are design. Phases 1-2 are on every modality. 3b's protocol half is complete, but the bump and recertify affordances it needs exist only on the CLI (syn ensemble renew-membership, syn ensemble rejoin) — see TODO.md. Named to sit with its siblings KEY_MANAGEMENT.md, BOOTSTRAPPING.md and ENSEMBLE_RESEED.md, which are the three documents it depends on most.

Three things the implementation forced that the design here had not settled, each written into the section it belongs to below: the admission handshake had to become mutual, peer_nodes had to learn cert fingerprints, and a retirement turned out to want no durable mark at all.

Overview

Revocation is removing a node from an ensemble: after it, the revoked node can no longer read the ensemble's documents, write to them, or reconfigure sibling nodes, and the surviving nodes agree that this is so without the revoked node's cooperation.

Only the first of the three phases below exists today. The phasing is deliberate: the first is a prerequisite worth building on its own merits, and the third is expensive enough that it should not block the first two.

Two threat models are in scope, and they want different amounts of machinery:

  • Decommissioning — the user still controls the device and is retiring it (sold, wiped, replaced). The holder is not adversarial. Phases 1 and 2 fully solve this.
  • Lost or stolen — an adversary holds the device, with its node secret, its delegation cert, its vault key, and a full local copy of whatever it had synced. Phase 3 is required, and even then the guarantee is bounded (see "What revocation can never recover" below).

Decommissioning is delivered first. That is a sequencing choice, not a narrowing of the goal: every mechanism phases 1 and 2 introduce is one the lost/stolen case also needs, so the cheap case is on the critical path rather than a detour.

Terminology note

LinkageStore::revoke (stores/linkage.rs:373, ADR 0017) already uses the word for a different thing: invalidating a browser-extension pairing token against a single daemon. That is node-local and about a bearer token; this document is ensemble-wide and about a node identity. Where both could be meant, say "linkage revocation" or "node revocation".


Current State: What the Code Actually Enforces

This section is load-bearing for everything below, and it contradicts a statement in an accepted ADR, so it is stated with citations.

Fixed by phase 1. What follows describes the state this document was written against, and is kept because the rest of the design rests on it and because it is the record of what was exposed. Everything in this subsection is now false of the code; the amplifiers below are not.

There was no admission control on any data-plane protocol. The endpoint advertised six ALPNs and the router accepted all of them plus iroh_gossip::ALPN. Every ProtocolHandler::accept implementation — doc_sync, artifact_sync, blob_sync, blob_stream, node_admin, ping — read conn.remote_id(), logged it, and served. None consulted the pkarr registry, the peer_nodes table, or a delegation cert.

Consequently any node that could dial one of ours could:

ALPN Capability granted to an arbitrary caller
/syn/doc-sync/… Read the whole document catalog — plaintext at rest, so plaintext on the wire — and write to it: phase 2 of serve opens a reverse stream, pulls documents/properties/edges/artifacts/tombstones from the caller, and commits them via doc_sync::promote_session
/syn/artifact-sync/… serve_push applies arbitrary artifact values through upsert_artifact
/syn/blob-sync/… Fetch any blob's ciphertext; push arbitrary blobs onto our disk
/syn/node-admin/… SetSyncPolicy, SetDocOverride, TriggerSync, ListJobs, CancelJob
/syn/blob-stream/… Byte-range reads of any blob's ciphertext

ADR 0014 stated "Authorization is ensemble membership, which the iroh connection already proves." That was never true: the QUIC connection proves the caller holds some node secret, and nothing asked whether that key was ours. The ADR carries an amendment recording this.

What is enforced

Stated precisely, because it is the foundation the design reuses:

  • Gossip announcements and purge intents are properly authenticated. gossip::verify_cert checks the presented DelegationCert carries our ensemble pubkey and bears a valid ensemble signature; handle_purge_intent additionally verifies the intent signature under the certified node key. A non-member cannot inject a peer record or a document tombstone. This is the one correct authorization site in the codebase, and the pattern phase 1 generalizes.
  • Blob content is confidential to the ensemble. Both blob protocols relay AEAD ciphertext only; derive_ensemble_vault_key (vault/mod.rs:174) takes the ensemble secret as IKM, which no non-member holds. Document, property and edge rows have no equivalent protection — they are plaintext at rest and on the wire.

The reachability bar, and why it is low

Dialing requires the target's EndpointId. Node pubkeys are listed in the ensemble's pkarr registry — a public, signed record on the mainline DHT keyed by the ensemble pubkey — so the practical bar is knowing the ensemble public key. That is not secret-grade material: syn init prints it, Settings displays it, and EnsembleStatus::dht_bootstrap_link embeds it. The gossip topic is blake3::derive_key("syn/gossip/topic/v1", ensemble_pubkey) (gossip::derive_topic), so the same knowledge admits a passive listener to the swarm, where announcements disclose every node's id, name and relay URL.

A revoked node has all of this permanently.

Two amplifiers

Independent of admission control, and not fixed by it:

  1. origin_node is attacker-chosen. On apply, provenance is read off the wire record — the several NodePubkey(rec.origin_node) reads in doc_sync::apply_records — never from the authenticated sender.

    Since amended (§3a): still read off the wire, because deriving it from the sender would misattribute every relayed record, but nothing decides with it any more. It is not a merge input, and the one consumer that treated it as evidence of possession no longer does. Any caller can attribute writes to any node key, including a revoked one or the node performing the revocation. (sender_pubkey is used correctly for possession evidence and staging sessions; the flaw is specific to provenance on synced rows.)

  2. Last-write-wins trusts a wire-supplied modified_at. WHERE excluded.modified_at > properties.modified_at (twice in stores::document) compares against a timestamp the sender chose, with no clock bound.

    Since fixed (§3a): every peer-supplied stamp now decodes through p2p::wire_time::wire_timestamp and one more than a day ahead of local time is refused along with the field carrying it. A write dated to 2099 wins every merge against that property forever, on every node it reaches. This converts a transient hostile write into permanent corruption that no later legitimate edit can displace.

Both must be fixed for the lost/stolen case to mean anything, and both are worth fixing regardless.


Phase 1: Admission Control — implemented

Landed in rust/lib/src/p2p/admission.rs; that module's docs are authoritative on the mechanism, this section on why it is shaped that way.

Goal: every protocol serves only nodes that can prove current ensemble membership.

Mechanism: a handshake preamble on every ALPN. The caller sends its DelegationCert as the first message on the stream. The server accepts iff:

  1. cert.ensemble_pubkey equals ours;
  2. cert.verify() succeeds (Ed25519 under the ensemble key);
  3. cert.node_pubkey equals conn.remote_id().

No challenge-response is needed. QUIC already proves the caller holds the node secret for remote_id(), and the cert binds that node pubkey to the ensemble, so (3) closes the replay gap — a stolen copy of someone else's cert is useless without their node secret. This is exactly verify_cert's check plus one binding step, so the implementation is a shared helper in p2p/ called from the top of each handler's serve, not six separate checks.

The ALPN strings get a version bump. The project has no backwards-compatibility constraint, so old versions are simply removed rather than dual-served.

What this buys on its own: an arbitrary node on the internet, holding only the ensemble public key, can no longer read or write anything. That is a substantial hardening independent of revocation, and it is the reason this phase is worth landing before either revocation phase.

What it does not buy: a delegation cert never expires and is signed forever. A revoked node still passes all three checks. Phase 1 alone does not revoke anything — it is the surface every later phase attaches to.

Two findings from implementing it, both worth carrying forward:

  • Ping needed gating like everything else, and was the one call site that slipped through the type-level guards, because dialling off the raw endpoint field names no Endpoint anywhere. just lint-p2p-admission now covers that class. The general lesson for phases 2 and 3: the guard has to sit on the escape hatch, not only on the intended path.
  • Credentials are loaded from the settings store per connection rather than snapshotted at startup. That is one small SQLite read per connection, and it is what will let a revocation record take effect on a running node without a restart — worth preserving when the deny-list check is added beside the cert check.

Alternatives considered

  • Gate on the pkarr registry snapshot. Rejected: it needs the DHT reachable at accept time, so it fails closed on a LAN with no internet — precisely the case the project most wants to work. The registry is discovery, not authorization.
  • Gate on the peer_nodes table. Rejected: that table is a seen cache populated by gossip and never pruned (stores/peer_nodes.rs), so using it as an allowlist means "anyone who ever announced is allowed forever" — worse than the cert check and with a confusing failure mode.

Phase 2: The Revocation Record — Decommissioning Solved — implemented

Goal: surviving nodes durably refuse a retired node, without that node's cooperation and without the ensemble key having to reach every one of them.

The central point is that revocation must be asserted positively. Absence from a record is invisible to anyone who does not re-fetch it, and any cached copy of the old record still verifies. So the object is a signed statement that a credential is dead, and the design question is who may sign one and how it travels.

The record

RevocationRecord {
    version:             u8,
    revoked_node_pubkey: [u8; 32],
    revoked_cert_hash:   [u8; 32],   // blake3 over the cert's signing payload
    revoked_at_secs:     i64,
    authority:           Authority,  // SelfSigned | Ensemble
    signature:           Signature,
}

Two authorities, for two different acts. They differ in who signs and in what they are allowed to name; a receiver applies both through the same code path.

  • Self-signed — signed by the node's own key, over the payload above. This is decommissioning: a device the user still controls announcing that it is retiring its own credential. It needs no keyphrase, which is the whole point, because the ensemble key is not on the device and asking for it turns "wipe this phone" into "go find the piece of paper".
  • Ensemble-signed — signed by the ensemble key, which per KEY_MANAGEMENT.md exists only in memory during init/register. This is removing a node the user no longer controls, and it is a keyphrase-entry operation by construction. A compromised node cannot revoke its siblings. That is a property worth keeping, not a friction to design away.

A self-signed record may name only its own signer's cert. An ensemble-signed one may name anybody's. That single rule is what keeps self-revocation from being an attack: node A cannot produce a record about node B, because the signature is checked under the node key the record itself names.

This answers the objection recorded against "A reset node is never removed from its ensemble" in TODO.md — that "a self-issued 'remove me' record is one any member could forge". It is not, provided the record is signed by the retiring node's own key rather than merely accompanied by its delegation cert. That distinction is already made twice in this codebase, for exactly this reason: NodeAnnouncement::signature and PurgeIntent::signature both exist because a delegation cert authenticates an identity, not a payload, and certs are public (p2p::admission's module docs). A third instance of the same construction is the right shape here.

The residual risk of self-revocation is that an adversary holding a node's secret can retire that node — a self-inflicted denial of service on a node whose key is already compromised, which is not a meaningful escalation.

Revoking a cert, not a node key forever

The record names a cert hash, not just a node pubkey. Three things follow, and the third is the one that pays for it:

  • Admission checks a cert. Killing the credential is exactly what admission can enforce, with no extra state.
  • It is sufficient for the lost/stolen case. A thief holds the device's existing cert and cannot mint another without the keyphrase, so denying that cert denies the device.
  • Re-admission is free. A node revoked in error, or one deliberately brought back, needs only a fresh cert — a different hash, admitted by everyone. Nothing needs an un-revocation record, which would be an unpleasant thing to have to authenticate and order correctly against the revocation it undoes. Nothing yet mints that cert for a node still holding its revoked one (TODO.md); until something does, the way back is a fresh store set up with the keyphrase.

The node pubkey rides along because that is what a human reads on the roster and what the UI keys on; it is not what the check is made against.

Where the record lives — not in the pkarr registry

Three channels, in the shape this codebase already uses for purge intents:

  1. Gossip, as a new GossipMessage::Revocation variant. Live nodes apply it within a round. PurgeIntent is the template down to the details: verify the accompanying cert against our ensemble, then verify the signature under the key it certifies, then apply.
  2. Doc-sync, as a RevocationBatch sent beside DocumentTombstoneBatch immediately after SyncHeader. This is the channel that carries the guarantee. It is durable, so a node absent at revocation time learns on its next sync; and it is transitive, so the record reaches nodes that have never spoken to whoever minted it. broadcast_purge_intent's doc comment already names this division of labour — gossip is the latency optimisation, the sync batch is the durability.
  3. A local revoked_certs table, which is what admission consults.

Records are ~140 bytes, append-only, never tombstoned, and self-authenticating — a receiver verifies the signature itself and never has to trust the peer that relayed it. So the batch can be sent unpaginated and unconditionally, like the tombstone batch it sits next to, and any node can relay a revocation it did not mint.

Why the pkarr registry cannot be one of those channels

Since written: the registry is no longer signed with the ensemble key. Every node keeps a bootstrap key derived from it, and running nodes keep the record alive (docs/BOOTSTRAPPING.md). That removes reason 1's "nothing can write it", and makes reason 2 worse: a revoked node now holds a key that writes the record. The conclusion stands, and more firmly. The registry is addressing, and nothing about who is a member is read from it. The key is derived per membership epoch, so a bump (§3b) moves the registry to an address the revoked node can't sign for; a deny-list entry alone does not.

The earlier draft of this document published revocation records to the registry as the "returning after a long absence" path. That does not work, for three independent reasons, and the first two are not fixable by spending more bytes.

  1. Writing the registry requires the ensemble secret, which nothing persists. publish_membership derives its pkarr keypair straight from the ensemble secret key (ensemble/mod.rs), so the registry can be written only while the keyphrase is in memory — during init or register. A self-revocation therefore cannot be published there at all, which alone disqualifies the registry as the transport for the case phase 2 exists to serve. More generally: the ensemble deliberately does not retain the key needed to keep its own DHT record fresh, so that record cannot be an authority for anything.

  2. A revoked node can roll the registry back without holding any key. Mainline rejects a lower sequence number only when the receiving DHT node still holds a previous item for that target — if let Some(previous) = self.mutable_values.get(&target) { … if seq < previous.seq() { … } } (mainline-6.0.1/src/rpc/server.rs). Those items live in a 1000-entry LRU on volunteer nodes and are not persisted anywhere. Nothing in this codebase republishes: publish_membership is called once, from join_existing_ensemble. So in steady state the honest packet has aged out of the DHT, and any party holding a copy of an older validly-signed packet — which every node that ever resolved the registry does — can put it back and have it accepted as current. The revoked node does not need to forge anything; it needs only to be the last one to publish, and it is the party with the strongest motive to keep doing so.

  3. The byte budget makes eviction load-bearing. The packet is capped at 1000 bytes and publish_membership already drops the oldest member entry to fit. A revocation entry that gets evicted silently un-revokes a node for anyone reading the registry, so revocation entries would have to be un-evictable, which turns a soft cap into a hard failure of node registration. Even a separate record under a derived key only buys another 1000 bytes and inherits (1) and (2) unchanged.

The positive version of the argument: revocation is ensemble state, and the ensemble already has a replication mechanism for its state that is authenticated, durable, and reaches nodes transitively. The registry is addressing — which is what RegistryMember's own doc comment already says it is deliberately limited to.

Registry hygiene survives, demoted. Dropping the revoked node's entry when the ensemble key happens to be in hand is still worth doing: it stops advertising an address nobody should dial and frees packet budget. It is cleanup, not enforcement, and it is sequenced last — apply and propagate the record first.

Where the check goes

p2p::admission::verify gains a fourth condition: the presented cert's hash is not in revoked_certs. Phase 1's note that credentials are loaded from the settings store per connection rather than snapshotted at startup is what makes this take effect on a running node without a restart; preserve it.

The client half needs it as much as the server half. Refusing to serve a revoked node stops it reading; refusing to dial one is what stops this node handing over data — EnsembleEndpoint::connect is the site.

One protocol is deliberately exempt: the one that delivers revocation records. A revoked node must always be able to hand over evidence of its own revocation, and the reasoning is in "Retiring a node" below.

A node that finds its own cert revoked stops there: it does not dial, does not serve, and says so plainly on every surface, rather than presenting an endless string of connection failures.

Retiring a node, and what the wipe waits for

Retirement is two acts: sign and deliver a self-revocation, and wipe the local store. Their order is forced — a wipe destroys the node secret, so the record can only be signed before it. Whether the wipe waits for the record to land is not forced, and is the user's call, because the fact that decides it is the state of the network at that moment.

The retirement screen is the whole mechanism. It signs the record, pushes it, shows what it is waiting for, and runs the wipe itself. It stays in front of the user for the duration, and it carries one further control: an emergency wipe now, which stops waiting and deletes immediately. That is the entire user-facing surface, and the choice the user makes on it is made at the moment they know the answer — is there a reachable peer right now — rather than having been set weeks earlier in a preference that would be wrong about as often as right.

This is a deliberate exception to the instant-feedback invariant (command-palette-and-search.md §4.1), and the only one this document asks for. The invariant exists so a user can go and do something else while slow work proceeds. Here there is nothing else: the operation's purpose is to make this node cease to exist, so there is no screen worth returning to, and a retirement that quietly failed to complete in the background is a device handed over un-wiped by a user who believes otherwise. That is the failure mode the whole flow exists to prevent, and backgrounding it is how you get it.

The machinery would fight it besides. Jobs are persisted — stores::job::JobStore writes them into the same store Store::wipe_contents deletes — so a retirement Job would record its progress and its terminal state in a database that its own success destroys. Nothing would remain to say whether it worked. Revocation does not interact with the job infrastructure at all.

Wipe now signs, broadcasts best-effort, and deletes. If nothing was listening, the surviving nodes do not learn, and the retirement has to be repaired by hand (below). It is the right answer in a basement with no signal, or when the device is being handed over in ten minutes, and the cost is one the user accepts knowingly, with it stated next to the control that incurs it.

What counts as delivery: one peer. The record is self-authenticating and rides doc-sync transitively, so a single honest node that holds it carries it to every node it ever syncs with. Waiting for all known peers would trade a strictly-better outcome for a much likelier failure — a phone that has been off for a month should not be able to stop a laptop from retiring.

Gossip is not delivery. GossipSender::broadcast returns when iroh-gossip has taken the payload, not when anyone applied it, so an acknowledgment needs a request/response: the retiring node dials peers and pushes the record on a stream that replies once it is committed. Gossip still goes out — it is how the other nodes hear promptly — but it cannot be what the wipe waits on.

The delivery path must not be gated by the deny-list, or it eats itself: the peer applies the record, and from that instant refuses this node's next connection — so a lost or truncated acknowledgment would be unrecoverable, and the retiring node would conclude failure over a record that had in fact landed. Revocation delivery is therefore served to a revoked caller. That is safe because the protocol's only effect is to accept a signed revocation record, which is verified on its own signature and not on the caller's standing: the most a revoked node can achieve on it is to prove itself revoked again. It also makes the push idempotent, so "retry until acknowledged" terminates.

Within the peer, the order is commit, then acknowledge. The other way round risks the retiring node wiping on an acknowledgment for a record the peer then loses, which is precisely the failure this flow exists to prevent. Committing first fails in the harmless direction — a wasted retry.

While the screen is up, this node treats itself as retiring: it stops dialling for sync and stops serving the data plane, keeping only delivery. There is nothing left for it to usefully exchange, and the alternative is a window in which a node that has announced its own retirement goes on accepting writes it is about to destroy.

A retirement writes nothing down, and cannot be abandoned. The confirmation is the decision; from there the screen offers a wait and a wipe, and no cancel.

The design first reached for the opposite — apply the record to this node's own deny-list at signing time, which is what would stop it syncing, and let a user who changed their mind back out before the first acknowledgment. Both halves were wrong. There is nothing to gain from the write: the store that would hold the row is the one the wipe is about to destroy. And there is something to lose — a retirement that never reached a peer would leave the row behind, and the node would come back refusing every connection with no way out short of re-registering, which is a worse state than either finishing or never having started.

So p2p::admission::Retiring is what "stop taking part" is made of: an in-memory flag, threaded to both halves of the handshake, set once and never cleared. While it is set the node serves and dials nothing but revocation delivery, which is the one thing it still has to do. It dies with the process, so a retirement killed by the app being force-stopped leaves a node that simply did not retire — nothing was written and, if no peer acknowledged, nobody was told. That is a coherent state to come back to; a durable half-retirement is not.

The first acknowledgment is still the point of no return in the sense that matters: after it the ensemble knows, and the only coherent thing left is to finish. A node that comes back up between the acknowledgment and the wipe finds itself already refused by its peers, and should say so — the roster does, from this_node_is_revoked — rather than presenting it as a fault.

Repairing a retirement that was not delivered

A record is ~140 bytes and self-authenticating, so any path is a delivery path — it does not have to be the network, and it does not have to be prompt. Before wiping, show it on both paths, not only the emergency one: copyable text on every modality, and a QR code on mobile. Every modality accepts one back — syn ensemble import-revocation <blob>, and a paste target beside the roster. A user who wiped a phone in a basement can hand its revocation to a laptop a week later, without the keyphrase and without the phone still existing.

The other repair needs no new mechanism: revoke the dead node from a surviving one with the keyphrase, which is the ensemble-signed path. It costs the keyphrase, which is exactly what self-revocation exists to avoid, so it is the fallback rather than the answer.

A one-node ensemble skips the whole mechanism. If this node has never heard of a sibling, there is nobody to notify, nobody to acknowledge, and nobody who will ever apply the record — so it does not open a wait that cannot resolve, it does not push, and it does not sign or offer a record for later import either. Retirement and reset are the same act there, and the screen should say so and do the wipe. The roster is the signal: no peer_nodes row means no audience.

The residual case is a sibling this node has genuinely never met — possible if this node joined while offline and never synced. Its retirement then goes unrecorded, and the repair is the ensemble-signed path from that sibling, which costs the keyphrase and needs nothing from the device that is already gone.

Retirement does not address content the retiring node holds the only copy of; that gap is recorded under TODO.md's reset entry and is not revocation's to close.

Precondition, now met

The roster the user picks from has to be trustworthy. Node names reach the UI via gossip announcements (ensemble/screen.rs resolves them from the peer_nodes row), and until announcements were signed, anyone in the topic swarm could rewrite what a node was called by rebroadcasting a harvested cert with a name of their choosing. Revoking by name off a roster an outsider can edit is not a safe operation. NodeAnnouncement now carries a signature by the announcing node over its relay_url, node_name and announced_at_secs, so what the roster shows is what the node itself said. The name is also sealed to the ensemble (ADR 0044), and the signature covers the sealed bytes — a receiver establishes that the node published this before, and independently of, being able to read it.

After this phase

Decommissioning works end to end and without the keyphrase: a retiring node signs its own revocation, hands it to a peer, and every surviving node refuses its cert at connect time thereafter — a refusal that survives restarts and reaches nodes that were offline at the time. A user who cannot afford to wait for that hand-off can wipe anyway, and repair the ensemble's record later from the printed record; what they give up is bounded and stated at the point they give it up. Remote revocation of a node the user no longer controls works too, at the cost of keyphrase entry, and is honest about its limits: it binds every node that hears the record, which is every node that syncs with an honest peer, but a deny-list can say nothing about a node that hears nothing. That last gap is phase 3b.

Phase 3: Lost or Stolen Devices

Phase 2 is honest revocation but rests on assumptions an adversarial holder can attack: that the deny-list reaches every node, and that the revoked node's existing copy of the vault key stops mattering. Neither holds.

3a below — bounding what a node that was hostile before it was revoked can leave behind — is now done, and closed smaller than it was written: one of its two amplifiers was already fixed and the other was a mis-diagnosis. 3b, membership epochs, is built as well, which is what makes silence fail closed. What remains is 3c and 3d.

Four pieces, roughly in dependency order.

3a. Fix the two amplifiers — done, and one of them differently

The concern is right: without these, a device that was hostile for even one sync pass before revocation leaves damage that revocation does not undo. But the two amplifiers turned out to be one real one and one mis-diagnosis.

The timestamp amplifier is closed (p2p::wire_time). Every timestamp that arrives from a peer decodes through wire_timestamp and nowhere else — the doc-sync record fields, artifact sync, tombstones, gossip, revocation delivery — and one more than 24 hours ahead of this node's clock is rejected, not clamped, along with the field carrying it. Clamping to now would make a bogus write the newest write, which is the outcome the bound exists to prevent. A stamp in the past is left alone: it loses every comparison it takes part in, so it can suppress nothing.

That is what mattered, because timestamps are what the merge rules actually compare. Everything in the system is last-write-wins over a sender-supplied stamp, and an unbounded one wins forever.

origin_node was not an amplifier, and the fix this section originally prescribed would have been wrong. Two things had to be true for it to be one, and neither is:

  • It is not a merge input. Nothing in the merge rules reads it — properties and artifacts compare modified_at, set elements compare their own add/remove stamps, tombstones compare deleted_at. A lie about origin cannot win a comparison, suppress a write, or make itself unsuperseded.
  • Deriving it from the authenticated sender would be a regression. Doc-sync is transitive by design — it is how a revocation reaches a node that never met the retiring one — so a record routinely arrives from a peer that did not write it. Overwriting the claimed origin with the sender would attribute every relayed edit to whichever node passed it on, turning a claim that is sometimes wrong into one that is systematically wrong.

What was real is what consumed it. node_status::artifact_presence_for_node inferred that an artifact's author still held its content, which put a Present on the presence grid — the thing a user reads before deciding what is safe to delete locally. That inference was unverifiable (the claim is unsigned, and about a third node) and also wrong about honest nodes, since a node that wrote an artifact and later reclaimed its content still read as holding it.

So the inference is gone rather than the field. With no evidence, an artifact now reads exactly as the blob beside it always has, from the one row that came from the node itself: if the node-document record says that node holds the document, it references this artifact — Ref, "it should have this" — and otherwise Unknown. Possession is now only ever asserted from NodeContentStore, which is written against the authenticated sender.

origin_node stays as provenance, documented at its definition as a claim rather than a credential: safe to show, unsafe to decide with.

And the inference outlived its removal. artifact_presence_for_node was fixed; the desktop's artifact grid did not call it for every row. A node named as an artifact's origin that had no NodeDocumentRecord got an extra row assembled by hand, and that row read Present whenever the local store held the artifact value — authorship as possession, on the same grid a user reads before deciding what is safe to delete, for a good while after the helper beside it grew four paragraphs explaining why that is wrong. It is now node_status::artifact_presence_without_record, which takes the same NodeContentStore evidence as its siblings and floors at Unknown rather than Ref — with no record, the node has not claimed to hold the document either, so even the weak rung is unearned. The lesson worth keeping: a rule like this needs one home, not one correction. A caller that assembles a presence row itself will get it wrong however well documented the function next to it is.

Making attribution decidable would need a signature per record under the claimed origin. That is settled as not worth building — see the Open Questions entry below for the arithmetic, and for what would reopen it.

3b. Membership epochs — implemented

Built as designed below, in ensemble::epoch (the EpochBump record and the cert-currency rule), stores::epoch (the one forward-only row, and the bumps kept for relay), p2p::admission (the check, in both directions), p2p::gossip + p2p::revocation_delivery (carriage), and ensemble::retire::{bump_epoch, recertify}. The design text is left in the present tense below; what it describes is what shipped. The one thing it does not cover is where the affordance lives, and today that is the CLI and the daemon only — TODO.md carries that gap.

Add an epoch: u32 to DelegationCert, inside the signed payload (ensemble::signing_payload, which DelegationCert::create and verify both build), and record the ensemble's current epoch as replicated ensemble state alongside the revocation records themselves. A cert whose epoch is below the current one is invalid regardless of any deny-list.

(The earlier draft put the current epoch in the pkarr registry. It cannot go there, for the reasons phase 2 gives: a returning node would take its idea of the current epoch from a record a revoked node can roll back, which inverts the guarantee this phase exists to provide.)

This inverts the burden: a node must present positive proof of current membership rather than merely failing to appear on a negative list. That is what makes the guarantee robust against a node that never re-fetches, is partitioned, or is fed stale data.

What "the current epoch" is, and why a cert cannot establish it

The obvious reading of "a cert below the current epoch is invalid" suggests its mirror — that a cert above the epoch you know about is proof you are behind. That reading has to be refused, and seeing why fixes the shape of the rest.

A delegation cert is minted locally by whoever holds the keyphrase; nothing rate-limits which epoch number they stamp on it. If a higher epoch on a cert advanced the receiver's idea of the current epoch, then anyone who could get a legitimate user to re-register while feeding them a bogus epoch — say, 2³¹ — would push the whole ensemble's epoch past every honestly-issued cert, locking out every node at once. The keyphrase-holder is the legitimate user; they have simply been lied to about a number.

So the epoch advances only on a signed record, on the same footing as a revocation:

EpochBump {
    version:        u8,
    ensemble_pubkey: [u8; 32],
    epoch:          u32,
    bumped_at_secs: i64,
    signature:      Signature,   // by the ensemble key, over the above
}

A node's current epoch is the highest one it has verified a bump for, and it never moves backwards. A cert claiming an epoch higher than any bump this node has seen is not evidence of anything — it is refused like any other cert it cannot place. EpochBump travels exactly as a RevocationRecord does: gossip for promptness, the doc-sync batch for durability, and the acknowledged delivery protocol when someone needs to know it landed.

The stamp is subject to the same treatment as a revocation's under p2p::wire_time and for the same reason: the number orders epochs, not the clock, so an unbelievable bumped_at_secs costs the record its date and not its effect.

When the epoch moves

Never automatically, and never as a side effect of an ordinary revocation.

Phase 2 covers the case the user is actually in most of the time: a device they still control, being decommissioned, whose own cooperation they have. The deny-list handles it, re-admission stays cheap, and nothing else on the ensemble moves. Bumping the epoch there would charge every other node a re-certification for a threat that is not present.

The epoch moves when the user says a device is out of their control — lost, stolen, sold with the disk intact, seized. That is a different claim from "I am done with this device", and it is the user's to make, because nothing the software can observe distinguishes them: a node that stops answering looks identical either way.

So the trigger is a deliberate act with its own question, and the natural place to ask it is the revoke flow, for a reason worth noticing: revoking a peer already requires the keyphrase, which is exactly and only what an epoch bump needs. The expensive prerequisite is already in the user's hands at that moment. The dialog therefore asks a second question after the first — is this device out of your control? — and only a yes bumps.

Two things that flow must say before it commits, because both are irreversible and neither is guessable:

  • How many nodes will need the keyphrase again. The bump locks out every node not re-certified, and the ones reachable right now are the ones that can be re-certified cheaply. "3 of your 5 nodes are reachable and will be re-certified now; the other 2 will each need this keyphrase entered on them" is the sentence. A user with the phone in their hand and the laptop in another country should learn that before pressing the button, not after.
  • That the keyphrase becomes load-bearing again. Phase 2's whole appeal is that decommissioning needs no keyphrase. A bump reverses that for every offline node, and a user who has lost the keyphrase and has a node offline has lost that node's membership permanently. Nothing recovers it — that is the trade being accepted.

A bump also does not need to reach everyone to take effect. It takes effect node by node, as each verifies the record: a node that has it fails closed against the stolen device, and one that does not yet have it is exactly as exposed as it was under phase 2 alone. Propagation is still best-effort; what changes is that once the record has landed, silence on the revoked node's part stops helping it.

Coming back after missing one

The case that needs designing is not the attacker — it is the phone that was in a drawer for a month. Its cert is at epoch N-1, the ensemble is at N, and it did nothing wrong.

What it must not get is the experience phase 1 already warns about: an endless string of refusals with no explanation. So:

  1. Every peer refuses it, and the refusal says why. The admission handshake is already mutual (phase 2), so both ends learn the other's verdict in one round trip. The refusal names the reason as stale epoch rather than a generic "not admitted", and — since the handshake already carries the server's cert — the returning node can see an epoch it has no bump record for. It does not advance its epoch on that; it takes it as a prompt to go and get one.
  2. It gets the bump record over a path that admits a stale node. This is phase 2's problem again, in the same shape: revocation delivery had to be servable to a revoked caller or it ate itself, and re-certification has to be servable to an epoch-stale caller for the same reason. And it is safe for the same reason — the protocol's only effect is to hand over ensemble state the caller verifies under the ensemble key it already holds. The most a genuinely-evicted node achieves on it is to learn, again, that it is evicted. It is not a way in: nothing it receives there admits it anywhere.
  3. It says so plainly, once, and stops dialling. The same treatment a node that finds its own credential revoked already gets on the roster today (this_node_is_revoked, copy::revocation::SELF_REVOKED_*) — a statement at the top of the screen rather than a stream of failures. The wording differs, and should: revoked is "this node was removed", stale-epoch is "this node's membership is out of date", and only the second has a way back that does not involve the user having intended it.
  4. The way back is the keyphrase, entered here. With a verified bump record in hand the node knows the epoch, and minting a cert at that epoch is purely local — DelegationCert::create with the keypair derived from the phrase. No cert has to be transported to it and no other node has to be reachable for the re-certification itself.

That last point matters for the open question this section used to defer to. Re-certification does not need a protocol for distributing certs; the fallback is always "enter the keyphrase on the node", which needs only the epoch. Pushing freshly-minted certs from the revoking node while it holds the key in memory is an optimisation on top — it saves the user from walking to each device — and it is worth building only after the fallback works, because the fallback is what covers every node that was offline, which is precisely the set the optimisation cannot reach.

What phase 2 already does for this

Phase 2's cert-hash deny-list makes re-admission cheap in the ordinary case — a node comes back by re-registering, and no epoch has to move. What it cannot do is bind a node that never hears the record, and that is the whole of what epochs buy: not a better deny-list, but positive proof of current membership, so that silence fails closed instead of open.

The two do not layer on the same case; they cover different ones, and it is worth being exact about which, because the tempting summary — "epochs are the strong version of the deny-list" — is wrong in a way that would justify bumping far too often.

A bump evicts by itself. Once the epoch moves, the stolen device is out on its old cert's epoch alone, and whether that cert is also on a deny-list changes nothing. What the deny-list goes on covering is every revocation between bumps — the routine decommissions, whose nodes hold perfectly current certs and are excluded by nothing else. That is the common case, and it is why phase 2 is not made redundant by phase 3.

Neither covers a stolen device that also took the keyphrase. Such a device can mint itself a fresh cert at the current epoch, which no deny-list names and no epoch check refuses. That is not a gap either mechanism can close — see "What revocation can never recover" — and it is the reason the keyphrase's own handling, not this section, is where that risk is actually managed.

3c. Vault key rotation

The revoked device holds the vault key. Until it changes, revocation protects nothing already on disk anywhere the device can still reach — and, more to the point, nothing it already copied.

VaultKeySpec::EnsembleDerived { label, version } already has a version field and derive_ensemble_vault_key already takes it, so the derivation side is designed for this. Two gaps:

  • default_vault() hard-codes version: 1 (vault/mod.rs:161) and it is the only vault.
  • The vault_keys table is keyed by vault_id alone, with no version column (stores/vault.rs:40-47), so nothing records which version a stored key was derived at. Rotation needs that, at minimum to decrypt correctly during a partial rotation.

The re-encryption itself is reseed.rs's reencrypt_blobs (ensemble/reseed.rs:257), which already decrypts under one key and re-encrypts under another, rewriting blob_refs.blob_hash via an old→new map. Rotation is that function pointed at the same store rather than a new one.

Per the instant-feedback invariant (command-palette-and-search.md §4.1), re-encrypting an entire blob store returns control immediately and becomes a tracked Job. It must also be resumable — this will run for a long time on a node with a large media library, and a rotation interrupted halfway must not leave undecryptable blobs.

3d. Relationship to reseed

ENSEMBLE_RESEED.md exists because none of the above did. Reseed is revocation by burning down the house: mint a new ensemble identity, re-encrypt everything under it, re-register every node you still trust, abandon the old key. Its Non-Goals §1 says outright that it revokes nothing.

Once phase 3 lands, the two overlap heavily — phase 3c is reseed's blob re-encryption without the new document store. The distinction that survives is what is being replaced: reseed replaces a compromised ensemble key; revocation removes a compromised node while the ensemble key stays good. Both should remain, and reseed stays the answer when the keyphrase itself leaks.

Reseed's own tracking lives under TODO.md's "Design a robust manifold key rotation scheme"; node revocation is tracked as its own entry alongside it.

What revocation can never recover

Stated plainly so no phase of this is mistaken for more than it is: a revoked device keeps everything it already synced. Revocation bounds future access, never past access. For a stolen device, any document it held is compromised at the moment of theft, and the only mitigations are the ones outside this document's scope — full-disk encryption on the device, and sync policy that limits what a phone holds in the first place (ADR 0010).


User Interface

The ensemble roster is already frontend-neutral: build_ensemble_status projects the store into an EnsembleStatus that the gpui app, Android FFI, and the daemon's JSON protocol (for CLI and TUI) all render (ensemble/screen.rs). Revocation state belongs there — an added field on EnsembleMemberInfo — so all four modalities show it without any of them computing it independently.

  • The roster gains a revoke action per member, and keeps revoked nodes off the list by default, with a count and a control that reveals them (ensemble::screen::roster, which is where the filtering and the counts are both decided so the four modalities cannot disagree).

    This reverses an earlier call — that a revoked row beats a node silently vanishing, since a node absent from a list is indistinguishable from one that is merely offline. That reasoning holds only for a node the viewer knows. In practice most of these rows are for nodes it has never met: a freshly registered node learns the deny-list over gossip and the retired node's stale address record from the pkarr registry (ADR 0044), and draws "(unnamed) · revoked" for a node it has no other trace of and will never reach. A revoked node also inflated "N total nodes", which is the number people actually read off this screen. The count of revoked nodes stays visible either way, so nothing has silently vanished — it is one control away.

    A one-shot CLI listing (syn ensemble members) is the exception: it still prints them, because a diagnostic dump has no "show them" control to put them behind. Its count excludes them like everywhere else.

  • Revoking someone else requires keyphrase entry by construction, which supplies the confirmation step a destructive operation needs; no separate "are you sure" modal is warranted on top of it.

  • Retiring the node you are sitting at is the self-signed case and needs no keyphrase, so it is a different control in a different place — at the foot of the Ensemble screen under "This node", not on a peer's row. It is on that screen rather than with the other system settings because it is an ensemble act: it signs a revocation and hands it to a peer, which is what a row's Revoke… does to someone else; only the signer differs.

    Reset — the same deletion with the telling left out — sits beside it in that section, in the same weight, rather than off in System settings. The choice between the two is the decision, RETIRE_VS_RESET is the sentence that draws it, and that sentence is only useful with both buttons under it: a user who found reset on another screen would never learn that retiring was the option they wanted. It does need its own confirmation, since nothing else supplies one, and that confirmation leads into a retirement screen that stays in front of the user until the wipe runs — carrying an emergency wipe now rather than a wait the user can only watch. It is deliberately not a Job, and on a one-node ensemble it collapses into a plain reset with no record at all; see "Retiring a node, and what the wipe waits for".

    Both are confirmed the same way on both frontends: a modal stating what is destroyed and, in its own paragraph, the half users get wrong — for retire, that the next screen cannot be canceled; for reset, that nobody else is told and a delegation cert never expires, so the other nodes go on admitting this one for ever.

    Built on all three: the desktop's is gui-app/src/teardown.rs, which replaces the whole window (no rail, no content pane, no palette) and ends by quitting — there is no screen worth returning to, and the next launch finds an empty store directory and offers onboarding. Android's is retirement/RetirementScreen.kt, reached by a navigation that clears the back stack and swallowing the system back button, and it ends at NodeReset.perform — the wipe half was already written there. The headless one is syn ensemble retire; see the Open Questions entry for why it is split across two processes.

  • CLI: syn ensemble revoke <node-id> for the first (prompts for the keyphrase, or takes --keyphrase), syn ensemble retire for the second (--now for the immediate path, --timeout to bound the wait), and syn ensemble import-revocation <blob> for repairing a retirement that was never delivered — alongside the existing syn ensemble members, which lists and marks revoked nodes (unlike the screens — see the roster bullet above) but leaves them out of its count.

    revoke and import-revocation are store-only, so they answer through the daemon when one is running and by opening the store directly when one is not; retire needs the daemon, because delivery needs its live endpoint. Both membership commands are refused over the loopback listener, same rule as pairing: a bearer token granted to read documents must not be able to destroy the store it reads from, or evict a device the holder is not sitting at.

  • A node discovering itself revoked should say so plainly and stop syncing, rather than presenting an endless string of connection failures.


Open Questions

  • Where the acknowledgment protocol lives Settled: its own ALPN, /syn/membership/… (p2p::revocation_delivery). The deny-list exemption is expressed as an associated const on EnsembleProtocol (REVOKED_PEERS: RevokedPeers), defaulting to Refuse — so a protocol added later is gated without its author having to know the exemption exists, and the one protocol that needs it says so in one line next to the reasoning.

  • A retirement screen on a headless node. Settled: the daemon delivers and the CLI wipes. Delivery needs the daemon's live endpoint; the wipe cannot run while the daemon holds the store open. So syn ensemble retire sends one blocking EnsembleRetire command — the daemon signs, gossips, and pushes until a peer commits or --timeout runs out — and then this process stops the daemon, confirms the socket is gone, and deletes. Which also puts the destructive half in front of the person who typed the command.

    The record is printed before anything else and whatever the outcome; --now skips the wait; and a wait that runs out asks whether to wipe anyway rather than deciding. Declining leaves the daemon serving nothing but revocation delivery until it restarts, which abandons the retirement — and the command says so, because nothing was written down.

  • Retention and garbage collection. Revocation records are append-only and never tombstoned, which is correct — a record that can be dropped is a record that can be dropped by an attacker's patience. It also means the set grows without bound over an ensemble's life. It is small (~140 bytes per retired node, and a user retires devices at human pace), so the working assumption is "never collect"; worth writing down rather than discovering.

  • Clock skew on revoked_at_secs. Settled, and it is where revocations part company with tombstones. A tombstone with an unbelievable stamp is refused outright, because the stamp is what decides whether it wins a merge. A revocation's does not — the check is by cert fingerprint — so an unbelievable stamp costs it its date, not its effect: p2p::wire_time bounds it, and a stamp that fails is replaced with the receiving node's own clock and the record applied anyway. Refusing it would let a peer with a broken clock keep a revoked node admitted, which is the one direction that must not fail.

  • Per-record signatures for provenance (3a). Settled: not worth building. The honest first question was whether anyone needs signed attribution before paying for it, and the answer is no. Nothing decides with origin_node, so a signature buys trustworthy display and nothing else.

    What it would cost: 64 bytes on each of eight wire record types; a signature column on the seven tables that persist one, because a signature has to survive relay or the forwarding node strips the very attestation it is passing on; an Ed25519 verification per row, which a twenty-episode feed sync makes about two hundred of; and the origin's delegation cert reachable at the receiver, which for a node it has never met means carrying the cert alongside. PurgeIntent and NodeAnnouncement are the precedent for sign-and-carry, but both are one signature per message, and neither has to be stored and re-sent by a third party.

    What it would buy: three read-only surfaces — the TUI's and the CLI's "Origin node" line, and the label on a desktop presence-grid row. Android shows authorship nowhere. The adversary it defends against holds a valid delegation cert, which is to say it is one of the user's own nodes, lying about which of their other nodes wrote something.

    Reopen it when attribution becomes load-bearing — a conflict UI naming the node whose edit you are choosing between, an audit trail, or any merge rule that reads the field. Until then origin_node stays what §3a made it, and the guard is structural: every derivation from it lives in node_status.

  • Re-certification transport (3b). Mostly settled in 3b: no cert needs transporting. A node that has a verified EpochBump knows the epoch, and minting a cert at it is local — the keyphrase entered on the node is the fallback, and it is the one that covers every node that was offline. Pushing freshly-minted certs from the revoking node while the key is in memory stays an optimisation to build afterwards, for reachable nodes only.

    What is genuinely still open is smaller: whether the re-certification channel is its own ALPN or a leg of /syn/membership/…, which already has the one property it needs — being served to a caller this node would otherwise refuse. Folding it in would mean one exemption to reason about instead of two; keeping it separate would keep each protocol's exemption narrow. Decide when 3b is built, not before.

  • Epoch exhaustion and the shape of epoch (3b). u32 is chosen without argument above. Bumps are human-paced and irreversible, so overflow is not a real risk, but it is worth deciding whether the epoch is a counter at all or should be the hash of the bump record — which would make "is this cert current" a comparison against a value that cannot be guessed ahead of time, at the cost of losing the ordering that makes "below the current epoch" meaningful. Probably a counter; worth one paragraph before it is in a signed payload and expensive to change.

  • Rotation resumability (3c). Whether a partially-rotated blob store is represented by a version column per blob, a per-vault "rotating from→to" state, or a shadow vault id, is undecided.

  • Should phase 1 land as its own ADR? It corrects an accepted ADR (0014) and changes every wire protocol version, which is ADR-shaped independent of the revocation feature.