ratchet verify: end-to-end + adversarial tests on the wired chat path #88
Loading…
Reference in a new issue
No description provided.
Delete branch "wt/t_95ff7563"
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?
Verification card for the chat Double Ratchet, stacked on the merged PR #87 (base
main). Offline: real SQLCipher stores, real identity keys, the realencode_chat_frame/ingest_chat_framepair thatNode::sendandNode::handle_incomingcall, and a capture-and-releaseDelivererso the test decides what arrives, when, and how often. No live Tor on the offline paths.Why the harness looks like this
Node::start/start_with_passphraseare the only public constructors and both bootstrap Tor and publish an onion service, sotests/*.rscannot build aNode. The wire-level files drive the exact functions those two call sites use; theNodestruct itself (its send body and its dispatch arm, over a real Noise IK handshake on an in-memory stream) is driven insrc/node.rs's test module. The live Tor case stays#[ignore]d intests/two_node.rs, unchanged.Scenarios
tests/ratchet_e2e.rstests/ratchet_e2e.rstests/ratchet_e2e.rsalready usedwith exactly one chat rowtests/ratchet_adversarial.rsMAX_SKIP(not an AEAD failure), no chat row, persisted blob byte-identical; N = next + 2000 passes the bound and is rejected only by its tagtests/ratchet_e2e.rstests/ratchet_adversarial.rstests/ratchet_adversarial.rsunknown friendand writes no session row; a frame from an epoch derived from a prekey Bob no longer holds is rejected, writes no session row, and the re-scanned invite resumes both directionstests/ratchet_adversarial.rsNode-level (src/node.rstest module,cargo test --lib):Node::sendqueues exactly oneratframe on the outbox row with the plaintext only in local history; an inbound frame goes through a real Noise IK handshake intohandle_incomingand is dispatched to the ratchet; out-of-order, replay and corruption behave the same through the real receive path.Scope deviation
src/node.rsgains a#[cfg(test)] mod tests(no production code, no public API change) because aNodecannot be constructed fromtests/without Tor. It builds the struct literal with an unbootstrappedTorClientand aNoDialdeliverer, and bridgestokio::io::duplextofutures::iowith a 30-line adapter instead of adding a dev-dependency. Everything else is inside the two allowed new test files; no existing test was weakened or deleted.One test repair, not a product bug
The first version of the retired-epoch case only called
clear_ratchetand relied on the prekeys being unchanged; that is not deterministic, because a peer that re-derives the same bootstrap epoch can still follow the lineage by public-key order, and the test passed or failed depending on the random tie-break. It now changes the friend's recorded prekey (what a refreshed invite does, and what makesNode::add_friend_payloadclear the session), which is deterministic. The product code was not changed: 20 consecutive runs of the Node-level tests and 15 consecutive runs of both new files pass.Evidence
cargo test --locked --target x86_64-unknown-linux-gnu: 288 passed, 0 failed, 4 ignored across 32 test targets (baseline onmainwas 275 passed, 3 ignored — the delta is the 13 new tests; the 4 ignored are the pre-existing live-Tor cases).cargo clippy --locked --all-targets --target x86_64-unknown-linux-gnu -- -D warnings: clean.Not verified
tests/two_node.rsstays#[ignore]d; nothing here exercises a real onion, a real publish, or Arti's HS client against a remote service.crates/onionwire-sdk: not touched, not built here.Node, not the widgets.