Add lint to check for correct DER encoding of the cA field in BasicConstraints#1006
Merged
Conversation
Added //nolint:all to comment block to avoid golangci-lint to complain about duplicate words in comment
Fixed import block
Fine to me. Co-authored-by: Christopher Henderson <chris@chenderson.org>
As per Chris Henderson's suggestion, to "improve readability".
As per Chris Henderson's suggestion.
Added CABFEV_Sec9_2_8_Date
christopher-henderson
approved these changes
Nov 22, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

The lint I am proposing here checks that the
BasicConstraintsextension, if present in a certificate, does not contain an explicit FALSE value in itscAfield, as that value is the DEFAULT (per RFC5280) and in such a case the field must be omitted altogether (per the ASN.1 Distinguished Eencoding Rules). I stumbled by chance upon a few certificates with this defect and I realized that ZLint does not currently detect it, so I thought it was desirable to fill the gap.There are only 5 certificates in the TestCorpus that fail this lint, all very old, but there apparently exist other certificates in the wild (hopefully just a few) with the same problem and recently issued.