Cover and document the client KEX role check - #1223
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
Changes are low-risk (tests + documentation) and the new assertions better pin the intended client-side KEX role behavior.
Pull request overview
Follow-up to #1222 that tightens regression coverage for the client-side KEX role check and clarifies what IsMessageAllowed() is actually answering (receive policy) in src/internal.c.
Changes:
- Extend
TestClientOnlyKexMsgsBlockedto assert that client-expected KEX messages (e.g., 31 and 33) remain allowed in the correct handshake states, including during rekey. - Add explanatory documentation to
IsMessageAllowed()about the unusedstateparameter and the per-KEX-method meaning of message IDs 30–49.
File summaries
| File | Description |
|---|---|
| tests/regress.c | Strengthens client-side regression assertions around which KEX message IDs must be blocked vs. allowed in specific states. |
| src/internal.c | Documents IsMessageAllowed() semantics (receive-only policy / unused state) and contextualizes KEX message ID allocation. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
TestClientOnlyKexMsgsBlocked now asserts that 31 and 33, the ids a client does receive, stay allowed where the handshake expects them, so widening the role check into a 30-34 range fails the suite. The IsMessageAllowed() comment records the receive-only policy and the per-KEX-method id namespace. - assert id 33 is allowed once expectMsgId is MSGID_KEXDH_GEX_REPLY - assert expectMsgId starts at MSGID_NONE, so the role check is what rejects the blocked ids - recheck all three blocked ids during a rekey on an established session
ejohnstown
force-pushed
the
msgguard-kex-followup
branch
from
September 2, 2026 20:40
59e77d0 to
ad42c78
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #1223
Scan targets checked: wolfssh-bugs, wolfssh-src
Fenrir result: Approved ✅
No new issues found in the changed files.
Advisory only — this automated result does not count as a GitHub approval.
philljj
approved these changes
Sep 3, 2026
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.
Follow-up to #1222. Adds the client-side assertions that pin the new KEX
role check, and a comment recording what
IsMessageAllowed()actuallyanswers.
TestClientOnlyKexMsgsBlockedasserts that 31 and 33, the ids a clientdoes receive, stay allowed where the handshake expects them, so widening
the role check into a 30-34 range fails the suite
IsMessageAllowed()comment records that the side helpers implementthe receive policy only, and that ids 30 to 49 are reallocated by each
KEX method