Fix multiple reported issues. - #11009
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses multiple reported issues (zd#22229) across certificate verification and TLS handshake processing by tightening cleanup semantics and enforcing negotiated values for RPK certificate-type extensions.
Changes:
- Prevent untrusted temporary CA issuers from persisting in the shared CertManager during/after
wolfSSL_X509_verify_cert()and fix object-list cleanup when CRLs are appended. - Enforce “offered vs received” constraints for
client_cert_type/server_cert_type(RFC 7250 / RFC 8446) to reject unsolicited or unoffered negotiated values. - Reset per-handshake RPK negotiation state on SSL object reuse and harden output-buffer shrinking to avoid freeing non-heap memory and to drop stale accounting.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/x509_str.c | Harden temp-CA lifecycle during X509 store verification; fix get0_objects() cleanup when CRLs are present. |
| src/tls.c | Reject unsolicited/unoffered cert-type negotiation values for RPK-related TLS extensions. |
| src/ssl.c | Reset RPK negotiation state on WOLFSSL object reuse (preserving isRPKLoaded). |
| src/internal.c | Make ShrinkOutputBuffer() safe for static buffers and reset output accounting when discarding pending output. |
Comments suppressed due to low confidence (1)
src/x509_str.c:1170
- Exit cleanup unconditionally calls wolfSSL_CertManagerUnloadTempIntermediateCerts(), but ignores its return value. If this unload fails (e.g., BAD_MUTEX_E), the function can return success while leaving WOLFSSL_TEMP_CA entries resident in the shared CertManager, undermining the stated goal of always cleaning up temporary trust anchors. Consider propagating cleanup failure (at least when verification otherwise succeeded).
if (ctx->store != NULL) {
wolfSSL_CertManagerUnloadTempIntermediateCerts(ctx->store->cm);
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| X509StoreRemoveCa(ctx->store, issuer, WOLFSSL_TEMP_CA); | ||
| X509VerifyCertSetupRetry(ctx, certs, failedCerts, | ||
| &depth, origDepth); |
There was a problem hiding this comment.
This doesn't solve the problem. It just acts as a retry. Erroring out directly from X509StoreRemoveCa should be fine.
|
julek-wolfssl
left a comment
There was a problem hiding this comment.
comments are way too verbose
| X509StoreRemoveCa(ctx->store, issuer, WOLFSSL_TEMP_CA); | ||
| X509VerifyCertSetupRetry(ctx, certs, failedCerts, | ||
| &depth, origDepth); |
There was a problem hiding this comment.
This doesn't solve the problem. It just acts as a retry. Erroring out directly from X509StoreRemoveCa should be fine.
…reset the buffer state. Thanks to Christos Papakonstantinou (Cantina Security) for the report.
Thanks to Christos Papakonstantinou (Cantina Security) for the report.
Thanks to Christos Papakonstantinou (Cantina Security) for the report.
Thanks to Christos Papakonstantinou (Cantina Security) for the report.
… logic, add test, make comments less verbose
…comment verbosity, add test
|
I removed the X509StoreRemoveCa call. Adding error checking would have caused issues in the case that the cert was already added previously. AddCA would return success, but the cert would not be added as TEMP_CA type, so X509StoreRemoveCa would error out. The TEMP_CAs will be removed either way by the unconditional wolfSSL_CertManagerUnloadTempIntermediateCerts call. |
Description
Fixes zd#22229
Testing
Built in tests, provided reproducers.
Checklist