Test the ECDH participant gate that mutation testing found unguarded - #945
Conversation
|
Warning Review limit reached
Next review available in: 42 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
The check that a completed-secret announcement came from an actual participant in the ECDH session had no test. The function around it reads as covered: there is a test named for rejecting an unknown session, and it does reject one, but it returns at the session lookup twenty lines earlier and never reaches the authorisation that follows. Coverage of the function was not coverage of the gate inside it.
Mutation testing is what surfaced it rather than reading. Two mutations of that gate survived a previous run: inverting the pubkey comparison, so it matches every peer except the real one, and deleting the negation on the result, so participants are refused and everyone else admitted. Either one hands a derived shared secret to a key that is not in the session, and nothing in the suite objected to either.
No behavior changes here. This is the test that was missing.
Test plan
Two tests, and the second is what makes the first mean anything. With no peer registered the lookup returns nothing and every sender fails the gate, so a refusal on its own would prove only that something refused, not that identity was checked. The first sends a key that is not a participant and requires refusal; the second sends the registered participant's key with a deliberately wrong-length secret and requires the failure to move past the gate to the length conversion, which shows the gate discriminates on identity rather than rejecting whatever reaches it.
Verified against the mutants rather than assumed: both survivors are killed by these tests, checked by applying each mutation directly and confirming the suite goes red, then restoring. The whole crate's library tests pass, formatter and clippy clean.
Worth noting for anyone extending this: the crate's integration tests need the
testingfeature, so a barecargo test -p keep-frost-netfails on unrelated unresolved imports before reaching anything here.