Skip to content

Static code analysis fixes#908

Open
LinuxJedi wants to merge 9 commits intowolfSSL:masterfrom
LinuxJedi:f-fixes
Open

Static code analysis fixes#908
LinuxJedi wants to merge 9 commits intowolfSSL:masterfrom
LinuxJedi:f-fixes

Conversation

@LinuxJedi
Copy link
Copy Markdown
Member

  • Fix oct2dec typo
  • Fix leak in linked-list
  • Fix Nucleus month handling
  • Fix DoDisconnect to signal connection termination
  • fix DoChannelOpen failure response and add regression test
  • Validate the host key signature algorithm name in DoKexDhReply()

DoDisconnect was returning WS_SUCCESS after receiving
SSH_MSG_DISCONNECT, allowing the session to continue
processing packets. Per RFC 4253 §11.1, no further data
should be accepted after a disconnect message. Add new
WS_DISCONNECT error code and return it from DoDisconnect
so callers tear down the connection immediately.

F-605
Send SSH_MSG_CHANNEL_OPEN_FAILURE for unclassified channel open errors
instead of incorrectly falling back to SSH_MSG_REQUEST_FAILURE.

Normalize OPEN_OK error cases to an administrative-prohibited channel
open failure with a generic description, and add white-box regressions
covering callback rejection plus optional direct-tcpip and agent-null
paths.

F-2076
The client-side KEXDH_REPLY path was parsing the signature blob name and
skipping over it without checking that it matched the negotiated host key
algorithm. That allowed an RSA server to negotiate rsa-sha2-256 or
rsa-sha2-512 but send a signature blob labeled ssh-rsa instead.

Fix this by comparing the signature blob name against the expected
signature type derived from handshake->pubKeyId before verifying the
signature bytes.

Add regress coverage that drives an in-memory client/server handshake,
rewrites the server's first KEXDH_REPLY on the wire, and verifies the
client rejects rsa-sha2-256 and rsa-sha2-512 replies whose signature blob
name is downgraded to ssh-rsa.

F-2077
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 addresses multiple static-analysis and correctness findings across wolfSSH core and regression tests, tightening protocol handling and fixing a few platform-specific and memory-management issues.

Changes:

  • Add a dedicated disconnect error code and propagate disconnect as a terminal condition.
  • Harden KEXDH reply processing by validating the signature algorithm name against the negotiated hostkey algorithm (with regression coverage).
  • Fix SFTP handle-list unlinking and correct Nucleus mktime() month handling; also fix octal digit validation and channel-open failure responses.

Reviewed changes

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

File Description
wolfssh/error.h Adds WS_DISCONNECT and updates WS_LAST_E to include the new terminal error code.
src/internal.c Implements disconnect propagation, validates KEXDH reply signature name, fixes wolfSSH_oct2dec() digit check, and ensures channel-open failures send CHANNEL_OPEN_FAIL.
src/wolfsftp.c Fixes handle-list head removal logic and corrects Nucleus month conversion for mktime().
tests/regress.c Adds regression coverage for channel-open failure responses and KEXDH reply signature-name downgrade rejection.

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

Copilot AI review requested due to automatic review settings April 8, 2026 13:05
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

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.


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

Copy link
Copy Markdown

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

Choose a reason for hiding this comment

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

Fenrir Automated Review — PR #908

Scan targets checked: wolfssh-bugs, wolfssh-compliance, wolfssh-consttime, wolfssh-defaults, wolfssh-mutation, wolfssh-proptest, wolfssh-src, wolfssh-zeroize

Findings: 4
4 finding(s) posted as inline comments (see file-level comments below)

This review was generated automatically by Fenrir. Findings are non-blocking.

Copilot AI review requested due to automatic review settings April 8, 2026 13:53
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

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.


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

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