Skip to content

v8: support X509Certificate serialization - #67083

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

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

Conversation

@panva

@panva panva commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

v8.serialize() currently rejects X509Certificate objects. Add a host object encoding containing the certificate's DER snapshot, including its issuerCertificate chain, and reconstruct fresh X509Certificate objects in v8.deserialize().

Read the stored snapshot rather than the cached raw Buffer, which can be modified by callers. Decode each certificate independently without imposing issuer relationships on the serialized sequence.

This is PR 3 out of 4 in an X.509 series addressing #48730 and #51169. (it can land independently of PR 2 https://github.com/proxy/redirect.github.com/nodejs/node/pull/67082)

v8.serialize() currently rejects X509Certificate objects. Add a host
object encoding containing the certificate's DER snapshot, including
its issuerCertificate chain, and reconstruct fresh X509Certificate
objects in v8.deserialize().

Read the stored snapshot rather than the cached raw Buffer, which can
be modified by callers. Decode each certificate independently without
imposing issuer relationships on the serialized sequence.

Assisted-by: Codex
Signed-off-by: Filip Skokan <panva.ip@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. typings Issues and PRs related to internal TypeScript declarations. v8 module Issues and PRs related to the node:v8 module. labels Oct 28, 2026
@panva
panva requested review from jasnell and pimterry October 28, 2026 13:54
@codecov

codecov Bot commented Oct 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 79.59184% with 30 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.65%. Comparing base (663f666) to head (586410f).
⚠️ Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
src/crypto/crypto_x509.cc 68.91% 10 Missing and 13 partials ⚠️
lib/internal/crypto/x509.js 75.00% 4 Missing ⚠️
lib/v8.js 94.73% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #67083      +/-   ##
==========================================
- Coverage   90.65%   90.65%   -0.01%     
==========================================
  Files         797      797              
  Lines      278593   278740     +147     
  Branches    53570    53610      +40     
==========================================
+ Hits       252561   252686     +125     
- Misses      16377    16383       +6     
- Partials     9655     9671      +16     
Files with missing lines Coverage Δ
src/crypto/crypto_x509.h 57.89% <ø> (+2.33%) ⬆️
lib/v8.js 98.42% <94.73%> (-0.37%) ⬇️
lib/internal/crypto/x509.js 95.77% <75.00%> (-0.77%) ⬇️
src/crypto/crypto_x509.cc 71.54% <68.91%> (+<0.01%) ⬆️

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

@panva panva added request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. and removed request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. labels Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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. typings Issues and PRs related to internal TypeScript declarations. v8 module Issues and PRs related to the node:v8 module.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants