17 Commits

Author SHA1 Message Date
mnovak 3b39ce137d [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.
2026-11-25 10:58:57 +01:00
mnovak 73426592e4 [roads] QA F-10: IPv6 is checked by embedding the property's worlds into fd00::/96
The least-privilege oracle works in u32, so P-1 never saw an IPv6 address.
P-6v6 (1,000 cases) writes the same generated world with every IPv4 address a
as fd00::a and every /L as /(L+96) (the default route as ::/0), compiles both,
and requires the IPv6 plans to equal the IPv4 plans mapped the same way, with
the same problems. So every IPv6 path behaves like the IPv4 one P-1 checks
against the oracle. Mutation-checked: IPv6 hosts as /127 fails it at once.
2026-11-25 09:07:24 +01:00
mnovak b482e264d2 [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:.
2026-11-25 09:04:50 +01:00
mnovak 69e3a9377d [roads] QA F-01: a service road grants only that service
A firewall sees an address and a port, never a hostname, so a road to
photos.home.arpa compiled to home-server:443 and also opened git.home.arpa
there. Rules are now per service:

- devices.json services may carry their own mesh address (same rules as a
  device address, unique among all of them). A road to such a service compiles
  to that address only; the hosting device's plan lists it in the new field
  services[] so it answers on it, and DNS points there.
- A road to a service that shares its address and a port with another service
  is refused (service.shared), naming the others, instead of opening both.
  Narrowing ports: to a port nobody else serves on that address is allowed.
- A device: road reaches the whole device: its own address and its services'
  own addresses.

No Ianitor identity check is needed for this. The home fixture gives photos
its own address (100.96.1.2); tests that encoded the old host:port model are
updated, three new snapshot fixtures cover the address rules, and the golden
plans and pinned digest are regenerated. Mutation-checked: dropping the
refusal, or ignoring the service address, each fails an F-01 test.
2026-11-25 09:01:18 +01:00
mnovak 80f73a0154 [roads] QA F-02: going direct never takes what the tunnel carries out of it
A goes-direct subnet was only checked to be canonical, and the kill switch
dropped it only when it reached the internet, so 100.96.0.0/16 (every mesh
address) or the home LAN that the plan routes into the tunnel compiled cleanly.

Now, decided here because the plan has to say which route wins:
- a goes-direct subnet other than /0 that holds a mesh address is refused
  (direct.mesh);
- per device, a direct subnet inside a net the plan tunnels is dropped and
  reported (direct.tunnelled);
- a direct subnet that holds tunnelled nets keeps them in the tunnel, listed
  in the new plan field direct[].except. A platform that cannot honour except
  (an app-level bypass) must not apply the entry.

The F-02 test now checks that every overlap is covered by except, and that
only the mesh subnet is refused. Golden plans and the pinned jana-phone digest
are regenerated: the only change is the except lists. Plan format 1 has not
been released, so it changes in place.
2026-11-25 08:54:51 +01:00
mnovak ecafe194a5 [roads] QA F-05 and F-06: classic custom blocks, and roads across address families
F-05: plan.custom took classic from the road only, so a raw block on a classic
device without classic: true was labelled post-quantum. The device's flag now
counts too, as it already did for peers.

F-06: a device has one mesh address, so a can-reach road from IPv4 devices to
an IPv6 place compiled to rules that could never match, silently. Those
devices now get nothing for that road, and the road is reported inactive
(road.family) naming them.
2026-11-25 08:52:01 +01:00
mnovak ff78361165 [roads] QA F-08: a mesh address is never an internet address
devices.address refused only special and IPv4-embedding ranges, so a public
address was accepted, and an exit's forward-to-internet rule then covered that
device's mesh address. Mesh addresses now stay inside the not-internet ranges
(100.64.0.0/10, RFC 1918, ULA). Two fixtures, IPv4 and IPv6.
2026-11-25 08:50:23 +01:00
mnovak 31a46d0367 [roads] rename.rs: a new id never spells a word the output already holds
The R-55 property mapped renamed strings back anywhere in the output, so a
group renamed to `in` turned every firewall "direction": "in" into the
group's old name and failed about once in four runs (seed
8124609985917702487). The renaming now reserves every string the plans and
problems hold; the seed is kept as a fixed test, which fails without the
reservation. No change to the compiler.
2026-11-25 08:50:23 +01:00
mnovak 3bd87ebccf [roads] QA F-03: a kill-switch road with an error fails closed, through no exit
Any check() error used to make a road grant nothing, and for
never-online-without nothing meant no kill switch: an exit that stopped being
one (or left devices.json) silently turned off every kill switch through it.
The road is still reported as an error, but its subject's kill switch stays
on through no exit (only the mesh), and going direct to the internet is still
dropped. An expired kill switch ends as written. The road_file fuzz target's
deny-by-default check now allows exactly that narrowing and nothing else.
2026-11-25 08:46:30 +01:00
mnovak acb98a6a1c [roads] QA F-04: a dangling owner or group member drops only itself, not every plan
Deleting a person from directory.json without editing devices.json left a
dangling owner, a snapshot error, and so no plans for anybody. A well-formed
owner or member id that is not a person is now reported on its own codes
(devices.owner-unknown, directory.member-unknown) and removed: the device is
ownerless, the member leaves the group. Malformed ids, duplicates and bad JSON
still stop every plan. Two new structural fixtures keep devices.owner and
directory.member covered.
2026-11-25 08:44:09 +01:00
mnovak b6cf29b9a0 [roads] QA F-07: a missing roads/ folder is store.roads, and roads/ is never followed through a link
A store folder without roads/ compiled to plans with no access and no problem,
kill switches included. It is now an error naming roads. A roads/ that is a
file or a symbolic link is refused the same way (the builder's self-review #8):
entries inside were already refused, the folder itself was followed.
2026-11-25 08:41:10 +01:00
mnovak 93ab087648 [roads] QA F-09: a present but empty until: or ports: is key.empty, never absent
Clearing a narrowing field (until:, until: # comment, ports:) used to read as
absent, which is the widest value: a permanent grant or all traffic. It is now
an error, so the road grants nothing. Three fixtures, FORMATS.md updated, and
the F-09 test is no longer ignored.
2026-11-25 08:40:01 +01:00
mnovak 635d3802c1 [roads] QA F-09: an emptied until: or ports: silently widens a road (failing test, ignored)
until: with no value (or only a comment) reads as absent, so a temporary grant
becomes permanent; ports: with no value reads as all traffic. No problem is
reported. Verified to fail on this code.
2026-11-25 08:17:26 +01:00
mnovak 7087b06e24 [roads] rustfmt the QA tests and the fuzz targets (no change in behaviour) 2026-11-25 08:16:24 +01:00
mnovak 828962a9e9 [roads] QA review of PR #1: one failing test per open finding, ignored until fixed
Eight tests, each #[ignore]d with its finding id (F-01 to F-08 in
Via/qa/review-via-core-pr1.md), each verified to FAIL on this code for the reason
it names (cargo test -p roads --test qa_findings -- --ignored: 0 passed, 8 failed):

F-01 a service road opens every service on the same host and port (explain admits it)
F-02 goes-direct may name mesh addresses or tunnelled subnets, kill switch or not
F-03 a kill switch whose exit stops being one fails open
F-04 deleting a person from directory.json leaves no plan for anybody
F-05 a custom block on a classic device is labelled classic: false
F-06 a road across address families compiles into a rule that never matches
F-07 a missing roads/ folder is not reported
F-08 a public address is accepted as a mesh address
2026-11-25 08:15:53 +01:00
mnovak d02bbff41c [roads] QA R-55: renaming every id gives an isomorphic plan, problems and explain
A proptest (300 seeds) renames every road id, person id, group id, device key,
device name and service hostname of the home store plus five roads that hit the
order-sensitive paths (an exit conflict each way round, two kill switches through
different exits, two path hints to one peer), compiles both, maps the output back
and compares plans, problems and explain.

Mutation-checked and reverted: 'first exit by key wins' on an exit conflict, and
'smallest road id wins' on disagreeing kill switches, each fail the property.
2026-11-25 08:07:15 +01:00
mnovak 38a2fea043 [roads] The road model, validator, compiler and explain; proto's versioned CBOR messages; the via command
Road files in Pensum's strict header subset (unknown keys are errors, random ids), the
directory and device snapshots, deny-by-default compilation to one plan per device,
explain from the compiler's own grants, CBOR envelope v1 with version-first refusals.

Tests: the six mandatory ones (validation fixtures for every rule, revocation, the
least-privilege property against an independent oracle, determinism with golden plans,
explain, custom round-trip), QA's attack cases, the protocol and the CLI.
2026-11-25 07:55:38 +01:00