Skip to content

tls: test the SPKI blocklist with a fixture key - #66949

Open
UlisesGascon wants to merge 1 commit into
nodejs:mainfrom
UlisesGascon:refactor/tls-spki-blocklist-fixture
Open

UlisesGascon wants to merge 1 commit into
nodejs:mainfrom
UlisesGascon:refactor/tls-spki-blocklist-fixture

Conversation

@UlisesGascon

Copy link
Copy Markdown
Member

Replace the test-only hooks on the crypto binding, and the process-wide list and mutex they required on every handshake, with a fixture CA whose public key is a permanent entry on the compiled-in blocklist. The test now exercises the real list through full handshakes, without --expose-internals, and the production path is a comparison against a constant array.

The new fixtures provide two chains that contain the blocked key: a server certificate issued by blocked-ca, and one issued by ca1 that reuses the blocked key itself. The private key is checked in like every other fixture key, so blocking it costs nothing. It is pinned in the fixtures Makefile, since its digest is compiled in.

Refs: #66871 (comment)
Assisted-by: Claude, Codex

Replace the test-only hooks on the crypto binding, and the process-wide
list and mutex they required on every handshake, with a fixture CA
whose public key is a permanent entry on the compiled-in blocklist. The
test now exercises the real list through full handshakes, without
--expose-internals, and the production path is a comparison against a
constant array.

The new fixtures provide two chains that contain the blocked key: a
server certificate issued by blocked-ca, and one issued by ca1 that
reuses the blocked key itself. The private key is checked in like every
other fixture key, so blocking it costs nothing. It is pinned in the
fixtures Makefile, since its digest is compiled in.

Refs: nodejs#66871 (comment)
Assisted-by: Claude, Codex
Signed-off-by: Ulises Gascon <ulisesgascongonzalez@gmail.com>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/crypto

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. crypto Issues and PRs related to the crypto subsystem. needs-ci PRs that need a full CI run. labels Oct 23, 2026
@UlisesGascon
UlisesGascon marked this pull request as ready for review October 23, 2026 09:47
Comment on lines +1438 to +1447
// Test fixture, not a real CA: test/fixtures/keys/blocked-ca-key.pem.
// Its private key is public, so blocking it costs nothing and lets
// test/parallel/test-tls-spki-blocklist.js exercise the real list. The
// key is pinned in the fixtures Makefile; rotating it means updating
// this entry too.
// a6cbb923961eada55c02f104681aeabe52ea1508ece2078aec11d00a5778ce71
// C=US, ST=CA, L=SF, O=Joyent, OU=Node.js, CN=blocked-ca
{0x41, 0xc2, 0xd1, 0xc4, 0x24, 0x68, 0x46, 0x6a, 0x54, 0x24, 0x83,
0x69, 0xf6, 0x65, 0x9a, 0x95, 0x52, 0xc5, 0xa4, 0x16, 0xf8, 0xd5,
0xfc, 0xd8, 0xdd, 0x55, 0xa8, 0x75, 0xd7, 0x20, 0xaa, 0xc2},

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

hey @pimterry! Not sure if this is the correct approach for the refactor, happy to explore other ideas 🤔

@codecov

codecov Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.59%. Comparing base (4c294b3) to head (a8a9ed9).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #66949      +/-   ##
==========================================
- Coverage   92.93%   90.59%   -2.34%     
==========================================
  Files         428      797     +369     
  Lines      195236   278292   +83056     
  Branches    30189    53509   +23320     
==========================================
+ Hits       181438   252115   +70677     
- Misses      13471    16555    +3084     
- Partials      327     9622    +9295     
Files with missing lines Coverage Δ
src/crypto/crypto_context.cc 71.96% <ø> (ø)
src/crypto/crypto_context.h 100.00% <ø> (ø)

... and 500 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pimterry pimterry 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.

Thanks! LGTM 👍

@pimterry pimterry added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Oct 23, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Oct 23, 2026
@panva panva added the author ready PRs with CI started, the required approvals, and no outstanding review comments. label Oct 23, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. c++ Issues and PRs that require attention from people who are familiar with C++. crypto Issues and PRs related to the crypto subsystem. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants