Check CRLs using a loop - #3496
Draft
nhatnghiho wants to merge 1 commit into
Draft
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3496 +/- ##
==========================================
+ Coverage 78.04% 78.33% +0.28%
==========================================
Files 700 700
Lines 124704 125659 +955
Branches 17323 17380 +57
==========================================
+ Hits 97331 98430 +1099
+ Misses 26505 26355 -150
- Partials 868 874 +6 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
|
🔒 Security Review — View Report Please review before merging. |
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.
Context and motivation
When checking for revoked certificates,
X509_verify_certselects a single "best" CRL (i.e. highest score) and checks the certificate only against that one. RFC 5280 §6.3.3 specifies checking the certificate against every applicable CRL. Under single-CRL selection, a revocation carried by a non-selected-but-valid CRL was silently missed, so a revoked certificate could verify asX509_V_OK.Description of changes
X509_verify_certnow checks a certificate against all valid CRLs, not just the single highest-scoring one. If the cert shows up in any of them, it's revoked. The loop bails out on the first CRL that lists it.When there's no fully valid CRL, it falls back to the best near-match so the error is still specific (expired, bad critical extension) instead of a generic
UNABLE_TO_GET_CRL. The best near-match CRL will be the one with the highest scores still. In case of a tie, the freshest CRL will be picked. In the case of no usable CRL at all, the function behaves exactly as before.Testing
New and updated unit tests in crypto/x509/x509_test.cc
Review considerations
X509_STORE_set_get_crlandX509_STORE_set_check_crllet a caller override how CRLs are fetched and validated — the hooks the old single-CRL path relied on. Both are already documented as do-not-use, have no downstream dependencies, and were removed by BoringSSL (8a0da66) as "impossible to use correctly" and the cause of "weird statefulness aroundctx->error_depth." This PR no longer routes verification through them. Deleting the API surface itself is a follow-up.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.