Repository navigation
test(security): pin single-use pairing codes and wrong-code refusal - #149
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Comment |
Tiny Sweeper reviewReviewed head: Verdict: Ready for maintainer review · Priority: none Diagnostics and supporting detailsFull summaryPull request purpose (title): test(security): pin single-use pairing codes and wrong-code refusal. Tiny Sweeper completed its review; deterministic results follow. Review snapshot
Completeness: Complete What changed`try_pair_wrong_code` now derives a wrong code from the actual `pairing_code()` by flipping its last character, guaranteeing it differs from the real code, then asserts `try_pair` returns `None`, `is_paired()` is false, and the pending code is retained. A new test `a_pairing_code_is_single_use` pairs once with the real code, asserts the same code is then refused, and asserts `pairing_code()` becomes `None`. Only test code in `crates/tinychannels-runtime/src/security/mod_tests.rs` is touched; no production code is modified. Features
Tests
FindingsNo active actionable findings. Before mergeNone. Agent review detailscritique
security
tests
commits
description
Evidence and run details
|
try_pair_wrong_code discarded its result, so it asserted nothing. It now derives a certainly-wrong code from the real one and asserts it is refused without consuming the code. A new test pins that a pairing code works once and is cleared after.
2a676ca to
60bb7a1
Compare
Summary
Test-only.
PairingGuardalready clears the one-time pairing code after a successful pair and refuses a wrong code, but nothing pinned either:try_pair_wrong_codetried"000000"and discarded the result (let _ = result;), so it asserted nothing. It now derives a certainly-wrong code from the real one (same length, last character changed) and asserts it is refused, nothing is paired, and the code is kept.a_pairing_code_is_single_use: pair once with the code, then the same code is refused andpairing_code()isNone.API Or Behavior Changes
None.
Tests
CARGO_INCREMENTAL=0 cargo test -p tinychannels-runtime --lib -- security::test::try_pair_wrong_code security::test::a_pairing_code_is_single_useCurrent code:
ok. 2 passed; 0 failed.Break-check 1, code not cleared after pairing (
*pairing_code = Noneremoved):a_pairing_code_is_single_useFAILED.Break-check 2, any code accepted (comparison forced true):
try_pair_wrong_codeFAILED.Code restored after each break.
cargo fmt --check(touched file)N/A:
cargo clippy --all-targets -- -D warnings: left to CIN/A:
cargo clippy --all-targets --all-features -- -D warnings: left to CIN/A:
cargo build --all-targets: left to CIN/A:
cargo build --all-targets --all-features: left to CIN/A:
cargo test: only the two tests ran locally; CI runs the suiteN/A:
cargo test --all-features: left to CIDocumentation
N/A: tests only.