docs: node revocation design; correct ADR 0014's authorization claim

Three-phase design for removing a node from an ensemble: admission control
on every ALPN, a signed revocation record, then epochs plus vault key
rotation for the lost/stolen case.

Documents the current state first, because it is worse than assumed: no
protocol handler checks ensemble membership, so any node holding only the
ensemble public key can read and write the document catalogue and drive
node-admin. Also records two amplifiers found while auditing --
wire-supplied origin_node, and LWW against an unbounded wire timestamp.

ADR 0014 claimed 'authorization is ensemble membership, which the iroh
connection already proves'. That was never implemented; amended in place
rather than left to mislead. Also marks ENSEMBLE_RESEED.md implemented --
it has been since reseed.rs landed -- and adds a TODO.md entry for
revocation.
This commit is contained in:
Greg Shuflin committed 2026-08-24 03:29:05 -07:00
1 parent 43c2109db1
commit 1eb6951f86
4 files changed
+412 -9

No files matched your search

+12 -2
View File
@@ -22,8 +22,18 @@
signatures (M-of-N across trusted nodes), timestamped revocation records published to the
DHT under the old key, and whether `iroh` provides useful primitives.
- See `docs/KEY_MANAGEMENT.md` for the current design; `docs/ENSEMBLE_RESEED.md` for a
narrower first step (clone a store into a brand-new ensemble, without solving revocation
or unlinkability — not yet implemented).
narrower first step, now implemented (clone a store into a brand-new ensemble, without
solving revocation or unlinkability).
#### Revoke a node from an ensemble
- **Description**: No mechanism exists for removing a single node from an ensemble while
the ensemble key stays good — needed both for decommissioning a device the user still
controls and, harder, for a lost or stolen one.
- **Blocked on / starts with**: there is no admission control at all today. No ALPN handler
checks ensemble membership, so revocation has nothing to bite on until the delegation-cert
check the gossip protocol already performs is applied to every protocol.
- See `docs/NODE_REVOCATION.md` for the phased design and the audit of what is
currently enforced.
- Consider ideas from FOKS, the Federated Open Key Service: https://foks.pub/#roadmap
## Media library
+13 -4
View File
@@ -2,10 +2,19 @@
## Status
Preliminary design. Not yet implemented. This is a first, deliberately narrow
step toward the "manifold key rotation" TODO item in `TODO.md` — see that
item and `docs/KEY_MANAGEMENT.md`'s "Deliberately Omitted: Key Rotation"
section for the fuller context this fits into.
**Implemented** — `rust/lib/src/ensemble/reseed.rs`, driven by `syn ensemble
reseed <new-path>`. The design below describes what was built; where the two
diverge, the code is authoritative.
This is a first, deliberately narrow step toward the "manifold key rotation"
TODO item in `TODO.md` — see that item and `docs/KEY_MANAGEMENT.md`'s
"Deliberately Omitted: Key Rotation" section for the fuller context this fits
into.
Reseed does not revoke anything, by design (see Non-Goals). Removing a single
node from an ensemble while the ensemble key stays good is a separate feature
specified in `docs/NODE_REVOCATION.md`; the two overlap only in blob
re-encryption, which that document proposes to reuse from here.
## Overview
+361
View File
@@ -0,0 +1,361 @@
# Node Revocation Design
## Status
Preliminary design. Not implemented. Named to sit with its siblings
`KEY_MANAGEMENT.md`, `BOOTSTRAPPING.md` and `ENSEMBLE_RESEED.md`, which are
the three documents it depends on most.
## 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.
No part of that exists today. This document specifies it in three phases,
because the first phase is a prerequisite that is 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.
**There is no admission control on any data-plane protocol.** The endpoint
advertises six ALPNs (`p2p/mod.rs:196-203`) and the router accepts all of
them plus `iroh_gossip::ALPN`. Every `ProtocolHandler::accept` implementation
— `doc_sync`, `artifact_sync`, `blob_sync`, `blob_stream`, `node_admin`,
`ping` — reads `conn.remote_id()`, logs it, and serves. None consults the
pkarr registry, the `peer_nodes` table, or a delegation cert.
Consequently any node that can dial one of ours can:
| ALPN | Capability granted to an arbitrary caller |
|---|---|
| `/syn/doc-sync/…` | Read the whole document catalogue — 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 `promote_session` (`doc_sync.rs:600-659`) |
| `/syn/artifact-sync/…` | `serve_push` applies arbitrary artifact values through `upsert_artifact` |
| `/syn/blob-sync/2` | Fetch any blob's ciphertext; push arbitrary blobs onto our disk |
| `/syn/node-admin/1` | `SetSyncPolicy`, `SetDocOverride`, `TriggerSync`, `ListJobs`, `CancelJob` |
| `/syn/blob-stream/2` | Byte-range reads of any blob's ciphertext |
ADR 0014 states "Authorization is ensemble membership, which the iroh
connection already proves." That is not true as written and should be
corrected when this work lands. The QUIC connection proves the caller holds
*some* node secret; nothing asks whether that key is ours.
### What *is* enforced
Stated precisely, because it is the foundation the design reuses:
- **Gossip announcements and purge intents are properly authenticated.**
`verify_cert` (`gossip.rs:494`) 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: `ensemble 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.rs:62`), 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 — `NodePubkey(rec.origin_node)` at `doc_sync.rs:1466`, and
likewise at 1491, 1513, 788, 1703 — never from the authenticated sender.
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` (`stores/document.rs:858`,
`972`) compares against a timestamp the sender chose, with no clock bound.
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
**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 (`/syn/doc-sync/…`, `/syn/blob-sync/3`,
and so on). 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.
### 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
**Goal**: surviving nodes durably refuse a named node.
Removal from the pkarr registry is necessary but *not sufficient on its own*,
and this is the central point: absence from a record is invisible to anyone
who does not re-fetch it, and any cached copy of the old packet still
verifies. Revocation must therefore be asserted positively, not by omission.
**Mechanism**:
- A **signed revocation record**: the ensemble key signs `version ||
revoked_node_pubkey || revoked_at_secs`. Because it is signed by the
ensemble key, any node can relay it and any node can verify it
independently — a revoked node cannot suppress a relay path it does not
control.
- Published two ways, deliberately redundantly: as an entry in the pkarr
registry (so a node returning from a long absence learns of it), and as a
new `GossipMessage` variant (so live nodes learn immediately). Gossip
already carries signed, ensemble-verified messages — `PurgeIntent` is the
template.
- Stored locally in a `revoked_nodes` table, consulted by phase 1's
admission check as a deny-list alongside the cert verification.
- The node's entry is removed from the registry at the same time, so it stops
being advertised for discovery. `publish_membership` already does
CAS-preserving registry rewrites (`ensemble/mod.rs:289`), so this is a
small change to existing code.
**Authorization**: minting the record requires the ensemble private key,
which per `KEY_MANAGEMENT.md` exists only in memory during `init`/`register`.
So revocation is a keyphrase-entry operation — a compromised node cannot
revoke its siblings. This is a property worth keeping, not a friction to
design away.
**Interaction with the pkarr packet limit**: the registry is capped at 1000
bytes and `publish_membership` already evicts the oldest member entry to stay
under it (`ensemble/mod.rs:338-345`). Revocation entries compete for the same
budget, and unlike member entries they cannot simply be dropped — an evicted
revocation record silently un-revokes a node for anyone who learns membership
from the registry alone. Open question, below.
**After this phase, decommissioning works**: the retired node is removed,
every surviving node refuses it at connect time, and the refusal survives
restarts and propagates to nodes that were offline.
---
## 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.
Four pieces, roughly in dependency order:
### 3a. Fix the two amplifiers
`origin_node` on synced rows must be derived from the authenticated sender
rather than trusted from the wire (or each record must carry a per-record
signature under its claimed origin, which is more faithful to multi-hop
relay but much heavier — see Open Questions). Incoming `modified_at` values
must be clamped or rejected when implausibly far ahead of local time, so a
hostile write cannot win merges permanently.
These are prerequisites: without them, a device that was hostile for even one
sync pass before revocation leaves damage that revocation does not undo.
### 3b. Membership epochs
Add an `epoch: u32` to `DelegationCert`, inside the signed payload
(`ensemble/mod.rs:406`). The registry carries the ensemble's current epoch. A
cert whose epoch is below the current one is invalid regardless of any
deny-list.
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.
The cost is real and should not be glossed: bumping the epoch means
re-issuing certs to every surviving node, which requires the keyphrase and
requires reaching each node. Nodes that are offline at revocation time are
locked out until they are re-certified. That is the correct trade for a
stolen device and the wrong one for a routine decommission — which is why
phase 2 exists separately and phase 3 is opt-in for the case that warrants
it.
### 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 renders revoked nodes
distinctly rather than hiding them (a node that vanishes from a list is
indistinguishable from one that is merely offline).
- The action 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.
- CLI: `syn ensemble revoke <node-id>`, alongside the existing `syn ensemble
members`.
- A node discovering *itself* revoked should say so plainly and stop syncing,
rather than presenting an endless string of connection failures.
---
## Open Questions
- **pkarr packet budget.** Revocation entries and member entries share 1000
bytes, and revocation entries must not be evicted. Options: a separate
pkarr record under a derived key (a second DHT lookup, but its own budget);
storing only a current-epoch integer in the registry and relying on epochs
rather than a per-node list (elegant, but ties phase 2 to phase 3b);
or a compact accumulator. Not resolved.
- **Per-record signatures vs. authenticated-sender provenance** (3a). Taking
`origin_node` from the authenticated sender is simple and correct for
direct sync, but wrong for relayed records — node A's edit arriving via
node B would be attributed to B. Per-record signatures are faithful but add
64 bytes and a verification per property. The existing `PurgeIntent` uses
per-message signing; whether that generalizes to per-row is unexplored.
- **Re-certification transport** (3b). Re-issuing epoch-bumped certs to
surviving nodes needs a protocol. Doing it over gossip is easy but means
the ensemble key must be in memory on the revoking node while it reaches
each peer, and offline peers still need a path — likely keyphrase entry on
each node, which is a lot of friction and should be prototyped before being
committed to.
- **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.
+26 -3
View File
@@ -1,6 +1,7 @@
# 0014: Remote node administration via `/syn/node-admin/1`, never triggers eviction
**Status**: Accepted
**Status**: Accepted — but the authorization claim below was never true; see
the amendment at the end
**Date**: 2026-07-22
## Context
@@ -28,8 +29,9 @@ AdminRequest =
Every mutation's response carries the full new `SyncConfig`, so the
initiating UI renders truth rather than an optimistic guess. Authorization
is ensemble membership, which the iroh connection already proves — no
hierarchy among moons, consistent with the trust model everywhere else.
is ensemble membership — no hierarchy among moons, consistent with the trust
model everywhere else. **The claim in the original text that "the iroh
connection already proves" this was wrong; see the amendment below.**
**Safety rule, decided at the same time as the protocol, not bolted on
after**: `SetSyncPolicy`/`SetDocOverride` never trigger eviction remotely.
@@ -68,3 +70,24 @@ since `node_admin` deliberately cannot act on it.
gap that was simply not gotten to.
- `TriggerSync`/`ListJobs`/`CancelJob` are dead code from a UI perspective
until something calls them — tracked as open work, not a bug.
## Amendment (2026-08-24): the authorization claim was never implemented
"Authorization is ensemble membership, which the iroh connection already
proves" is false, and was false when written. The QUIC connection proves the
caller holds *some* node secret — that is what `conn.remote_id()` returns —
but nothing ever checked that the key is a member of this ensemble.
`NodeAdminHandler::serve` reads `remote_id()`, logs it, and serves the
request. So did every other protocol handler.
The practical consequence for this ADR specifically: any node that could dial
ours could issue `SetSyncPolicy` and `SetDocOverride` against it. The safety
rule this ADR is named for — that the protocol cannot destroy data remotely —
held, and still holds; the gap was that the caller was never authenticated as
a member in the first place.
This is being fixed by requiring a `DelegationCert` handshake on every ALPN,
which is where the membership proof actually comes from. See
`docs/NODE_REVOCATION.md` for the audit that found this and the design of the
fix. Once that lands, the sentence above becomes true — of the handshake, not
of the connection.