Skip to content
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

RUBY-3497: Use leaf cert instead of last one in verify_ocsp_endpoint #2876

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/mongo/socket/ssl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,9 @@ def verify_ocsp_endpoint!(socket)
end

cert = socket.peer_cert
ca_cert = socket.peer_cert_chain.last
# In the case where the leaf certificate and CA are the same, the chain may only contain one certificate.
# If the chain has multiple certificates, the one directly after the leaf should be the issuer.
ca_cert = socket.peer_cert_chain.length > 1 ? socket.peer_cert_chain[1] : cert

verifier = OcspVerifier.new(@host_name, cert, ca_cert, context.cert_store,
**Utils.shallow_symbolize_keys(options))
Expand Down
Loading