Skip to content

crypto: add X509Certificate inspection getters - #67082

Open
panva wants to merge 1 commit into
nodejs:mainfrom
panva:x509-inspection
Open

panva wants to merge 1 commit into
nodejs:mainfrom
panva:x509-inspection

Conversation

@panva

@panva panva commented Oct 28, 2026

Copy link
Copy Markdown
Member

Expose version, subjectName, issuerName, extensions, tbs, and signature without requiring callers to parse display strings or certificate DER.

Names include complete DER and grouped, ordered RDN attributes. Extensions retain their order, duplicate and unknown OIDs, criticality, and raw values. Expose the exact signed TBSCertificate bytes and the signature octets, algorithm OID, and DER parameters.

Return fresh objects, arrays, and Buffers from the new getters, leaving existing getter caching unchanged. Report inspection failures as ERR_CRYPTO_INVALID_X509_CERTIFICATE.

This is PR 2 out of 4 in an X.509 series addressing #48730 and #51169.

Expose version, subjectName, issuerName, extensions, tbs, and signature
without requiring callers to parse display strings or certificate DER.

Names include complete DER and grouped, ordered RDN attributes.
Extensions retain their order, duplicate and unknown OIDs, criticality,
and raw values. Expose the exact signed TBSCertificate bytes and the
signature octets, algorithm OID, and DER parameters.

Return fresh objects, arrays, and Buffers from the new getters, leaving
existing getter caching unchanged. Report inspection failures as
ERR_CRYPTO_INVALID_X509_CERTIFICATE.

Fixes: nodejs#48730
Assisted-by: Codex
Signed-off-by: Filip Skokan <[email protected]>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/crypto
  • @nodejs/security-wg

@nodejs-github-bot nodejs-github-bot added lib / src Issues and PRs involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run. labels Oct 28, 2026
@panva
panva requested review from jasnell and pimterry October 28, 2026 13:53
@codecov

codecov Bot commented Oct 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 73.43750% with 85 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.62%. Comparing base (663f666) to head (18485ec).
⚠️ Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
src/crypto/crypto_x509.cc 69.09% 27 Missing and 58 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #67082      +/-   ##
==========================================
- Coverage   90.65%   90.62%   -0.04%     
==========================================
  Files         797      797              
  Lines      278593   278916     +323     
  Branches    53570    53655      +85     
==========================================
+ Hits       252561   252756     +195     
- Misses      16377    16440      +63     
- Partials     9655     9720      +65     
Files with missing lines Coverage Δ
lib/internal/crypto/x509.js 96.84% <100.00%> (+0.29%) ⬆️
lib/internal/errors.js 98.81% <100.00%> (+<0.01%) ⬆️
src/crypto/crypto_x509.h 65.21% <100.00%> (+9.66%) ⬆️
src/crypto/crypto_x509.cc 70.97% <69.09%> (-0.57%) ⬇️

... and 33 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.

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

Labels

lib / src Issues and PRs involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants