[docs] Day 2 after QA: what each finding changed, the gaps left, open question 1 answered

02_via-core.md now describes the model as built after the QA fixes (service
addresses, app on:, fail-closed kill switch, the tunnel winning over going
direct, dangling references, empty narrowing keys, missing roads/), maps every
finding to its resolution, and lists what is recorded rather than fixed:
B-1 replay (Day 3 proto v2), a kill-switch file that does not parse, the
app-level /0 bypass, case-sensitive ids, no Linux run, and explain/check as
admin, which blocks the Day 5 web view.
This commit is contained in:
2026-11-25 09:09:01 +01:00
parent 73426592e4
commit f21f8d59fc
+73 -11
View File
@@ -53,7 +53,7 @@ change.
|:--|:--|:--|:--|:--| |:--|:--|:--|:--|:--|
| `can-reach` | person, group, device | device, subnet, service | `until`, `ports`, `via`, `classic` | peers both ways, allowed IPs, an inbound or forward firewall rule on the far side, DNS for a service | | `can-reach` | person, group, device | device, subnet, service | `until`, `ports`, `via`, `classic` | peers both ways, allowed IPs, an inbound or forward firewall rule on the far side, DNS for a service |
| `exits-through` | person, group, device | exit | `until`, `classic` | a peer with `0.0.0.0/0, ::/0`, a forward rule to the internet on the exit | | `exits-through` | person, group, device | exit | `until`, `classic` | a peer with `0.0.0.0/0, ::/0`, a forward rule to the internet on the exit |
| `goes-direct` | person, group, device, app | subnet | `until` | nothing: the subnet (or the app) bypasses the tunnel | | `goes-direct` | person, group, device, app (with `on`) | subnet | `until` | nothing: the subnet (or the app) bypasses the tunnel, except what the plan tunnels |
| `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 |
@@ -63,6 +63,12 @@ change.
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
`until` of the roads it was built from, so the engine knows when to compile again. `until` of the roads it was built from, so the engine knows when to compile again.
- An `app:` subject names whose devices it is for with `on:` (a person, group or device), and reaches only
those; without `on:` it is refused (QA B-3).
- A service is reached at its **own** mesh address when `devices.json` gives it one, else at its device's. A
road to a service that shares that address and a port with another service is refused (`service.shared`):
a firewall sees addresses and ports, never hostnames, so its rule would open the other service too (QA F-01).
A `device:` road reaches the whole device: its own address and its services' own addresses.
### The compiler ### The compiler
@@ -75,7 +81,10 @@ now ─────────────────────────
- **Deny by default.** A road with any error grants nothing. A road that is valid but expired, or whose subject - **Deny by default.** A road with any error grants nothing. A road that is valid but expired, or whose subject
has no devices, grants nothing and is reported as *inactive* with its reason. If `directory.json` or has no devices, grants nothing and is reported as *inactive* with its reason. If `directory.json` or
`devices.json` has an error, **no plan is produced at all**. `devices.json` has a *structural* error, **no plan is produced at all**. A dangling reference (a group member
or a device owner that is no longer a person) is reported and removes only itself: the member leaves the
group, the device becomes ownerless (QA F-04). An empty `until:` or `ports:` is an error, never "absent",
because absent is their widest value (QA F-09). A store without `roads/` is an error too (QA F-07).
- **Allowed IPs** are cryptokey routing, not permission. The permission is the firewall rule on the far side: - **Allowed IPs** are cryptokey routing, not permission. The permission is the firewall rule on the far side:
a road from Jana's phone to the home server gives the phone a peer for the server's address, gives the server a road from Jana's phone to the home server gives the phone a peer for the server's address, gives the server
a peer for the phone's address (so replies are accepted), and gives the server one inbound rule from the a peer for the phone's address (so replies are accepted), and gives the server one inbound rule from the
@@ -84,7 +93,16 @@ now ─────────────────────────
everything except private, link-local, loopback, CGNAT and ULA ranges, so an exit user does not reach the everything except private, link-local, loopback, CGNAT and ULA ranges, so an exit user does not reach the
exit's LAN. A device with active exit roads to two different exits gets neither, and both are reported. exit's LAN. A device with active exit roads to two different exits gets neither, and both are reported.
- **Kill switch fails closed.** Two kill-switch roads naming different exits on one device give a kill switch - **Kill switch fails closed.** Two kill-switch roads naming different exits on one device give a kill switch
through no exit at all (only the mesh), never none. through no exit at all (only the mesh), never none. So does a kill-switch road with an error, for example
when its exit stops being one: it is reported, and still applied in the closed form (QA F-03). An expired
kill switch ends as written.
- **The tunnel wins over going direct.** 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
(`direct.tunnelled`); one that holds tunnelled nets keeps them in the tunnel, listed in `direct[].except`, so
no platform has to guess which route wins (QA F-02). A platform that cannot honour `except` (an app-level
bypass) must not apply the entry.
- **Mesh addresses are never internet addresses** (QA F-08), and a road from IPv4 devices to an IPv6 place (or
the other way) gives those devices nothing and says so (`road.family`, QA F-06).
- **Deterministic.** Every collection is a `BTreeMap`/`BTreeSet` or a sorted `Vec`; road files are read in file - **Deterministic.** Every collection is a `BTreeMap`/`BTreeSet` or a sorted `Vec`; road files are read in file
name order; the same input gives byte-identical JSON and CBOR. name order; the same input gives byte-identical JSON and CBOR.
@@ -98,7 +116,9 @@ now ─────────────────────────
| A custom raw block widens access | an `AllowedIPs` line the compiler never checked | raw blocks are never merged into peers; they sit in `Plan.custom`, labelled; Day 3 must not apply them without an expert's confirmation | | A custom raw block widens access | an `AllowedIPs` line the compiler never checked | raw blocks are never merged into peers; they sit in `Plan.custom`, labelled; Day 3 must not apply them without an expert's confirmation |
| Non-determinism (hash order, file order, locale) | two compiles disagree; signatures do not match | no `HashMap` on any output path; byte-identical test with shuffled input; golden files | | Non-determinism (hash order, file order, locale) | two compiles disagree; signatures do not match | no `HashMap` on any output path; byte-identical test with shuffled input; golden files |
| The YAML subset parser accepts a construct it should refuse | a road file means something other than it reads | Pensum's subset, refused constructs each have a fixture | | The YAML subset parser accepts a construct it should refuse | a road file means something other than it reads | Pensum's subset, refused constructs each have a fixture |
| A kill switch road with an error turns the kill switch off | traffic leaks when the tunnel drops | conflicting kill switches fail closed; an *invalid* kill-switch road is an open question below | | A kill switch road with an error turns the kill switch off | traffic leaks when the tunnel drops | conflicting and erroneous kill-switch roads both fail closed (QA F-03); a kill-switch file that does not *parse* is not in the store and is only reported (gap below) |
| A service road opens a neighbour on the same host and port | "Jana can reach Photos" also reaches Git | services get their own mesh address, or the road is refused (`service.shared`, QA F-01) |
| Going direct pulls tunnelled traffic out of the tunnel | home-LAN or mesh traffic in the clear on a hostile network | `direct.mesh`, `direct.tunnelled`, `direct[].except` (QA F-02) |
| The people directory format changes | person ids no longer match | `PersonId` is one opaque newtype; changing it is one function | | The people directory format changes | person ids no longer match | `PersonId` is one opaque newtype; changing it is one function |
## Gaps (what this day does not do) ## Gaps (what this day does not do)
@@ -106,14 +126,29 @@ now ─────────────────────────
- Plans are not signed: Day 3 signs them with Tessera; `proto` leaves room (a new message version). - Plans are not signed: Day 3 signs them with Tessera; `proto` leaves room (a new message version).
- No people directory exists in Fundamentum; `directory.json` is our own snapshot format until it does. - No people directory exists in Fundamentum; `directory.json` is our own snapshot format until it does.
- Groups are **flat**: members are people, never groups, so there is no nesting to resolve and no cycle - Groups are **flat**: members are people, never groups, so there is no nesting to resolve and no cycle
(QA R-13 to R-15 do not arise; a group id among the members is `directory.member`). (QA R-13 to R-15 do not arise; a group id among the members is left out, `directory.member-unknown`).
- **Plans can be replayed (QA B-1).** Proto v1 has no serial and no `not_after`. Day 3's signed v2 must carry a
monotonic serial, which a device refuses at or below the last one it applied (persisted across restarts),
and `not_after`. Recorded here, not fixed: v1 is unsigned by design.
- **A kill-switch road that does not parse** (a typo in a key) is not in the store, so nothing applies its
restriction; `via check` reports it as an error. Failing closed would need the subject of a file that did not
parse. Day 4's editor must not save such a file.
- **An app-level `goes-direct` to `/0`** keeps only the plan's tunnelled nets in the tunnel (`except`); traffic
from that app to mesh addresses the device has no peer for goes direct. It could not have reached them
through the tunnel either.
- **Ids are case-sensitive** (QA F-12): `person:Jana` and `person:jana` are two people. Decide when the people
directory exists (open question 2).
- **Never run on Linux** (QA F-11): the `#[cfg(unix)]` symbolic-link case has not executed and the golden files
were produced on Windows. One Linux run is wanted before the tag; WSL did not start on this PC.
- Multi-hop exits (`via` on `exits-through`) are refused, not compiled: Day 6. - Multi-hop exits (`via` on `exits-through`) are refused, not compiled: Day 6.
- `via` on `can-reach` is a path hint (relay or exit) carried in the peer; the engine decides what it means. - `via` on `can-reach` is a path hint (relay or exit) carried in the peer; the engine decides what it means.
- No `via export` of a classic WireGuard config: Day 5. Its exporter must write no free text (road notes, - No `via export` of a classic WireGuard config: Day 5. Its exporter must write no free text (road notes,
names) into the file; names here are already free of line breaks and hidden characters (QA R-42). names) into the file; names here are already free of line breaks and hidden characters (QA R-42).
- No Custos approval field on roads: approvals are Day 4, and a new key is an *unknown key* to this build. - No Custos approval field on roads: approvals are Day 4, and a new key is an *unknown key* to this build.
- `explain` and `check` answer as an administrator. A web view (Day 5) must scope them to the asker (QA R-49, - `explain` and `check` answer as an administrator (QA R-49, R-51, F-13): they name every road and every
R-51): today they name every road. problem. **This blocks the Day 5 web view**: before it ships, both must take the asker and answer only about
the asker's own devices and the roads whose subject or object covers them, with snapshot problems shown to
administrators only.
- Firewall rules are one per (source, destination, port range): a group of 1,000 people to 1,000 places is - Firewall rules are one per (source, destination, port range): a group of 1,000 people to 1,000 places is
10⁶ rules, not grouped into sets (QA R-59). Measured instead (QA R-56): 10,000 roads, 2,000 devices → 10⁶ rules, not grouped into sets (QA R-59). Measured instead (QA R-56): 10,000 roads, 2,000 devices →
249,400 grants and 5,978 rules in 0.59 s (release) and 3.1 s (debug), `tests/attacks.rs`. 249,400 grants and 5,978 rules in 0.59 s (release) and 3.1 s (debug), `tests/attacks.rs`.
@@ -149,7 +184,34 @@ that reads the generated world with `u32` arithmetic and no `roads` code. Differ
without `classic: true`, which the oracle does not model. The fixtures check the positive cases instead; without `classic: true`, which the oracle does not model. The fixtures check the positive cases instead;
- P-5 (permutations) and P-6 (revocation completeness) are fixture tests (`determinism.rs`, `revocation.rs`); - P-5 (permutations) and P-6 (revocation completeness) are fixture tests (`determinism.rs`, `revocation.rs`);
- P-3 and P-4 leave out exit rules: removing one of two conflicting exit roads is *meant* to let the other apply; - P-3 and P-4 leave out exit rules: removing one of two conflicting exit roads is *meant* to let the other apply;
- R-55 (renaming every id gives an isomorphic plan) is not done. - R-55 (renaming every id gives an isomorphic plan) was added by QA in review (`tests/rename.rs`);
- IPv6 is checked by embedding (QA F-10): P-6v6 writes the same world into `fd00::/96` and requires the same
plans, mapped, and the same problems.
## QA review of PR #1, and what changed
QA's review (`Via/qa/review-via-core-pr1.md`, PR comments 49910–49925) found one blocker and five majors in the
model. Each finding had a failing test in `tests/qa_findings.rs`; every one now passes, un-ignored in the
commit that fixed it.
| # | Finding | Resolution |
|:--|:--|:--|
| F-01 | a service road opened every service on the same host and port | services may have their own mesh address; a shared address and port is `service.shared` |
| F-02 | goes-direct could take mesh or tunnelled subnets out of the tunnel | `direct.mesh`, `direct.tunnelled`, `direct[].except` |
| F-03 | an invalid kill-switch road failed open | fails closed, through no exit |
| F-04 | one dangling owner gave no plans for anybody | dangling owners and members drop only themselves |
| F-09 | an emptied `until:` or `ports:` widened the road | `key.empty` |
| B-3 | `app:` roads reached every device | `on:` is required and scopes the road |
| F-05 | a custom block on a classic device was labelled post-quantum | the device's flag counts |
| F-06 | cross-family roads compiled into dead rules | `road.family` |
| F-07 | a missing `roads/` was silent | `store.roads` |
| F-08 | mesh addresses could be public | refused |
| F-10 | the property had no IPv6 | P-6v6 |
| B-1, F-11, F-12, F-13 | replay, Linux, case, explain as admin | recorded under Gaps |
QA's R-55 property itself failed about once in four runs: a group renamed to `in` turned every firewall
`"direction": "in"` into the group's old name. The renaming now reserves every word of the output, and the seed
is a fixed test.
## Tests ## Tests
@@ -160,7 +222,7 @@ commits, and the history shows that.
|:--|:--|:--| |:--|:--|:--|
| 1 | Validation: every rule has a failing fixture naming the file and the field; a meta-test fails if a rule has none; a failing road changes no plan byte | `crates/roads/tests/validation.rs`, fixtures in `crates/roads/tests/fixtures/invalid/` (`expect.txt`) | | 1 | Validation: every rule has a failing fixture naming the file and the field; a meta-test fails if a rule has none; a failing road changes no plan byte | `crates/roads/tests/validation.rs`, fixtures in `crates/roads/tests/fixtures/invalid/` (`expect.txt`) |
| 2 | Revocation: deleting a road, expiring it, moving or removing a device, or a person from a group, removes the access on both sides | `crates/roads/tests/revocation.rs` | | 2 | Revocation: deleting a road, expiring it, moving or removing a device, or a person from a group, removes the access on both sides | `crates/roads/tests/revocation.rs` |
| 3 | Least privilege: proptest, 5,000 cases for P-1 and 500 each for the invalid/expired and P-3/P-4 properties | `crates/roads/tests/least_privilege.rs` | | 3 | Least privilege: proptest, 5,000 cases for P-1, 1,000 for P-6v6 (IPv6 by embedding) and 500 each for the invalid/expired and P-3/P-4 properties | `crates/roads/tests/least_privilege.rs` |
| 4 | Determinism: byte-identical twice, with shuffled input, with CRLF files, against golden plans; CBOR twice and decode → encode, a pinned digest | `crates/roads/tests/determinism.rs`, `crates/proto/tests/roundtrip.rs` | | 4 | Determinism: byte-identical twice, with shuffled input, with CRLF files, against golden plans; CBOR twice and decode → encode, a pinned digest | `crates/roads/tests/determinism.rs`, `crates/proto/tests/roundtrip.rs` |
| 5 | `explain` returns exactly the allowing roads, each one enough alone, and nothing when denied | `crates/roads/tests/explain.rs` | | 5 | `explain` returns exactly the allowing roads, each one enough alone, and nothing when denied | `crates/roads/tests/explain.rs` |
| 6 | Custom roads round-trip unchanged: file → render, through the plan and through CBOR | `crates/roads/tests/custom.rs`, `crates/proto/tests/roundtrip.rs` | | 6 | Custom roads round-trip unchanged: file → render, through the plan and through CBOR | `crates/roads/tests/custom.rs`, `crates/proto/tests/roundtrip.rs` |
@@ -171,8 +233,8 @@ and the binary in `crates/via-cli/tests/cli.rs`. Dates use `jiff`: `chrono` is f
## Open questions ## Open questions
1. Should an *invalid* `never-online-without` road fail closed (kill switch on through no exit), since "grants 1. ~~Should an invalid `never-online-without` road fail closed?~~ Answered: yes (QA F-03, and Mark's "nothing
nothing" turns the protection off? This build reports it and does not apply it. leaks when the tunnel drops"). It is reported and applied through no exit.
2. Does the people directory key people by a Tessera root key, a random id, or a name? `PersonId` waits. 2. Does the people directory key people by a Tessera root key, a random id, or a name? `PersonId` waits.
3. Where does a service's hosting device come from: Ianitor's upstreams name hosts and ports, not Tessera keys. 3. Where does a service's hosting device come from: Ianitor's upstreams name hosts and ports, not Tessera keys.
This build takes it from `devices.json`. This build takes it from `devices.json`.