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

Case-insensitive identity verification #463

Closed
baarde opened this issue May 14, 2024 · 2 comments · Fixed by #464
Closed

Case-insensitive identity verification #463

baarde opened this issue May 14, 2024 · 2 comments · Fixed by #464

Comments

@baarde
Copy link
Contributor

baarde commented May 14, 2024

RFC 5280 states that while uppercase and lowercase letters are allowed in domain names, no significance is attached to the case, meaning the case should be ignored when comparing domain names.

Most certificates don't have any uppercase letter in their domain name. But some do.

SwiftNIO SSL converts the server hostname to lowercase but doesn't convert the certificate's CN or SAN. Therefore, the domain name comparison always fails when the certificate has uppercase letters in its domain name.

Steps to reproduce

  • Copy cert.pem and key.pem to the current directory.

  • Run the server.

    swift run NIOTLSServer
  • Try to connect to the server.

    swift run NIOSSLHTTP1Client https://localhost:4433 cert.pem key.pem cert.pem

Expected result

A parsing error invalid constant string is thrown (the server is not a valid HTTP server).

Actual result

NIOSSLExtraError.failedToValidateHostname: Couldn't find localhost in certificate from peer is thrown.

@Lukasa
Copy link
Contributor

Lukasa commented May 15, 2024

This is a great catch, thanks. Are you interested in backporting your fix from swift-certificates? We're not cutting over to it immediately so it'd be nice to fix it in both places.

@baarde
Copy link
Contributor Author

baarde commented May 15, 2024

Yes. Here's the PR #464.

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 a pull request may close this issue.

2 participants