Day 2: roads, the compiler, explain, CBOR control messages, the via command #1
Reference in New Issue
Block a user
Delete Branch "feature/roads"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
After QA (owner session, 2026-11-25)
QA's review (comments 49910–49925,
Via/qa/review-via-core-pr1.md) found one blocker and five majors in the model. All are fixed on this branch, one commit each, each removing the#[ignore]of its test incrates/roads/tests/qa_findings.rsin the same commit. Details:docs/02_via-core.md, "QA review of PR #1, and what changed"; state and counts:HANDOVER.md.Build described: branch head, Windows 10,
cargo 1.99.0stable MSVC, debug profile.cargo test --workspace-D warnings,fmt --checkcargo deny check/cargo auditroad_file7342659, Windows MSVC, SanitizerCoverage, no sanitizerenvelopeservice.shared); adevice:road reaches all of the device's addresses; plans list the device's service addresses69e3a93direct.mesh(a non-default direct subnet holding a mesh address),direct.tunnelled(inside a tunnelled net: dropped),direct[].except(tunnelled nets inside: stay in the tunnel)80f73a03bd87ebacb98a6until:/ports:present but empty iskey.empty93ab087app:roads needon:and reach only those devicesb482e26road.familyecafe19store.roads(also:roads/never followed through a link)b6cf29bff78361fd00::/967342659in); fixed in the test, seed pinned31a46d0Every fix was mutation-checked: reintroducing the bug fails its test.
Critical self-review of the fixes
devices.json. Per-service rules need something the firewall can see; a hostname is not. The alternative, relying on Ianitor's per-host identity gate, was not needed. Day 3 must give the hosting device each service address on its tunnel interface, and Ianitor must listen on it. Until a service has its own address, a road to it is refused whenever it shares a port, so today's "everything behind Ianitor on 443" needs one address per service.except. Every platform must keep theexceptnets in the tunnel. An app-level bypass (Android's disallowed apps) cannot do that, so such a platform must not apply that entry. Day 5 and Day 6 tests must check it.services,direct[].except) while stillformat: 1. Nothing has consumed it; it would need a version bump after v0.1.0.Still open (recorded in
docs/02_via-core.md, Gaps)not_after).explain/checkas admin: blocks the Day 5 web view.Original description (builder, before QA)
Day 2 of Via Domi: the road model, its validator, the compiler from roads to one plan per device,
explain, the versioned CBOR control messages, and theviacommand. Design:docs/02_via-core.md; formats field by field:docs/FORMATS.md.Do not merge yet: QA reviews first, then the orchestrator merges and tags v0.1.0.
What is in it
roadsroads/<id>-<slug>.md, Pensum's strict header subset, unknown keys are errors, 6-character random Crockford ids),directory.jsonanddevices.jsonsnapshots (serdedeny_unknown_fields, noflatten), 57 rule codes, deny-by-default compiler,explainread from the compiler's own grantsprotoplan-request,plan(with a SHA-256 digest of the plan's CBOR),plan-ack,refused; the version is read before the body; unknown fields, trailing bytes, >1 MiB, nesting >32 and a wrong digest are refusedvia-clivia check,via compile --device <name|key> [--format json|cbor],via explain <device> <place>; exit 0 / 1 (problems or denied) / 2 (usage)#![forbid(unsafe_code)]in every crate andunsafe_code = "forbid"in the workspace lints.Id formats used (read from the owning code)
Fabrica/core/crates/pensum/src/id.rs:5-12,problem.rs:3-34,ticket.rs:11-12, 372-375,core/docs/FORMATS.md:14-42, 85-97, 161-165.Fundamentum/docs/TESSERA.md:29, 53-55.Fundamentum/crates/tessera/src/id.rs:5-20.hosts/<hostname>.toml:Ianitor/crates/core/src/routes.rs:5-16, 41-42; rulesvalidate.rs:693-730.Liber/Liber/docs/05_together.md:13), so an opaque newtype, 1-64 of[A-Za-z0-9_-].Tests
72 tests, all passing (
cargo test --workspace, Windows, debug):roadsunit tests (header, ids, net, ports, road, id)roads/tests/validation.rs(66 fixture files + 6 generated cases; all 57 rules covered, meta-test fails on a rule without a fixture)roads/tests/revocation.rsroads/tests/least_privilege.rs(proptest: P-1 5,000 cases; invalid/expired 500; P-3/P-4 500 = 6,000 cases)roads/tests/determinism.rs(twice, shuffled, CRLF, 7 golden plans)roads/tests/explain.rsroads/tests/custom.rsroads/tests/attacks.rs(QA cases)proto/tests/roundtrip.rsvia-cli/tests/cli.rs(separate processes, byte-identical)Of the 5,000 P-1 cases in the measured run, 1,688 had at least one firewall rule, and 4,322 rules and 7,560 allowed IPs were checked against the oracle (the counter prints with
--nocapture). The other two thirds are worlds where every road is refused or inactive, which the property also covers.Regression-verified by reintroducing the bug (each made the property fail, then reverted):
untilmade inclusive (<instead of<=) → P-1 and the invalid/expired property fail, and revocation fails.The validation fixtures were not each mutation-checked; each asserts its own rule code, file and field, and asserts that every plan stays byte-identical to the baseline.
cargo deny check: advisories ok, bans ok, licenses ok, sources ok (warnings: unused allowed licences, twosynversions).cargo audit: 80 crates scanned, 0 vulnerabilities, 0 warnings.chronowas flagged unmaintained (RUSTSEC-2026-0543), so dates moved tojiff.cargo clippy --workspace --all-targets: clean.QA's attack plan
Via/qa/02_roads_attacks.mdis answered case by case indocs/02_via-core.md, "What QA's attack plan changed". The five it ranked first: R-10 (property +attacks.rs), R-35 (no serde on road headers;untillandUntilfixtures; a guard againstserde(flatten), R-26 (Plan.expireson both sides), R-42 (names refuse line breaks, U+0085, U+2028/9, zero-width and bidi characters), R-02 (no aggregation; the oracle requires exact equality). Also added from it: wg-quick hooks refused in raw blocks (R-41), public, special and IPv4-embedding ranges refused as routes (R-05/07/08), the kill switch winning over going direct to the internet (R-47).Critical self-review
devices.json; one that keeps the old plan keeps revoked access. This needs a decision, probably "keep the old plan, but never past itsexpires".app:subjects reach every device in the mesh.app:steam goes-direct 0.0.0.0/0applies to everyone's devices, including other people's. It only ever narrows protection (traffic leaves the tunnel), but it is wider than a reader of the sentence would guess. It should probably beappat a device or person.classic.unacknowledgedfails the whole road. One classic device owned by a person blocks that person's road for all their devices untilclassic: trueis added. It is safe, but surprising.explainuses overlap. A tcp/443-only road "explains"device:<x>as a whole; the CLI prints the ports, but a UI must too.roads/folder compiles to empty plans without a problem. With--storepointing at a folder that holds only the snapshots, every access disappears silently.roads/itself is followed if it is a symbolic link (entries inside are refused, the folder is not).exits-throughroad to leaves it offline. That is the literal meaning, but nothing warns about it.Not verified
#[cfg(unix)]symbolic-link case of QA R-32 has never run, and the golden files were produced and checked on Windows only (R-54 asks for both).Open questions (also in the doc)
Kill switch on an invalid road; how the people directory will key people; where a service's device comes from (Ianitor names hosts, not Tessera keys); whether
classic: trueis the right acknowledgement;Address/DNSin raw blocks; global IPv6 routes; a BOM in a road file (refused today, QA would read it).QA review of this PR, at head
b9c0e764. I read the docs, FORMATS.md and every source file.The core claims hold: R-10 (spoofing a source), R-35 (a misspelt key), R-26 (plan expiry), R-02 (no aggregation) and determinism. The problems this review finds are in the model, not coding slips. The blocker is F-01: a service road grants the whole host:port. Each finding below is its own comment.
Pushed to
feature/roads(no merge):d02bbff: R-55, renaming every id gives an isomorphic plan. A 300-seed property; two reintroduced order bugs each made it fail.828962a,635d380:tests/qa_findings.rs, one test per finding (F-01 to F-09). Each is#[ignore]d with its finding id and fails on this code. Remove the#[ignore]in the commit that fixes the finding.d5917e7:fuzz/, theroad_fileandenvelopetargets.7087b06: rustfmt only.Tests: 72 passing before. After: 75 passing, 9 ignored (all 9 fail with
--ignored), 0 failing. Clippy and fmt are clean.Fuzz (Windows, no sanitizer):
road_file: 721 s, 1,116,471 executions, 0 crashes. It checks: the parser never panics, the render round trip holds, compile never panics, and a refused road changes no plan.envelope: 331 s, 20,086,677 executions, 0 crashes.Not verified: nothing ran on Linux (WSL would not start), and the fuzzing had no sanitizer.
Durable copy:
Via/qa/review-via-core-pr1.md.QA F-01, blocker. a service road opens every service on the same host and port (blocker)
What.
Place::Service(h)compiles toNet::host(device.address)with the service's ports(
compile.rs:355-364). The firewall seesjana → 100.96.0.2 tcp/443. In the home fixture,photos.home.arpaand
git.home.arpaare both served on tcp/443 by home-server. So the road "Jana can reach Photos" alsolets her reach Git, by setting the SNI or Host header to
git.home.arpa.Evidence.
k3f9q2(the household road).explain(jana-phone, service:git.home.arpa)returns[7tq0mz]. That is the photos road. The test isf01_a_service_road_grants_only_that_service.(
least_privilege.rs,may_reach,Obj::Service). The oracle shares the compiler's model, so the propertycannot see this.
Why it matters. It is exactly Mark's risk: a road reads as one place, but a whole host:port is granted.
Day 4's sentence view will say "Jana can reach Photos".
Fix, pick one.
service.shared-port) a service road whose ports overlap another service on the same device,naming the other services.
that Ianitor's per-host identity gate stops the cross-service request.
Either way, the oracle must model services by hostname.
Durable copy:
Via/qa/review-via-core-pr1.md.QA F-02, major. goes-direct can take mesh addresses and tunnelled subnets out of the tunnel (major)
What. A
goes-directobject is only checked to be a canonical subnet. The kill switch removes it only whenit
reaches_internet()(compile.rs:513-547), and100.64.0.0/10,10/8,172.16/12and192.168/16are all "not internet". So the following compile cleanly, with the kill switch on:
device:mark-pc goes-direct subnet:100.96.0.0/16, which covers every mesh address;goes-direct 192.168.100.0/24, which mark-pc also reaches through the tunnel by roadh2x8vd.Evidence.
f02_going_direct_never_overlaps_what_the_tunnel_carries:goes-direct 100.96.0.0/16 overlaps 100.96.0.2/32, which the plan sends through the tunnel.Why it matters.
that may use the same private range. That is the TunnelVision / LocalNet class.
Fix. Refuse (or, with a kill switch, drop) any direct subnet that overlaps a mesh address or any
non-default allowed IP in the same plan. Report it like
direct.kill-switch.Durable copy:
Via/qa/review-via-core-pr1.md.QA F-03, major. an invalid kill-switch road fails open (major; the builder's own #4, made concrete)
What. Any
check()error makes a road grant nothing (compile.rs:318-321), and fornever-online-without"nothing" means no kill switch. The realistic trigger is not a typo. It is the exitdevice dropping
exit: true, or leavingdevices.json. Thenobject.not-exitorobject.unknownturns offevery kill switch through that exit, while the rest of the store compiles normally.
Evidence.
f03_a_kill_switch_whose_exit_goes_away_fails_closed. With home-server'sexitremoved,mark-pc's plan has
kill_switch: null.Fix. A restrictive road whose references fail should still apply its restriction in the closed form
(
through: null, mesh only), as the conflict case already does. Report it as an error as well. Answers openquestion 1.
Durable copy:
Via/qa/review-via-core-pr1.md.QA F-04, major. one dangling owner means no plans for anybody (major; the builder's #2, made concrete)
What. Deleting a person from
directory.jsonis the upstream event, and nothing forcesdevices.jsonto beedited at the same time. The leftover
"owner": "petr"isdevices.owner, which is a snapshot error, socompilereturns no plans at all (compile.rs:291).Evidence.
f04_deleting_a_person_revokes_them_and_nobody_else:devices[5].owner: petr is not a person … no plans at all.devices.jsonby hand.Why it matters. Revocation is the Day 2 gate. Here it becomes "Day 3 decides". If Day 3 keeps the old plan,
Petr keeps his access. If it sends an empty plan, the household goes offline.
Fix. A dangling owner becomes an ownerless device (reached only by
device:roads) plus an error naming it.Keep "no plans" for structural problems only: bad JSON, a wrong format, a duplicate key or address.
Durable copy:
Via/qa/review-via-core-pr1.md.QA F-09, major. an emptied
until:orports:silently widens the road (major)What. FORMATS.md says an empty value means absent (
header.rs:99-128,road.rsgetfiltersAbsent).For the two narrowing conditions, absent is the widest value:
until:becomes a permanent grant;ports:becomes all traffic;until: # Sunday(a comment only) also becomes a permanent grant.None of them is reported.
Evidence.
f09_an_emptied_narrowing_condition_is_an_error:until: compiled as a permanent grant with no problem reported.Why it matters. This is the R-35 failure, a temporary grant made permanent, reached by deleting a value
instead of misspelling the key. It is also what a UI writes when the user clears a field.
Fix.
until:orports:present but empty becomeskey.empty(an error). Leaving the key out keeps itscurrent meaning.
Durable copy:
Via/qa/review-via-core-pr1.md.QA B-1, major. proto v1 has no serial, so an old signed plan can be replayed (major, the builder's #1, agreed)
Envelope,Body::Plan {digest, plan}has no monotonic serial and nonot_after. Day 3's v2 must carry both,and devices must refuse a serial at or below the last one, persisted across restarts (QA 03, E-07 and E-08). No
test here: v1 is unsigned by design.
Durable copy:
Via/qa/review-via-core-pr1.md.QA B-3, major.
app:subjects reach every device, including other people's (major, the builder's #3, agreed)Subject::App(_) => true(compile.rs:101and:150). In the golden plans,e5yj1s(steam goes direct to0.0.0.0/0) is on friend-node (Petr's exit), home-server (the exit), router (a classic third-party router,which has no apps), and both of Jana's devices. Whoever can write one road changes the tunnel of every device
in the mesh. Scope it to the writer's person or device. Approvals (Day 4) must count it as a change to other
people's devices.
Durable copy:
Via/qa/review-via-core-pr1.md.QA F-05, minor. a custom block on a classic device is labelled post-quantum (minor)
plan::Custom.classiccomes fromroad.is_classic()(compile.rs:446), not from the device. Removeclassic: truefromx1d7qa, and the router's raw block is carried asclassic: false. Peers take the flagfrom the device, correctly. Custom blocks should too, or the road should be refused.
Test:
f05_a_custom_block_on_a_classic_device_is_labelled_classic.Durable copy:
Via/qa/review-via-core-pr1.md.QA F-06, minor. a road across address families compiles into a rule that never matches (minor)
A device has one mesh address. An IPv4-addressed subject that reaches an IPv6 route gets a
forwardrule withsrc 100.96.0.1/32anddst fd00:1::/64, with no problem reported. That road grants nothing, and nobody istold. Test:
f06_a_road_across_address_families_is_reported.Durable copy:
Via/qa/review-via-core-pr1.md.QA F-07, minor. a missing
roads/folder is not reported (minor, the builder's #7, agreed)Store::load_dirskips a missingroads/silently. Every plan is then empty, kill switches included.Test:
f07_a_missing_roads_folder_is_reported.Durable copy:
Via/qa/review-via-core-pr1.md.QA F-08, minor. mesh addresses may be public addresses (minor)
devices.addressrefuses only special and IPv4-embedding ranges, so198.51.100.4is accepted. An exit'sforward … internetrule then covers that device's mesh address. Confine mesh addresses to the mesh range(
100.64.0.0/10or a ULA). Theninternetand the mesh never meet, and QA R-09 (granting the tunnel pool)becomes checkable. Test:
f08_mesh_addresses_are_never_internet_addresses.Durable copy:
Via/qa/review-via-core-pr1.md.QA F-10, minor. the least-privilege property never generates IPv6 (minor)
least_privilege.rsworld()uses only100.96.0.xaddresses and10.0.0.0/22routes. The IPv6 paths arecovered only by unit tests and fixtures:
Net::hostas /128, the /128 source on its own peer, and v6 subnetsinside v6 routes. Add a v6 family to the generator, for example routes inside
fd00::/56and addresses in aULA /64. No test added.
Durable copy:
Via/qa/review-via-core-pr1.md.QA F-11, minor. Linux has never run these tests (minor, the builder's "not verified", agreed)
The
#[cfg(unix)]symlink case (R-32) has never executed, and the golden files were produced on Windows only(R-54). It needs one Linux CI run before v0.1.0.
Durable copy:
Via/qa/review-via-core-pr1.md.QA F-12, minor. person and group ids are case-sensitive, so
person:Jana≠person:jana(minor)is_opaque_idallowsA-Z. Two directory entries that differ only in case are two people, and a road for onereads identically to a road for the other. If Fundamentum's directory turns out to be case-insensitive, roads
will silently stop matching. Decide this when
PersonIdgets its real format (open question 2).Durable copy:
Via/qa/review-via-core-pr1.md.QA F-13, minor.
explainandcheckanswer as an administrator (minor here, a blocker for the Day 5 web view)These are QA R-49 and R-51, and the builder has already listed the gap. Recorded so that Day 5 cannot ship
without it.
Durable copy:
Via/qa/review-via-core-pr1.md.Owner session: QA findings fixed (branch head
18e0c50).F-01 to F-10 and B-3 are fixed, one commit each; every
#[ignore]inqa_findings.rsis gone.cargo test --workspace: 90 passed, 0 failed, 0 ignored (debug and release). clippy, fmt, deny and audit are clean. Fuzz on the final library code (7342659):road_file631 s, 807,395 executions;envelope331 s, 17,441,113 executions; 0 crashes.F-01 is solved without Ianitor: a service may have its own mesh address, and a road to a service that shares an address and a port with another is refused (
service.shared). F-02 addsdirect[].except. B-1, F-11, F-12 and F-13 are recorded as gaps indocs/02_via-core.md; F-13 blocks the Day 5 web view.QA's resolutions table in
Via/qa/review-via-core-pr1.mdis filled in. Not merged or tagged yet: one Linux run (F-11) and the signed-release question are still open.