Skip to content

crypto/x509: AKI (Authority Key Id) exclusion logic is broken #62060

Description

@furkanmustafa

Fix for a previous issue #15194, in 2016, introduces a breaking change,
where AKIs suddenly stops appearing in created certificates after the
golang upgrade.

The main case for the original issue is probably not an issue for
actually self-signed certificates. But; the logic for excluding AKI
from output, instead of comparing KeyIds, it compares Subject(CN)s.

So if you use same CNs for a CA and a certificate to sign, the
signed certificate will not have AKI included, even though it is not
self-signed at all.

This change caused us quite a deal of confusion, and months of delay
for upgrading our tooling. Workaround wasn't obvious, we just tried
changing CN fields after so many things. And it just worked, which
confused us even more.

go version

1.7+

Does this issue reproduce with the latest release?

I believe so, but did not do a through testing.

What did you do?

The problem was observed when upgrading CFSSL from 1.2 to 1.6.
Which indicates this change in the README:158.

What did you expect to see?

AKI omission decision to be made by checking if KeyIds are actually same or not.

if len(parent.SubjectKeyId) > 0 && template.SubjectKeyId != parent.SubjectKeyId ...

What did you see instead?

to decide KeyId is same, comparison is done on Subject fields :(

if !bytes.Equal(asn1Issuer, asn1Subject) && len(parent.SubjectKeyId) > 0 ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions