fix(cert): exempt roots from the responder-cert checks (symmetric with the init-side gates)#97
Merged
Merged
Conversation
…h the init-side gates) (#96) Follow-up from the #36/#41 hardening (PR #95). That branch added is_root exemption to all five init-side cert gates. The three pre-existing responder-cert checks — an initiator verifying the responder's msg2 cert in handle_handshake_resp, relayed_handshake_resp, and rekey_resp_core — lacked it, so a root whose cert lapsed while still in the signed root set, acting as a responder, would be rejected by an initiator. Roots are trusted via the signed root set, not a member cert, so gate all three on !is_root(responder pubkey) too. New test initiator_admits_root_responder_despite_missing_cert (root establishes despite no cert); initiator_rejects_responder_with_bad_cert stays green (non-root still rejected). 237 unit green, clippy clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #96. Follow-up from the #36/#41 session-lifecycle hardening (PR #95).
Problem
PR #95 introduced a shared
is_roothelper and exempts always-admit roots from all five init-side cert gates it added (rekey re-verify + re-admission gate on both direct/relay paths, and the liveness sweep). The three pre-existing responder-cert checks — an initiator verifying the responder's msg2 cert inhandle_handshake_resp,relayed_handshake_resp, andrekey_resp_core— were left without the exemption.So a root whose cert lapsed while still in the signed root set, acting as a responder, would be rejected by an initiator completing a handshake with it. Roots are trusted via the signed root set, not a member cert (you revoke a root by removing it from the root set), so this is an inconsistency with the exemption model the rest of the code follows.
Fix
Gate all three responder-cert checks on
!self.is_root(self.peers[idx].pubkey)too — a root responder is admitted even with a missing/lapsed cert; a non-root responder still requires a valid cert. These are notdrop_sessionteardown sites; they only refuse to complete.Testing
initiator_admits_root_responder_despite_missing_cert: an initiator completing a handshake with a root responder that presents no cert establishes (confirmed failing before the fix, passing after).initiator_rejects_responder_with_bad_cert(non-root) stays green — proving the exemption is root-only.-D warnings, fmt — all clean.