From af120b87c42ca56f69bbe6f8d27c023919742430 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 15 Nov 2026 16:43:53 +0000 Subject: swarm: a new swarm's policy recorded in its genesis change A swarm strict from its start had its policy written by its first user in a later change. A change is judged by the policy at its history, so any member could always add a change whose history is from before the policy: judged by none, needing no signature, taken whenever it comes. Since signed values are read by `seq`, an envelope planted there with the highest `seq` there is can never be followed: a ban, a user, a declaration, for good. `--bootstrap-policy JSON`, with `--genesis`, records the policy in the genesis change, with the first users: then no change of the swarm is from before it. It must be a policy this node knows, and a strict one needs `--bootstrap-keys`, or nobody could sign what decides who may do what. --- src/node.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/node.rs') diff --git a/src/node.rs b/src/node.rs index 0744206..e5c68e0 100644 --- a/src/node.rs +++ b/src/node.rs @@ -66,6 +66,9 @@ pub(crate) struct NodeConfig { /// (`access::registry::first_users`); empty elsewhere, and where none were named /// (the simulations: no registry). pub(crate) first_users: crate::access::registry::FirstUsers, + /// On a genesis node: the swarm's policy, which it records with its first users + /// (`access::policy::first`); none elsewhere. + pub(crate) first_policy: Option, /// To sign the tokens this node issues (`access::token`) and the changes it commits /// (`document::signatures`): every node's, its node ID being its public key; none in /// the simulations without the identity layer, whose node IDs are names. @@ -183,6 +186,7 @@ impl Node { blobs: Arc::new(swarm::blob::Blobs::new(config.blob_chunk_bytes)), protocol_writers: Arc::new(config.protocol_writers), first_users: Arc::new(config.first_users), + first_policy: config.first_policy, node_key: config.node_key, sign_every: config.sign_every, screening: Arc::new(std::sync::Mutex::new( -- cgit v1.3.1