[roads] Mark's decision: person and group grants leave classic devices out

Mark, 2026-11-25, "Leave classic out": a grant to a person or a group covers
only their post-quantum devices. A classic router is reached only through a
device: road of its own, which says classic: true. Before, a person grant
covered their classic devices and so needed classic: true itself, and one
classic device blocked every road of its owner (builder's self-review #5).
New test a_person_grant_never_covers_their_classic_device, which fails with
the old compiler. Docs and HANDOVER updated: 91 tests, debug and release.
This commit is contained in:
2026-11-25 10:58:57 +01:00
parent 18e0c50e08
commit 3b39ce137d
5 changed files with 65 additions and 14 deletions
+3 -2
View File
@@ -16,7 +16,7 @@ head named in the PR.
| Run | Result | | Run | Result |
|:--|:--| |:--|:--|
| `cargo test --workspace` | **90 passed, 0 failed, 0 ignored** (debug and `--release`) | | `cargo test --workspace` | **91 passed, 0 failed, 0 ignored** (debug and `--release`) |
| `cargo clippy --workspace --all-targets -- -D warnings` | clean | | `cargo clippy --workspace --all-targets -- -D warnings` | clean |
| `cargo fmt --all --check` | clean | | `cargo fmt --all --check` | clean |
| `cargo deny check` | advisories ok, bans ok, licenses ok, sources ok | | `cargo deny check` | advisories ok, bans ok, licenses ok, sources ok |
@@ -26,7 +26,7 @@ head named in the PR.
Per file: `proto/roundtrip` 6 · `roads` unit 16 · `attacks` 8 · `custom` 6 · `determinism` 4 · `explain` 6 · Per file: `proto/roundtrip` 6 · `roads` unit 16 · `attacks` 8 · `custom` 6 · `determinism` 4 · `explain` 6 ·
`least_privilege` 6 (P-1 5,000 cases: 1,706 with rules, 4,420 rules and 7,784 allowed IPs checked against the `least_privilege` 6 (P-1 5,000 cases: 1,706 with rules, 4,420 rules and 7,784 allowed IPs checked against the
oracle; P-6v6 1,000) · `qa_findings` 13 · `rename` 4 · `revocation` 9 · `validation` 5 (83 fixture files, 65 oracle; P-6v6 1,000) · `qa_findings` 13 · `rename` 4 · `revocation` 10 · `validation` 5 (83 fixture files, 65
rules) · `via-cli/cli` 7. rules) · `via-cli/cli` 7.
**What changed after QA** (details in `docs/02_via-core.md`, "QA review of PR #1"): **What changed after QA** (details in `docs/02_via-core.md`, "QA review of PR #1"):
@@ -45,6 +45,7 @@ rules) · `via-cli/cli` 7.
| F-10 | P-6v6: IPv6 compiles like IPv4, by embedding into `fd00::/96` | | F-10 | P-6v6: IPv6 compiles like IPv4, by embedding into `fd00::/96` |
| B-3 | `app:` roads need `on:` (person, group or device) and reach only those devices | | B-3 | `app:` roads need `on:` (person, group or device) and reach only those devices |
| R-55 | QA's renaming property was flaky (a group renamed to `in`); fixed in the test, seed pinned | | R-55 | QA's renaming property was flaky (a group renamed to `in`); fixed in the test, seed pinned |
| Mark | "Leave classic out" (2026-11-25): person and group grants cover only post-quantum devices; a classic device needs its own `device:` road with `classic: true`. Test `revocation.rs::a_person_grant_never_covers_their_classic_device`, mutation-checked |
The plan format gained `services` and `direct[].except`. Format 1 has not been released, so it changed in The plan format gained `services` and `direct[].except`. Format 1 has not been released, so it changed in
place; the golden plans and the pinned CBOR digest were regenerated and the diff read by hand. place; the golden plans and the pinned CBOR digest were regenerated and the diff read by hand.
+15 -9
View File
@@ -95,8 +95,10 @@ impl Extras {
} }
} }
/// The devices a subject covers: a person's are the devices they own; a group's, its members'; an app's, those /// The devices a subject covers: a person's are the post-quantum devices they own; a group's, its members';
/// of its `on` (QA B-3: never every device of the mesh). /// an app's, those of its `on` (QA B-3: never every device of the mesh). A classic (not post-quantum) device is
/// never covered by a person or a group: it is reached only by a `device:` road of its own, which says
/// `classic: true` (Mark, 2026-11-25: "Leave classic out").
pub fn subject_devices( pub fn subject_devices(
subject: &Subject, subject: &Subject,
on: Option<&Subject>, on: Option<&Subject>,
@@ -114,11 +116,14 @@ pub fn subject_devices(
devs.devices devs.devices
.values() .values()
.filter(|d| match subject { .filter(|d| match subject {
Subject::Person(p) => d.owner.as_ref() == Some(p), Subject::Person(p) => !d.classic && d.owner.as_ref() == Some(p),
Subject::Group(g) => dir Subject::Group(g) => {
.groups !d.classic
.get(g) && dir
.is_some_and(|g| d.owner.as_ref().is_some_and(|o| g.members.contains(o))), .groups
.get(g)
.is_some_and(|g| d.owner.as_ref().is_some_and(|o| g.members.contains(o)))
}
Subject::Device(k) => &d.key == k, Subject::Device(k) => &d.key == k,
Subject::App(_) => false, Subject::App(_) => false,
}) })
@@ -126,7 +131,8 @@ pub fn subject_devices(
.collect() .collect()
} }
/// Devices by owner, built once per compile so resolving a subject does not scan every device. /// Post-quantum devices by owner, built once per compile so resolving a subject does not scan every device.
/// Classic devices are left out: no person or group grant covers them.
struct Index { struct Index {
by_owner: BTreeMap<crate::ids::PersonId, BTreeSet<DeviceKey>>, by_owner: BTreeMap<crate::ids::PersonId, BTreeSet<DeviceKey>>,
} }
@@ -134,7 +140,7 @@ struct Index {
impl Index { impl Index {
fn new(devs: &Devices) -> Index { fn new(devs: &Devices) -> Index {
let mut by_owner: BTreeMap<_, BTreeSet<DeviceKey>> = BTreeMap::new(); let mut by_owner: BTreeMap<_, BTreeSet<DeviceKey>> = BTreeMap::new();
for d in devs.devices.values() { for d in devs.devices.values().filter(|d| !d.classic) {
if let Some(o) = &d.owner { if let Some(o) = &d.owner {
by_owner.entry(o.clone()).or_default().insert(d.key.clone()); by_owner.entry(o.clone()).or_default().insert(d.key.clone());
} }
+41
View File
@@ -200,3 +200,44 @@ fn a_person_deleted_from_the_directory_leaves_their_roads_reported_and_void() {
"the friend node kept petr-phone as a peer" "the friend node kept petr-phone as a peer"
); );
} }
/// Mark, 2026-11-25, "Leave classic out": a grant to a person or a group covers only their post-quantum
/// devices. A classic router that Mark owns is reached by none of Mark's or the household's roads, only by
/// its own `device:` road with `classic: true`, and that road keeps working.
#[test]
fn a_person_grant_never_covers_their_classic_device() {
let parts = Parts::home().edit_devices(|d| {
d.replace(
r#""name": "router", "address""#,
r#""name": "router", "owner": "mark", "address""#,
)
});
let c = parts.compile();
assert_eq!(c.errors().count(), 0, "{:?}", c.problems);
let router = &c.plans[&key(5)];
// h2x8vd (person:mark -> the home LAN) and k3f9q2 (group:household -> home-server) leave it out.
for p in &router.peers {
assert!(
p.roads.iter().all(|r| r.as_str() == "r8m2tg"),
"the router got a peer from a person or group road: {:?}",
p.roads
);
}
assert!(
!router
.peers
.iter()
.flat_map(|p| p.allowed_ips.iter())
.any(|n| n.to_string() == "192.168.100.0/24"),
"mark's LAN road reached his classic router"
);
// Its own classic road still gives it the home server on udp/53 and tcp/22.
assert!(fw_accepts(
&c,
&key(5),
"100.96.0.2".parse().unwrap(),
Some(("tcp", 22))
));
// And mark's post-quantum devices keep their access.
assert!(c.plans[&key(1)].peers.iter().any(|p| p.key == key(2)));
}
+5 -2
View File
@@ -57,8 +57,11 @@ change.
| `never-online-without` | person, group, device | exit | `until` | nothing: the kill switch | | `never-online-without` | person, group, device | exit | `until` | nothing: the kill switch |
| `custom` | device | — | `until`, `classic` | nothing the compiler checks: the raw block is carried, verbatim and labelled | | `custom` | device | — | `until`, `classic` | nothing the compiler checks: the raw block is carried, verbatim and labelled |
- A person's grant covers **every device whose owner is that person** in `devices.json`; a group's covers every - A person's grant covers **every post-quantum device whose owner is that person** in `devices.json`; a group's
member's devices. Removing a device from a person removes its access on the next compile. covers every member's post-quantum devices. Removing a device from a person removes its access on the next
compile. **Classic devices are left out** of person and group grants (Mark, 2026-11-25, "Leave classic
out"): a classic router is reached only by a `device:` road of its own, which says `classic: true`. So one
classic device no longer blocks its owner's roads (the builder's self-review #5).
- `classic` must be `true` on any road that would create a peer with a classic (not post-quantum) device. It is - `classic` must be `true` on any road that would create a peer with a classic (not post-quantum) device. It is
the road saying out loud that this path is not post-quantum. Without it the road grants nothing. the road saying out loud that this path is not post-quantum. Without it the road grants nothing.
- `until` is exclusive and compared with `now`, which is a parameter. Each plan carries `expires`, the earliest - `until` is exclusive and compared with `now`, which is a parameter. Each plan carries `expires`, the earliest
+1 -1
View File
@@ -75,7 +75,7 @@ never widens a road (QA F-09). `ports: []` is `ports.format`.
| Form | Meaning | Id rules | | Form | Meaning | Id rules |
|:--|:--|:--| |:--|:--|:--|
| `person:<id>` | a person in `directory.json` | opaque: 1–64 of `[A-Za-z0-9_-]` (no people directory exists in Fundamentum yet) | | `person:<id>` | a person in `directory.json`: their post-quantum devices (classic devices are never covered by a person or group, only by their own `device:` road) | opaque: 1–64 of `[A-Za-z0-9_-]` (no people directory exists in Fundamentum yet) |
| `group:<id>` | a group in `directory.json` | as a person id | | `group:<id>` | a group in `directory.json` | as a person id |
| `device:<key>` | a device in `devices.json` | the Tessera device subkey: 32-byte Ed25519 public key, base64url without padding, 43 characters, canonical | | `device:<key>` | a device in `devices.json` | the Tessera device subkey: 32-byte Ed25519 public key, base64url without padding, 43 characters, canonical |
| `app:<id>` | a Domi app, on the devices its road's `on` names (QA B-3) | the Tessera id: 1–32 of `[a-z0-9-]`, not starting or ending with `-` | | `app:<id>` | a Domi app, on the devices its road's `on` names (QA B-3) | the Tessera id: 1–32 of `[a-z0-9-]`, not starting or ending with `-` |