Skip to content

Fix DoChannelRequest and add a unit test#942

Merged
ejohnstown merged 1 commit intowolfSSL:masterfrom
yosuke-wolfssl:f_2080
Apr 21, 2026
Merged

Fix DoChannelRequest and add a unit test#942
ejohnstown merged 1 commit intowolfSSL:masterfrom
yosuke-wolfssl:f_2080

Conversation

@yosuke-wolfssl
Copy link
Copy Markdown
Contributor

This PR fixes DoChannelRequest() so that this rejects SSH_MSG_CHANNEL_REQUEST with an unrecognized type as defined in RFC 4254 section 5.4.
Also, new unit test is added to exercise the code path.

@yosuke-wolfssl yosuke-wolfssl self-assigned this Apr 21, 2026
Copilot AI review requested due to automatic review settings April 21, 2026 04:56
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aligns DoChannelRequest() with RFC 4254 §5.4 by rejecting SSH_MSG_CHANNEL_REQUEST messages whose request type is unrecognized, and adds a unit test to validate the success/failure reply behavior.

Changes:

  • Reject unknown channel request types by sending CHANNEL_FAILURE when wantReply is set.
  • Expose DoChannelRequest() via a WOLFSSH_TEST_INTERNAL test wrapper.
  • Add a unit test that exercises known vs unknown request types and inspects the outgoing reply.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/internal.c Reject unknown channel request types and add a test-only wrapper for DoChannelRequest().
wolfssh/internal.h Declare the new wolfSSH_TestDoChannelRequest() test hook.
tests/unit.c Add a unit test that validates CHANNEL_SUCCESS vs CHANNEL_FAILURE replies.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/unit.c Outdated
Comment thread src/internal.c
@ejohnstown ejohnstown merged commit cd7a7f4 into wolfSSL:master Apr 21, 2026
131 checks passed
@yosuke-wolfssl yosuke-wolfssl deleted the f_2080 branch April 21, 2026 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants