Skip to content

crypto/x509: tighten up SAN criticality handling #79741

Description

@cpu

RFC 5280 §4.2.1.6 says:

If the subject field contains an empty sequence, then the issuing CA MUST include a
subjectAltName extension that is marked as critical. When including the
subjectAltName extension in a certificate that has a non-empty subject
distinguished name, conforming CAs SHOULD mark the subjectAltName extension as
non-critical.

The first MUST requirement is tested by the x509-limbo rfc5280::san::noncritical-with-empty-subject testcase, and the second SHOULD is tested by webpki::san::san-critical-with-nonempty-subject, where the baseline requirements §7.1.2.7.12 elevates this to a MUST NOT for non-criticality:

If the subject field of the certificate is an empty SEQUENCE, this extension
MUST be marked critical, as specified in RFC 5280, Section 4.2.1.6. Otherwise,
this extension MUST NOT be marked critical.

Go crypto/x509 should enforce these requirements when verifying a leaf certificate so that the x509-limbo test cases produce the expected results.

The x509.CreateCertificate function already handles SAN criticality correctly when producing certificates.

Relates to #65085 https://go-review.googlesource.com/c/go/+/783980

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugReportIssues describing a possible bug in the Go implementation.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions