Skip to content

crypto: improve argument validation and error messages - #64852

Open
panva wants to merge 4 commits into
nodejs:mainfrom
panva:fixes-lib
Open

crypto: improve argument validation and error messages#64852
panva wants to merge 4 commits into
nodejs:mainfrom
panva:fixes-lib

Conversation

@panva

@panva panva commented Jul 30, 2026

Copy link
Copy Markdown
Member
  • Report the correct parameter name for invalid optional inputs in parseKeyEncoding.
  • Reject null options with ERR_INVALID_ARG_TYPE in generateKeyPair(Sync).
  • Avoid a second native call when reading the issuer certificate in X509Certificate.
  • Explain that a cipher is required when a passphrase is provided in parseKeyEncoding.

panva added 4 commits July 30, 2026 22:15
Report the correct parameter name for invalid optional inputs.

Signed-off-by: Filip Skokan <panva.ip@gmail.com>
Reject null options with ERR_INVALID_ARG_TYPE.

Signed-off-by: Filip Skokan <panva.ip@gmail.com>
Avoid a second native call when reading the issuer certificate.

Signed-off-by: Filip Skokan <panva.ip@gmail.com>
Explain that a cipher is required when a passphrase is provided.

Signed-off-by: Filip Skokan <panva.ip@gmail.com>
@panva
panva requested review from anonrig and jasnell July 30, 2026 20:22
@panva panva added the commit-queue-rebase Add this label to allow the Commit Queue to land a PR in several commits. label Jul 30, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/crypto

@nodejs-github-bot nodejs-github-bot added crypto Issues and PRs related to the crypto subsystem. needs-ci PRs that need a full CI run. labels Jul 30, 2026
@panva panva added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Jul 30, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jul 30, 2026
@nodejs-github-bot

This comment was marked as outdated.

@codecov

codecov Bot commented Jul 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.16%. Comparing base (e7904d4) to head (3eebfb7).
⚠️ Report is 12 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #64852      +/-   ##
==========================================
+ Coverage   90.14%   90.16%   +0.02%     
==========================================
  Files         746      746              
  Lines      242764   242762       -2     
  Branches    45739    45761      +22     
==========================================
+ Hits       218848   218895      +47     
+ Misses      15426    15332      -94     
- Partials     8490     8535      +45     
Files with missing lines Coverage Δ
lib/internal/crypto/argon2.js 98.70% <100.00%> (ø)
lib/internal/crypto/keygen.js 93.49% <100.00%> (ø)
lib/internal/crypto/keys.js 97.84% <100.00%> (+<0.01%) ⬆️
lib/internal/crypto/x509.js 91.70% <100.00%> (ø)

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

@nodejs-github-bot

This comment was marked as outdated.

@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 that have at least one approval, no pending requests for changes, and a CI started. commit-queue-rebase Add this label to allow the Commit Queue to land a PR in several commits. 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.

3 participants