Skip to content

crypto: improve native error handling and key synchronization - #64851

Closed
panva wants to merge 4 commits into
nodejs:mainfrom
panva:fixes-src
Closed

crypto: improve native error handling and key synchronization#64851
panva wants to merge 4 commits into
nodejs:mainfrom
panva:fixes-src

Conversation

@panva

Copy link
Copy Markdown
Member

3 improvements in src/crypto

  • report DH failures instead of aborting or returning an empty secret
  • create KeyObjectData mutex before sharing key data so every copy uses one lock
  • return an operation error when XOF output allocation fails

panva added 3 commits July 30, 2026 22:04
Report DH failures instead of aborting or returning an empty secret.
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
Create the mutex before sharing key data so every copy uses one lock.
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
Return an operation error when XOF output allocation fails.
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
@panva
panva requested review from anonrig and jasnellJuly 30, 2026 20:13
@panvapanva 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-botnodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Jul 30, 2026
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
@panvapanva added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jul 30, 2026
@nodejs-github-bot

This comment was marked as outdated.

@codecov

codecovBot commented Jul 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 31.57895% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.16%. Comparing base (e7904d4) to head (a103304).
⚠️ Report is 12 commits behind head on main.

Files with missing linesPatch %Lines
src/crypto/crypto_dh.cc0.00%4 Missing and 3 partials ⚠️
src/crypto/crypto_turboshake.cc25.00%4 Missing and 2 partials ⚠️
Additional details and impacted files
@@ Coverage Diff @@## main #64851 +/- ##
==========================================
+ Coverage 90.14% 90.16% +0.01% 
==========================================
Files 746 746 Lines 242764 242773 +9 Branches 45739 45767 +28 ==========================================
+ Hits 218848 218889 +41 + Misses 15426 15365 -61 - Partials 8490 8519 +29 
Files with missing linesCoverage Δ
src/crypto/crypto_keys.cc70.77% <100.00%> (+0.06%)⬆️
src/crypto/crypto_turboshake.cc79.94% <25.00%> (-1.33%)⬇️
src/crypto/crypto_dh.cc65.97% <0.00%> (-1.20%)⬇️

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

This comment was marked as outdated.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@panvapanva added the commit-queue Add this label to land a pull request using GitHub Actions. label Jul 31, 2026
@nodejs-github-botnodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Aug 1, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in a4aa3c0...f9e21ae

nodejs-github-bot pushed a commit that referenced this pull request Aug 1, 2026
Report DH failures instead of aborting or returning an empty secret.
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: #64851
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
nodejs-github-bot pushed a commit that referenced this pull request Aug 1, 2026
Create the mutex before sharing key data so every copy uses one lock.
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: #64851
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
nodejs-github-bot pushed a commit that referenced this pull request Aug 1, 2026
Return an operation error when XOF output allocation fails.
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: #64851
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@panva
panva deleted the fixes-src branch August 1, 2026 20:40
aduh95 pushed a commit that referenced this pull request Aug 3, 2026
Report DH failures instead of aborting or returning an empty secret.
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: #64851
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
aduh95 pushed a commit that referenced this pull request Aug 3, 2026
Create the mutex before sharing key data so every copy uses one lock.
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: #64851
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
aduh95 pushed a commit that referenced this pull request Aug 3, 2026
Return an operation error when XOF output allocation fails.
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: #64851
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
aduh95 pushed a commit that referenced this pull request Aug 4, 2026
Report DH failures instead of aborting or returning an empty secret.
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: #64851
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
aduh95 pushed a commit that referenced this pull request Aug 4, 2026
Create the mutex before sharing key data so every copy uses one lock.
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: #64851
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
aduh95 pushed a commit that referenced this pull request Aug 4, 2026
Return an operation error when XOF output allocation fails.
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: #64851
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
aduh95 pushed a commit that referenced this pull request Aug 4, 2026
Report DH failures instead of aborting or returning an empty secret.
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: #64851
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
aduh95 pushed a commit that referenced this pull request Aug 4, 2026
Create the mutex before sharing key data so every copy uses one lock.
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: #64851
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
aduh95 pushed a commit that referenced this pull request Aug 4, 2026
Return an operation error when XOF output allocation fails.
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: #64851
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
aduh95 pushed a commit that referenced this pull request Aug 5, 2026
Report DH failures instead of aborting or returning an empty secret.
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: #64851
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
aduh95 pushed a commit that referenced this pull request Aug 5, 2026
Create the mutex before sharing key data so every copy uses one lock.
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: #64851
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
aduh95 pushed a commit that referenced this pull request Aug 5, 2026
Return an operation error when XOF output allocation fails.
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: #64851
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
panva added a commit to panva/node that referenced this pull request Aug 6, 2026
Return an operation error when XOF output allocation fails.
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: nodejs#64851
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@panvapanva added the backport-open-v24.x Indicate that the PR has an open backport label Aug 6, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.backport-open-v24.xIndicate that the PR has an open backportc++Issues and PRs that require attention from people who are familiar with C++.commit-queue-rebaseAdd this label to allow the Commit Queue to land a PR in several commits.lib / srcIssues and PRs related to general changes in the lib or src directory.needs-ciPRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@panva@nodejs-github-bot@jasnell@lpinca