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

Raise a CertificateError if the certificate has no subjectAltName. #66

Closed
adiroiban opened this issue Jan 7, 2024 · 5 comments · Fixed by #67
Closed

Raise a CertificateError if the certificate has no subjectAltName. #66

adiroiban opened this issue Jan 7, 2024 · 5 comments · Fixed by #67

Comments

@adiroiban
Copy link
Contributor

I have created this ticket to start a conversion.

Feel free to close it if you think this is not an issue.

This ticket is triggerd by the converstation from twisted/twisted#12074

It looks like if the server certificate has no subjectAltName, the verification will fail but the error is

<class 'service_identity.exceptions.VerificationError'>: VerificationError(errors=[DNSMismatch(mismatched_id=DNS_ID(hostname=b'default'))])

It's not very obvious that the issue is misisng subjectAltName

This is related to the change from here

https://github.com/pyca/service-identity/pull/52/files#diff-bf6d1c4ec44ff09a085657cc5b75da153a8cd025b8c72d4bd77d79e44cead072L144

In PR #52, if the certificate has no subjectAltName it is handled as a valid certificate without any match.

Maybe, a CertificateError('Certificate without subjectAltName.') exception should be raised.

Thanks

@hynek
Copy link
Collaborator

hynek commented Jan 13, 2024

Wouldn’t that be a breaking change?

@adiroiban
Copy link
Contributor Author

I think it would be a breaking change that people want :)

Rather than a "silent" error about no match, I think that you want an error about the certificat not having a SAN .

As an application developer, I want to present users with meaningful / actionable error messages.
With the current code, I need to always run a separate check to see if the certificat has a SAN and raise a different error.

@hynek
Copy link
Collaborator

hynek commented Jan 13, 2024

How about a compromise: NoSubjectAltNameFoundError(VerificationError)? Should be 100% backwards-compatible?

@hynek
Copy link
Collaborator

hynek commented Jan 13, 2024

no, wait I spoke to soon. that doesn't work with our multiple errors.

@hynek
Copy link
Collaborator

hynek commented Jan 13, 2024

Like and subscribe #67

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants