Repository navigation
Walkthrough: what may leave the PC (Egress.lean: the pre-send check and the network sentinel) #59
zenos-maintainer
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This is the third walkthrough of the Lean side of ZENOS, after Flow.lean (where content may go) and Ledger.lean (the tamper-evident ledger). This one covers
formal/ZenosFormal/Egress.lean, the two decisions about what leaves the PC. The file is the same in the 0.1.2 Developer Preview and on main.As with the other decisions, the services do not reimplement these rules: they run
zenos-decide, the program built from the same Lean definitions, and follow its answer (system/lib/zdecide.py). If it gives no usable answer, the pre-send check refuses and the network sentinel cuts.1. The pre-send check (
decideSend)A file going out through the sanctioned path (
core/bin/zenos_sendcheck.py) is described by five facts: is it a ZENOS sealed file, does the device signature over header and ciphertext verify, its size, the size line, and whether an approved transfer plan covers it. The decision is threeifs:send_soundstates what anallowimplies:What is not proved here: that
sealedandsigOkare true facts about the file. Those are checked by the service (header and signature) and passed in. The proof says the decision never lets an unsealed or unverified file through, given those facts.2. The network sentinel (
egressStep)The kernel sensor (an eBPF/bpftrace probe) reports each outbound send: which program, which destination, whether that destination is in an approved network, the time and the bytes. For each program and destination the sentinel keeps a sliding window of recent sends, and cuts the destination when the bytes in the window reach the threshold. The defaults in
zenos_netsentinel.pyare 1 MiB within 3 seconds.Three theorems:
egress_cut_iff: the step reports a cut exactly when the destination is not approved, not already cut, and the bytes in the window reach the threshold. Both directions: no cut without the condition, and no missed cut when it holds.egress_cut_stays: once a destination is in the cut list, no later step removes it.prune_prune: dropping sends older than the window loses nothing later, as long as the sentinel's clock does not go backwards (t ≤ t'). Writing this walkthrough turned up a gap: the service currently stamps sends with wall-clock time (time.time()), which can jump, so it does not guarantee that hypothesis. Tracked in Network sentinel: feed the egress window a monotonic clock (prune_prune assumes time never goes backwards) #58 (switch to a monotonic clock).Limits worth knowing
They follow from the definitions above and from THREAT_MODEL.md and are part of the picture, not footnotes:
Checking it yourself
Axioms.leanfails the build if any theorem rests onsorryor on an axiom beyond Lean's standard ones. Steps for a fresh machine are in docs/FORMAL_VERIFICATION.md.If a theorem here looks weaker than its comment claims, or the model leaves out something that matters, please say so in this thread or in an issue. Security holes go to the private channel in SECURITY.md.
All reactions