-
Notifications
You must be signed in to change notification settings - Fork 532
RUBY-3694 Use correct CA when verifying OCSP endpoint (2.20.x) #2945
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 2.20-stable
Are you sure you want to change the base?
Conversation
* use the next cert in the chain as the CA when verifying OCSP * don't assume the issuer is at a particular position in the chain * Fix incorrect method description
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR is a backport to version 2.20.x that fixes OCSP verification when dealing with certificate chains longer than two elements. The issue was that the driver was incorrectly using the last certificate in the chain as the CA for OCSP verification, which works only for two-element chains but fails for longer chains.
- Implements proper issuer certificate lookup for OCSP verification
- Refactors DNS testing infrastructure to support Ruby 3.0+ requirements
- Updates CI configuration to use Ubuntu instead of RHEL and mongosh instead of mongo
Reviewed Changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
lib/mongo/socket/ssl.rb | Adds find_issuer method and fixes CA certificate selection for OCSP verification |
spec/integration/ocsp_verifier_spec.rb | Refactors OCSP test infrastructure and removes expired certificate tests |
spec/support/common_shortcuts.rb | Updates DNS mocking implementation to use Async properly |
spec/support/constraints.rb | Adds minimum_mri_version constraint helper |
spec/integration/*_spec.rb | Updates SRV-related specs to require Ruby 3.0+ for DNS mocking |
.evergreen/* | Updates CI configuration to use Ubuntu and mongosh |
Backport to 2.20.x
The driver was incorrectly using the last certificate in the chain as the CA when performing OCSP verification. This worked for the case where the chain had only two elements, but for longer chains, it was causing the verification to fail.
This change searches the cert chain for the issuer of the peer certificate, and uses that as the CA for the verification request.
Note: besides the fix described, the tests in the 2.20-stable branch were entirely broken---all of them failing---so the majority of the changes in this PR have turned out to be related to fixing or skipping tests. The meaningful change is in the
Mongo::Socket::SSL
class, here: https://github.com/mongodb/mongo-ruby-driver/pull/2945/files/fb48bb2899b22d2aa6b54da217ef45dd32740ac6#diff-cbf3617065668fb1d60c964cdff16bc2da1586476485bcf609d42e0303f3b389