[roads] QA B-3: an app road names whose devices it is for, and reaches only those

subject: app:<id> applied to every device in the mesh, so whoever could write
one road (app:steam goes-direct 0.0.0.0/0) changed the tunnel of other
people's devices, an exit and a classic router. An app road now needs the new
header key on: (a person, group or device), and reaches only those devices;
on: is forbidden on any other subject. The home fixture's steam road is on
Mark's devices, so it leaves Jana's, Petr's and the router's plans. Four
fixtures, a B-3 test (fails if app roads reach every device again), the
property generator scopes app roads to a person, and the R-55 renaming
rewrites on: like subject:.
This commit is contained in:
2026-11-25 09:04:50 +01:00
parent 69e3a9377d
commit b482e264d2
18 changed files with 179 additions and 84 deletions
+5 -4
View File
@@ -68,7 +68,8 @@ enum Subj {
Person(usize),
Group(usize),
Device(usize),
App,
/// An app on a person's devices (QA B-3).
App(usize),
}
#[derive(Clone, Debug, PartialEq)]
@@ -145,7 +146,7 @@ fn world(bytes: &[u8]) -> World {
// Indices one past the end name things that do not exist.
let subject = match (s.n(4), &verb) {
(_, Verb::Custom) => Subj::Device(s.n(n_dev + 1)),
(3, Verb::Direct) => Subj::App,
(3, Verb::Direct) => Subj::App(s.n(people + 1)),
(0, _) | (3, _) => Subj::Person(s.n(people + 1)),
(1, _) => Subj::Group(s.n(3)),
_ => Subj::Device(s.n(n_dev + 1)),
@@ -302,7 +303,7 @@ fn to_store(w: &World, roads: &[(usize, &R)], when: Instant) -> Store {
Subj::Person(p) => format!("subject: person:p{p}\n"),
Subj::Group(g) => format!("subject: group:g{g}\n"),
Subj::Device(d) => format!("subject: device:{}\n", dev_key(*d)),
Subj::App => "subject: app:games\n".into(),
Subj::App(p) => format!("subject: app:games\non: person:p{p}\n"),
};
t += match r.verb {
Verb::Reach => "verb: can-reach\n",
@@ -355,7 +356,7 @@ fn subj_devs(w: &World, s: &Subj) -> BTreeSet<usize> {
.get(*g)
.is_some_and(|m| w.devs[d].owner.is_some_and(|o| m.contains(&o))),
Subj::Device(x) => *x == d,
Subj::App => true,
Subj::App(p) => w.devs[d].owner == Some(*p),
})
.collect()
}