Repository navigation
Conversation
GnuTLS documents for gnutls_certificate_verify_peers2() that it already takes a received OCSP response into account. Therefore our own code needs only to check if a stapled OCSP response was receieved when verifystatus is requested. Besides being superfluous, the code was also producing false negatives as the list of trust anchors used is insufficent for verification, as correclty pointed out in curl#23311.
bagder
left a comment
There was a problem hiding this comment.
One has to love a good negative line count!
There was a problem hiding this comment.
🟡 Changes recommended
OCSP validation can be bypassed when peer verification is disabled or SecTrust replaces the GnuTLS result.
1 open finding
What changed in this PR
Simplifies GnuTLS OCSP handling by relying on built-in certificate verification and retaining only the stapled-response presence check.
Changes:
- Removes manual OCSP parsing, signature verification, and status handling.
- Checks only whether an OCSP response was received.
| File | Description |
|---|---|
lib/vtls/gtls.c |
Simplifies GnuTLS stapled OCSP validation. |
🧠 Review effort: Balanced
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
| if(ocsp_resp) | ||
| gnutls_ocsp_resp_deinit(ocsp_resp); | ||
| return result; | ||
| return CURLE_OK; |
There was a problem hiding this comment.
--insecure --cert-status is a pretty useless combination...
There was a problem hiding this comment.
We could make this combination fail, but if people want to shoot themselves in the foot...
There was a problem hiding this comment.
Hmm...I think our test for presence is good enough for such a case.

GnuTLS documents for gnutls_certificate_verify_peers2() that it already takes a received OCSP response into account. Therefore our own code needs only to check if a stapled OCSP response was receieved when verifystatus is requested.
Besides being superfluous, the code was also producing false negatives as the list of trust anchors used is insufficent for verification, as correclty pointed out in #23311.