Security and correctness fixes from internal scan#363
Merged
rlm2002 merged 15 commits intowolfSSL:masterfrom May 1, 2026
Merged
Security and correctness fixes from internal scan#363rlm2002 merged 15 commits intowolfSSL:masterfrom
rlm2002 merged 15 commits intowolfSSL:masterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR applies a set of JSSE-provider security/correctness hardening fixes identified by an internal scan, focusing on safer logging, stricter API behavior, improved session/cache correctness, and defensive plaintext cleanup.
Changes:
- Harden logging and API behavior (avoid caller-controlled
toString()output, replaceprintStackTrace, restrict accidentally-public APIs, tighten SSLSession value semantics). - Improve session/cache correctness (better cache-key handling, invalidate sessions with future creation times, ensure handshake failure paths close cleanly).
- Add defensive plaintext cleanup (zero sensitive buffers after send and during engine cleanup) and reduce unnecessary synchronization in hot paths.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/java/com/wolfssl/provider/jsse/WolfSSLImplementSSLSession.java | Switch SSLSession value bindings to ConcurrentHashMap, tighten value handling, make SNI list immutable, and improve error-path behavior/logging. |
| src/java/com/wolfssl/provider/jsse/WolfSSLEngineHelper.java | Remove unnecessary synchronization from static capability helpers and ensure CloseNotify is sent in a session-creation-disabled handshake failure path. |
| src/java/com/wolfssl/provider/jsse/WolfSSLEngine.java | Add plaintext wiping in send/cleanup paths, remove unnecessary synchronization from buffer sizing helper, and replace printStackTrace with structured logging. |
| src/java/com/wolfssl/provider/jsse/WolfSSLContext.java | Fix CA-load logging correctness on failures, avoid logging caller-controlled toString() for KM/TM arrays, and make getProtocolsMask() private. |
| src/java/com/wolfssl/provider/jsse/WolfSSLAuthStore.java | Log manager class names instead of toString(), fix SecureRandom init logic, refine session-cache key handling/return codes, and invalidate “future” sessions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ct null in putValue()
rlm2002
approved these changes
May 1, 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.
This PR includes fixes from internal AI-based scan.
WolfSSLContext.getProtocolsMask()private (removed accidentally-public mutator)toString()(avoid leaking caller-supplied debug output)staticAppDataBufafterSendAppData(); defensive zero in engine cleanupprintStackTraceinbeginHandshake()catch withWolfSSLDebug.log()synchronizedfromgetTotalOutputSize(); hoist array element to localshutdownSSL()before returningSSL_HANDSHAKE_FAILUREwhensessionCreation==false(path mirroring)synchronizedfromgetAllCiphers()/getAllProtocols()initSecureRandom()overwriting the default with the original null arg (missingelse)hashCode==0inaddSession(); returnSSL_FAILUREwhen no keySSLSessionvalue bindings fromHashMaptoConcurrentHashMap; reject null values per SunJSSEgetRequestedServerNames()return path withCollections.unmodifiableList()SSLPeerUnverifiedExceptionfromgetPeerCertificateChain()error path instead of returning nullprintStackTraceingetId()withWolfSSLDebug.log()