Skip to content

fix: enforce pathLenConstraint regardless of keyUsage extension#1142

Open
eddieran wants to merge 1 commit intodigitalbazaar:mainfrom
eddieran:fix/pathlen-constraint
Open

fix: enforce pathLenConstraint regardless of keyUsage extension#1142
eddieran wants to merge 1 commit intodigitalbazaar:mainfrom
eddieran:fix/pathlen-constraint

Conversation

@eddieran
Copy link
Copy Markdown

Summary

Fixes GHSA-h8mc-2r26-8398. This replaces #1141.

The pathLenConstraint check in verifyCertificateChain was gated on the keyUsage extension being present (keyUsageExt !== null). When a CA certificate omitted the keyUsage extension but included basicConstraints with a pathLenConstraint, the constraint was silently skipped — allowing certificate chains that exceeded the maximum permitted intermediate CA depth.

Changes

In lib/x509.js, the condition guarding the pathLenConstraint enforcement now checks for bcExt !== null instead of keyUsageExt !== null, so the constraint is enforced whenever basicConstraints is present, regardless of whether keyUsage is also present.

The pathLenConstraint check in the certificate chain validation was
gated on the keyUsage extension being present. When a CA certificate
omitted the keyUsage extension but included basicConstraints with a
pathLenConstraint, the constraint was silently skipped, allowing
chains that exceeded the maximum permitted depth.

Remove the keyUsage guard so pathLenConstraint is enforced whenever
basicConstraints is present.
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.

1 participant