Skip to content

Refuse a session channel open on a client - #1224

Merged
philljj merged 1 commit into
wolfSSL:masterfrom
ejohnstown:session-direction
Sep 3, 2026
Merged

Refuse a session channel open on a client#1224
philljj merged 1 commit into
wolfSSL:masterfrom
ejohnstown:session-direction

Conversation

@ejohnstown

Copy link
Copy Markdown
Contributor

DoChannelOpen refuses a session open on a client endpoint, per RFC 4254
6.1, ahead of ChannelNew and any channelOpenCb. OpenSSH and Dropbear
refuse it outright too, with no application opt-in.

  • Answer OPEN_ADMINISTRATIVELY_PROHIBITED, as the forwarded-tcpip
    direction gate below it does.
  • Widen the client harness guard in regress.c so it builds without
    WOLFSSH_FWD.
  • Cover the refusal, and the gate outranking an accepting channelOpenCb.

Issue: F-8836

RFC 4254 6.1 has a session open travelling client-to-server, so
DoChannelOpen refuses one on a client endpoint in the type switch,
ahead of ChannelNew and any channelOpenCb. OpenSSH and Dropbear
refuse it outright too, with no application opt-in.

- Answer OPEN_ADMINISTRATIVELY_PROHIBITED, as the forwarded-tcpip
  direction gate below it does.
- Widen the client harness guard in regress.c so it builds without
  WOLFSSH_FWD, and hoist AcceptChannelOpenCb out of the forwarding
  block.
- Cover the refusal, and the gate outranking an accepting
  channelOpenCb.

Issue: F-8836

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The change is small, RFC-aligned, and is backed by targeted regression tests that validate both the new refusal behavior and its precedence over callbacks.

Pull request overview

This PR updates wolfSSH’s channel-open handling to refuse inbound session channel open requests when running as a client endpoint, matching RFC 4254 §6.1 directionality and aligning behavior with OpenSSH/Dropbear.

Changes:

  • Add an explicit direction gate in DoChannelOpen() to reject session opens received by a client and respond with OPEN_ADMINISTRATIVELY_PROHIBITED.
  • Broaden the client-side channel-open harness guard in tests/regress.c so it builds without WOLFSSH_FWD.
  • Add regression coverage to ensure the refusal occurs and that it outranks an accepting channelOpenCb.
File summaries
File Description
tests/regress.c Expands client harness availability and adds tests covering client-side refusal of inbound session opens and precedence over channelOpenCb.
src/internal.c Adds client-side direction check for session channel opens, returning an administrative-prohibited open-failure response.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Fenrir Automated Review — PR #1224

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
philljj merged commit 79456c2 into wolfSSL:master Sep 3, 2026
172 checks passed
@ejohnstown
ejohnstown deleted the session-direction branch September 3, 2026 15:55
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.

5 participants