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

Stop using commonName to validate certificates. #238

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Lukasa
Copy link
Contributor

@Lukasa Lukasa commented Aug 14, 2020

Motivation:

CommonName as part of certificate hostname verification has been
deprecated for more than two decades. Browsers have finally stopped
using the commonName as part of verification, and the WebPKI forbids
putting names into the commonName that are not also part of the
subjectAlternativeName extension.

Continuing to trust the commonName as part of the certificate hostname
will put us in a weaker position than most of the browser ecosystem.
That's not a good place to be, so we should flip our default to not
trusting the commonName any longer.

For pragmatic reasons, we do allow an override, but the default
configuration is off. Users using this override will likely find
themselves disappointed when we remove it at some point in the future.

Modifications:

  • Added TLSConfiguration options to enable trusting commonName fields
    for hostname verification.
  • Made investigating the commonName field optional during hostname
    verification.
  • Tests to validate the new behaviour.

Result:

No trusting common names by default anymore.

@Lukasa Lukasa added the semver/minor Adds new public API. label Aug 14, 2020
Copy link
Contributor

@glbrntt glbrntt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@Lukasa Lukasa changed the base branch from master to main September 24, 2020 14:55
@glbrntt
Copy link
Contributor

glbrntt commented Sep 30, 2020

@swift-nio-bot test this please

Copy link
Contributor

@PeterAdams-A PeterAdams-A left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should do this - anyone that's using functionality which has been deprecated for 20 years should probably invest the time to move on.

/// name fields. For this reason, we currently allow an override for trusting the common name. This
/// is a temporary measure to allow users to work around these limitations, but we will remove this
/// functionality in future.
public var trustCommonName: Bool
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we (assuming it's possible) mark the setter for this as deprecated right from the start?

Motivation:

CommonName as part of certificate hostname verification has been
deprecated for more than two decades. Browsers have finally stopped
using the commonName as part of verification, and the WebPKI forbids
putting names into the commonName that are not also part of the
subjectAlternativeName extension.

Continuing to trust the commonName as part of the certificate hostname
will put us in a weaker position than most of the browser ecosystem.
That's not a good place to be, so we should flip our default to not
trusting the commonName any longer.

For pragmatic reasons, we do allow an override, but the default
configuration is off. Users using this override will likely find
themselves disappointed when we remove it at some point in the future.

Modifications:

- Added TLSConfiguration options to enable trusting commonName fields
  for hostname verification.
- Made investigating the commonName field optional during hostname
  verification.
- Tests to validate the new behaviour.

Result:

No trusting common names by default anymore.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver/minor Adds new public API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants