aboutsummaryrefslogtreecommitdiffstats
path: root/src/federation/attacks.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-19 01:48:57 +0000
committertv <tv@krebsco.de>2026-11-19 03:18:34 +0100
commitf24063e90d02ef76d87401d6e74cf8c9f489ff7d (patch)
tree313fa30d2610a248f5132dfe1c2d3a37ce73f624 /src/federation/attacks.rs
parentc0bb757df50fe4aa025ba2e6ac021e179291c78b (diff)
fold: of a party's lists, those written under the latest version first
A key a version names, stolen, could write its party's node list at a history from before the version that named the party's keys anew: written under the version before, it counted, as naming keys anew leaves a list's `since` alone, and beside the list the party wrote under the new version the lower ID won. The thief signed a few, kept the lowest, and did so again after every list the party wrote. Of a party's key sets, and of its node lists, those written under the latest version now come first, then what no other has in its history, then the lowest ID; the model alike. A list the party writes under the version that replaced the key stays, as `federation.md` says. Key sets were safe already, by their `since`; one rule serves both. This changes what counts where two of a party's lists, written under different versions, are beside each other: nodes read them alike only once all run it. Row 69 is tested (`federation_attack_69`).
Diffstat (limited to 'src/federation/attacks.rs')
-rw-r--r--src/federation/attacks.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/federation/attacks.rs b/src/federation/attacks.rs
index 3f44ad0..2043c19 100644
--- a/src/federation/attacks.rs
+++ b/src/federation/attacks.rs
@@ -1300,6 +1300,33 @@ fn federation_attack_63() {
assert_eq!(pinned.state().current().hash, two.hash());
}
+/// A key a version names, stolen, writes its party's node list at histories from before
+/// the version that names the party's keys anew, beside the list the party writes under
+/// that version, several, so that one has a lower ID: the party's counts.
+#[test]
+fn federation_attack_69() {
+ let (tv, lass, makefu) = (tv(), lass(), makefu());
+ let tv_now = Party::new("tv", 4);
+ let mut fed = three();
+ let root = fed.root();
+ let on = fed.first.hash();
+ let mut renamed = fed.first.after(on);
+ renamed.parties[0].keys_since = 1;
+ renamed.parties[0].keys = vec![tv_now.key_line()];
+ let before = fed.take(lass.write(&[root], "home/lass/a", s("1")));
+ let (_, written) = fed.pass(&[root], &lass, &renamed, on, &[&lass, &makefu]);
+ fed.take(tv_now.nodes(&[written], &[harness::node_id(1)]));
+ for n in 2..6 {
+ // Taken: tv's old key is named at its history.
+ fed.take(tv.nodes(&[before], &[harness::node_id(n)]));
+ }
+ let state = fed.store.state();
+ assert_eq!(
+ state.nodes_of("tv", state.current()),
+ vec![harness::node_id(1)]
+ );
+}
+
#[test]
fn federation_attack_64() {
let (mut fed, head, gone, _, written) = moved();