Fenrir fixes for session, cipher, CRL, and X509 handling - #409
Open
cconlon wants to merge 5 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR applies a set of targeted correctness fixes (“Fenrir” items) across the JNI layer and the JSSE provider, focusing on safer error handling, correct session-cache resumption behavior, and closer adherence to X509Certificate extension-OID contracts.
Changes:
- Prevents leaking uninitialized native data by only copying the TLS HMAC inner buffer back to Java on success, with added regression test coverage.
- Adds
GetStringUTFChars()NULL checks across several JNI string wrappers to safely handle allocation failures. - Improves session cache lookup correctness by avoiding client resumption from server-side cached entries, and aligns critical/non-critical extension OID getters with the
X509Certificatecontract (with new tests).
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/test/com/wolfssl/test/WolfSSLSessionTest.java | Adds regression coverage for setTlsHmacInner() error-path behavior (no buffer copy-back). |
| src/test/com/wolfssl/provider/jsse/test/WolfSSLX509Test.java | Adds test asserting critical OID set is empty (not null) when extensions exist but none are critical. |
| src/test/com/wolfssl/provider/jsse/test/WolfSSLTestFactory.java | Adds client-cert.der path for new X509 extension tests. |
| src/java/com/wolfssl/WolfSSLSession.java | Updates setTlsHmacInner() documentation to reflect new error-path behavior. |
| src/java/com/wolfssl/provider/jsse/WolfSSLX509.java | Refactors extension OID getters to share logic and better match X509Certificate null/empty-set requirements. |
| src/java/com/wolfssl/provider/jsse/WolfSSLAuthStore.java | Prevents client-side resumption from server-side cached entries; clarifies cache overwrite semantics. |
| native/com_wolfssl_WolfSSLSession.c | Adds GetStringUTFChars() NULL checks, fixes getCurrentCipher null-check message, and gates HMAC-inner copy-back on success. |
| native/com_wolfssl_WolfSSLContext.c | Adds GetStringUTFChars() NULL checks (including multi-string cleanup in loadVerifyLocations). |
Suppressed comments (1)
src/java/com/wolfssl/provider/jsse/WolfSSLAuthStore.java:698
- This updated block comment introduces lines that exceed the 80-character limit (including indentation). Please re-wrap the comment to keep each line within 80 columns.
/* Only store session into cache if we have a usable key. An existing
* entry for cacheKey is overwritten, including one from the opposite
* side since client and server share the host:port key namespace.
* getSession() guards the read side against reusing a server-side
* entry for client resumption. */
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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 5 Fenrir fixes: