Skip to content

crypto: improve accuracy of SubtleCrypto.supports#63104

Open
panva wants to merge 4 commits intonodejs:mainfrom
panva:subtle-supports-derive-bits
Open

crypto: improve accuracy of SubtleCrypto.supports#63104
panva wants to merge 4 commits intonodejs:mainfrom
panva:subtle-supports-derive-bits

Conversation

@panva
Copy link
Copy Markdown
Member

@panva panva commented May 3, 2026

This improves the accuracy of SubtleCrypto.supports() by checking the shared secret output from an ECDH (or ECDH-like) algorithm covers the requested/resolved length.

Signed-off-by: Filip Skokan <panva.ip@gmail.com>
@panva panva added crypto Issues and PRs related to the crypto subsystem. experimental Issues and PRs related to experimental features. webcrypto labels May 3, 2026
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/crypto

@nodejs-github-bot nodejs-github-bot added the needs-ci PRs that need a full CI run. label May 3, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.66%. Comparing base (25f80fb) to head (f1cbedb).
⚠️ Report is 13 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #63104   +/-   ##
=======================================
  Coverage   89.65%   89.66%           
=======================================
  Files         712      712           
  Lines      220822   220843   +21     
  Branches    42373    42381    +8     
=======================================
+ Hits       197985   198019   +34     
+ Misses      14661    14641   -20     
- Partials     8176     8183    +7     
Files with missing lines Coverage Δ
lib/internal/crypto/webcrypto.js 96.66% <100.00%> (+0.02%) ⬆️

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

Comment thread test/fixtures/webcrypto/supports-level-2.mjs
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
try {
return check(operation, algorithm, length);
} catch {
return false;
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.

Not a huge fan of suppressing errors like this. If this is part of the spec that this method should not throw, a comment here would be good.

@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 May 4, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label May 4, 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 that have at least one approval, no pending requests for changes, and a CI started. crypto Issues and PRs related to the crypto subsystem. experimental Issues and PRs related to experimental features. needs-ci PRs that need a full CI run. webcrypto

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants