Skip to content

x509: fix handling of multiple URIs in Certificate#crl_uris - #776

Merged
rhenium merged 2 commits into
ruby:maint-3.0from
rhenium:ky/x509cert-crl_uris-fix-nil
Oct 31, 2024
Merged

rhenium merged 2 commits into
ruby:maint-3.0from
rhenium:ky/x509cert-crl_uris-fix-nil

Conversation

@rhenium

@rhenium rhenium commented Jul 9, 2024

Copy link
Copy Markdown
Member

The implementation of OpenSSL::X509::Certificate#crl_uris makes the assumption that each DistributionPoint in the CRL distribution points extension contains a single general name of type URI. This is not guaranteed by RFC 5280. A DistributionPoint may only contains something other than a URI, or more than one URI.

Let's include all URIs seen in the extension. If only non-URI pointers are found, return an empty array.

Fixes: #775

@rhenium

rhenium commented Jul 9, 2024

Copy link
Copy Markdown
Member Author

cc: @bdewater, #275

This PR currently returns an empty array when the certificate includes the extension, but no URIs in it. Should it be nil in that case too?

test_extesion is testing too many features at once and is hard to
navigate. Let's split each chunk apart for more clarity.
@rhenium
rhenium force-pushed the ky/x509cert-crl_uris-fix-nil branch from 5fe29a3 to 342f5bd Compare July 9, 2024 13:39
@rhenium
rhenium changed the base branch from master to maint-3.0 July 9, 2024 13:39
@bdewater

Copy link
Copy Markdown
Contributor

I think that'd be nice since an empty array is a bit useless otherwise.

The implementation of OpenSSL::X509::Certificate#crl_uris makes the
assumption that each DistributionPoint in the CRL distribution points
extension contains a single general name of type URI. This is not
guaranteed by RFC 5280. A DistributionPoint may contain zero or more
than one URIs.

Let's include all URIs found in the extension. If only non-URI pointers
are found, return nil.

Fixes: ruby#775
@rhenium
rhenium force-pushed the ky/x509cert-crl_uris-fix-nil branch from 342f5bd to 71f4fef Compare August 16, 2024 06:05
@rhenium

rhenium commented Aug 16, 2024

Copy link
Copy Markdown
Member Author

Fair enough. I changed it to return nil if the extension contains only non-URIs.

@rhenium
rhenium merged commit bd4c0a9 into ruby:maint-3.0 Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Certificate#crl_uris throws exception "undefined method `value' for nil (NoMethodError)"

2 participants