Skip to content

Perf thumbprint caching chain builder - #131

Open
aww-aww wants to merge 12 commits into
PeculiarVentures:masterfrom
aww-aww:perf-thumbprint-caching-chain-builder-4137949091359479031
Open

Perf thumbprint caching chain builder#131
aww-aww wants to merge 12 commits into
PeculiarVentures:masterfrom
aww-aww:perf-thumbprint-caching-chain-builder-4137949091359479031

Conversation

@aww-aww

@aww-aww aww-aww commented Mar 24, 2026

Copy link
Copy Markdown
Contributor

Improve performance by adding a thumbprint cache.

google-labs-jules Bot and others added 12 commits February 6, 2026 17:09
- Add checks in `findIssuer` to verify that the issuer has `BasicConstraints: cA=true` (if extension present).
- Add checks in `findIssuer` to verify that the issuer has `KeyUsage: keyCertSign` (if extension present).
- Add regression test `test/chain_validation.ts`.

This fixes a vulnerability where invalid chains could be constructed using end-entity certificates as CAs.

Co-authored-by: aww-aww <2776327+aww-aww@users.noreply.github.com>
…serial-14597853205968635182

Add test for duplicate serial number in X509CrlGenerator
…ss-8423052248416536031

🛡️ Sentinel: [CRITICAL/HIGH] Fix X.509 Chain Validation Bypass
Added a new test suite in `test/utils.ts` to verify the behavior of `generateCertificateSerialNumber`.
Specifically covers:
- Prepending 0x00 when the MSB is set.
- Removal of leading zeros.
- Random generation for empty inputs.

Co-authored-by: aww-aww <2776327+aww-aww@users.noreply.github.com>
Added comprehensive tests for X509Crl, X509CrlEntry, and X509CrlGenerator classes.
This increases coverage for src/x509_crl.ts from 59% to 92% and src/x509_crl_entry.ts from 76% to 95%.

Co-authored-by: aww-aww <2776327+aww-aww@users.noreply.github.com>
…9138447

Improve test coverage for CRL classes
…8446484901

test: add missing tests for generateCertificateSerialNumber MSB padding
…n X509ChainBuilder

According to RFC 5280 section 4.2.1.9, the basic constraints extension MUST appear as a critical extension in all CA certificates.
Previously, `X509ChainBuilder` would bypass the `ca` boolean check if the `BasicConstraints` extension was completely missing, allowing non-CA End Entity certificates to be improperly treated as CAs when building chains.
This patch strictly enforces that Version 3 certificates MUST contain the `BasicConstraints` extension with `ca = true` to act as a valid issuer in a certification path. Tests have been added and existing mock certificates have been updated to properly issue `BasicConstraints` where appropriate.

Co-authored-by: aww-aww <2776327+aww-aww@users.noreply.github.com>
…traints-4704870714358861626

Enforce BasicConstraints for V3 CA certificates in X509ChainBuilder
- Implement internal caching for `X509Certificate.getThumbprint()` to avoid redundant cryptographic digest operations.
- Optimize `X509ChainBuilder.build()` to use a `Set` of hex-encoded thumbprints for circular dependency detection, reducing complexity from O(N^2) to O(N).

Co-authored-by: aww-aww <2776327+aww-aww@users.noreply.github.com>
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