diff options
| author | tv <tv@krebsco.de> | 2026-11-15 21:38:04 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-15 21:38:04 +0000 |
| commit | d2f72861bacf22542ceb29297ccd97dc440a608e (patch) | |
| tree | 953fd0bd9d2f2394423fd7d864889ba0e4ab13db | |
| parent | 562be3ff576a3e83ce564161245c100a18fee8c9 (diff) | |
config: a strict swarm starts empty
`--genesis --remake` writes the content as a change of its own before
the one recording the first users and `--bootstrap-policy`. With a
strict policy, that content change was a time before the policy, on
which any member could build a change judged by none.
A strict `--bootstrap-policy` with `--remake` is now refused: a swarm
strict from its start starts empty, and one started from content turns
strict through a strict remake, which keeps only what an operator
looked over. A policy that isn't strict starts from content as before.
| -rw-r--r-- | docs/access.md | 7 | ||||
| -rw-r--r-- | src/config/mod.rs | 16 |
2 files changed, 16 insertions, 7 deletions
diff --git a/docs/access.md b/docs/access.md index 75f8db2..29b4cb6 100644 --- a/docs/access.md +++ b/docs/access.md @@ -54,9 +54,10 @@ may do nothing until added (the genesis node warns of those of its `--htpasswd`) log in by key and sign values from the start, and with `--bootstrap-policy '{"version": 1, "values": "signed"}'` the policy (Values signed by their users, below) in the same change: the swarm is strict from its start, and no -change of it is from before the policy. Started from content (`--genesis --remake`), -the content is a change of its own just before that one; a change built on it beside -that one is refused as from the time before a strict policy (below). +change of it is from before the policy. So it starts empty: content (`--genesis +--remake`) would be a change of its own before that one, and is refused with a strict +policy; a swarm started from content turns strict through a strict remake (Turning a +swarm strict, below). Without it, the swarm has no registry: its users are all alike (A swarm without a registry, below), until someone gives it one. `--protocol-writers` counts in both: without a registry, as who may write protocol data; with one, to set it right diff --git a/src/config/mod.rs b/src/config/mod.rs index 1686792..4100764 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -923,10 +923,18 @@ impl Settings { { bail!("{why}"); } - if let Err(why) = - crate::access::policy::first(self.bootstrap_policy.as_deref(), &self.bootstrap_keys) - { - bail!("{why}"); + match crate::access::policy::first(self.bootstrap_policy.as_deref(), &self.bootstrap_keys) { + Err(why) => bail!("{why}"), + // Its content would be a change of its own before the policy's: a swarm + // strict from its start has none, so it starts empty. + Ok(Some(policy)) + if self.remake.is_some() && crate::access::policy::read(&policy).strict() => + { + bail!( + "bootstrap-policy: a strict swarm starts empty, not from remake; one started from content turns strict through a strict remake" + ) + } + Ok(_) => {} } if let Some(root) = &self.genesis_root && crate::swarm::roots::parse(root).is_none() |
