Skip to content

Add lint to check for correct DER encoding of the cA field in BasicConstraints#1006

Merged
christopher-henderson merged 48 commits into
zmap:masterfrom
defacto64:master
Nov 22, 2025
Merged

Add lint to check for correct DER encoding of the cA field in BasicConstraints#1006
christopher-henderson merged 48 commits into
zmap:masterfrom
defacto64:master

Conversation

@defacto64

Copy link
Copy Markdown
Contributor

The lint I am proposing here checks that the BasicConstraints extension, if present in a certificate, does not contain an explicit FALSE value in its cA field, 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.

defacto64 and others added 30 commits March 8, 2024 16:07
Added //nolint:all to comment block to avoid golangci-lint to complain about duplicate words in comment
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 christopher-henderson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There are only 5 certificates in the TestCorpus that fail this lint, all very old

image

This is a clean lint, thank you!

Especially for putting in the work to bypass the x509s tendency to throw away is present information (wrangling raw ASN.1 is not fun unless you do it frequently).

@christopher-henderson christopher-henderson merged commit 8be747f into zmap:master Nov 22, 2025
4 checks passed
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 this pull request may close these issues.

2 participants