aboutsummaryrefslogtreecommitdiffstats
path: root/src/config/mod.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-15 21:38:04 +0000
committertv <tv@krebsco.de>2026-11-15 21:38:04 +0000
commitd2f72861bacf22542ceb29297ccd97dc440a608e (patch)
tree953fd0bd9d2f2394423fd7d864889ba0e4ab13db /src/config/mod.rs
parent562be3ff576a3e83ce564161245c100a18fee8c9 (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.
Diffstat (limited to 'src/config/mod.rs')
-rw-r--r--src/config/mod.rs16
1 files changed, 12 insertions, 4 deletions
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()