Skip to content

test: close wolfSSH test_gap coverage hole - #1100

Open
MarkAtwood wants to merge 1 commit into
wolfSSL:masterfrom
MarkAtwood:fix/wolfssh-test_gap
Open

test: close wolfSSH test_gap coverage hole#1100
MarkAtwood wants to merge 1 commit into
wolfSSL:masterfrom
MarkAtwood:fix/wolfssh-test_gap

Conversation

@MarkAtwood

@MarkAtwood MarkAtwood commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Adds mutation-killing test coverage for one wolfsshd authentication branch reported by Fenrir static analysis. Test-only addition; no production logic changes. Build-verified against wolfSSL --enable-all, and the new assertions were confirmed to fail when the guard is deleted (mutant killed).

  • F-6702 apps/wolfsshd/test/test_configuration.c — extend
    test_CheckPasswordHashUnix with empty-input/empty-hash,
    empty-input/real-hash, non-empty/empty-hash, and locked-account (*) cases;
    these kill the &&->|| and empty-branch mutants. No auth.c logic change.

Copilot AI review requested due to automatic review settings July 10, 2026 00:35

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.

Pull request overview

This PR adds targeted unit-test coverage to “kill” mutation-testing gaps around secret zeroization in wolfSSH and wolfsshd authentication code paths, including a WOLFSSHD_UNIT_TEST-guarded export to allow direct testing of an otherwise-internal password check routine.

Changes:

  • Add a capturing-allocator unit test to verify HandshakeInfoFree() wipes HandshakeInfo before free (tests/unit.c).
  • Extend wolfsshd auth tests to cover additional CheckPasswordHashUnix() edge cases and add a capturing-allocator test to verify CheckPasswordUnix() wipes pwStr before free (apps/wolfsshd/test/test_configuration.c).
  • Export CheckPasswordUnix() only for unit tests (apps/wolfsshd/auth.c, apps/wolfsshd/auth.h).

Reviewed changes

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

File Description
tests/unit.c Adds a new retain-on-free test to assert HandshakeInfoFree() zeroizes sensitive handshake fields before release and wires it into the unit test runner.
apps/wolfsshd/test/test_configuration.c Adds extra CheckPasswordHashUnix() scenarios and a new capturing-allocator test validating CheckPasswordUnix() wipes the plaintext password buffer prior to free.
apps/wolfsshd/auth.h Declares CheckPasswordUnix() for unit-test builds so test code can link against it.
apps/wolfsshd/auth.c Makes CheckPasswordUnix() non-static under WOLFSSHD_UNIT_TEST to support the new unit test.

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

Comment thread apps/wolfsshd/test/test_configuration.c Outdated
Comment thread tests/unit.c Outdated
Add mutation-killing unit coverage flagged by Fenrir static analysis.
No production logic changes.

* F-6702 test_configuration.c: extend test_CheckPasswordHashUnix with
  empty/locked-password cases pinning the empty-branch guard.

Co-authored-by: John Safranek <john@wolfssl.com>
@ejohnstown
ejohnstown force-pushed the fix/wolfssh-test_gap branch from 3769948 to 0b4f7f1 Compare July 28, 2026 00:15
@ejohnstown ejohnstown changed the title test: close wolfSSH test_gap coverage holes test: close wolfSSH test_gap coverage hole Jul 28, 2026
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