Skip to content

crypto: align verifyOneShot accepted types#63280

Merged
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
Anshikakalpana:crypto-verify-types-fix
May 19, 2026
Merged

crypto: align verifyOneShot accepted types#63280
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
Anshikakalpana:crypto-verify-types-fix

Conversation

@Anshikakalpana
Copy link
Copy Markdown
Contributor

@Anshikakalpana Anshikakalpana commented May 13, 2026

Align crypto.verify() accepted types with crypto.sign()

crypto.sign() accepts ArrayBuffer and SharedArrayBuffer for data, but crypto.verify() rejected them with ERR_INVALID_ARG_TYPE. Two issues in verifyOneShot():

  1. A redundant isArrayBufferView(data) check after getArrayBufferOrView() was incorrectly rejecting ArrayBuffer and SharedArrayBuffer — getArrayBufferOrView() already handles validation and normalization.

  2. signature had only an isArrayBufferView() check with no prior getArrayBufferOrView() call, so ArrayBuffer and SharedArrayBuffer were rejected there too.

Fix both by aligning verifyOneShot() with the signOneShot() pattern. Update docs and add test coverage for the affected types.

Fixes: #62903

@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 May 13, 2026
@Anshikakalpana Anshikakalpana force-pushed the crypto-verify-types-fix branch from 4e06ba8 to 994a54a Compare May 13, 2026 08:43
Signed-off-by: anshikakalpana <anshikajain196872@gmail.com>
@Anshikakalpana Anshikakalpana force-pushed the crypto-verify-types-fix branch from 994a54a to 08427d7 Compare May 13, 2026 09:18
@panva panva added commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. labels May 13, 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 May 13, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label May 13, 2026
@nodejs-github-bot

This comment was marked as outdated.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.05%. Comparing base (c363bec) to head (08427d7).
⚠️ Report is 58 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #63280      +/-   ##
==========================================
+ Coverage   90.03%   90.05%   +0.01%     
==========================================
  Files         714      714              
  Lines      225242   225228      -14     
  Branches    42579    42569      -10     
==========================================
+ Hits       202804   202820      +16     
+ Misses      14238    14174      -64     
- Partials     8200     8234      +34     
Files with missing lines Coverage Δ
lib/internal/crypto/sig.js 98.45% <100.00%> (+2.00%) ⬆️

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

@aduh95 aduh95 added the commit-queue Add this label to land a pull request using GitHub Actions. label May 19, 2026
@nodejs-github-bot nodejs-github-bot added commit-queue-failed An error occurred while landing this pull request using GitHub Actions. and removed commit-queue Add this label to land a pull request using GitHub Actions. labels May 19, 2026
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

Commit Queue failed
- Loading data for nodejs/node/pull/63280
✔  Done loading data for nodejs/node/pull/63280
----------------------------------- PR info ------------------------------------
Title      crypto: align verifyOneShot accepted types (#63280)
Author     Anshika Jain <anshikajain196872@gmail.com> (@Anshikakalpana)
Branch     Anshikakalpana:crypto-verify-types-fix -> nodejs:main
Labels     crypto, author ready, needs-ci, commit-queue-squash
Commits    1
 - crypto: align verifyOneShot accepted types
Committers 1
 - anshikakalpana <anshikajain196872@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/63280
Fixes: https://github.com/nodejs/node/issues/62903
Fixes: https://github.com/nodejs/node/pull/63268
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/63280
Fixes: https://github.com/nodejs/node/issues/62903
Fixes: https://github.com/nodejs/node/pull/63268
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
--------------------------------------------------------------------------------
   ℹ  This PR was created on Wed, 13 May 2026 08:31:29 GMT
   ✔  Approvals: 2
   ✔  - Filip Skokan (@panva) (TSC): https://github.com/nodejs/node/pull/63280#pullrequestreview-4280400076
   ✔  - Antoine du Hamel (@aduh95) (TSC): https://github.com/nodejs/node/pull/63280#pullrequestreview-4319982878
   ✔  Last GitHub CI successful
   ℹ  Last Full PR CI on 2026-05-15T21:29:34Z: https://ci.nodejs.org/job/node-test-pull-request/73478/
- Querying data for job/node-test-pull-request/73478/
✔  Build data downloaded
   ✔  Last Jenkins CI successful
--------------------------------------------------------------------------------
   ✔  No git cherry-pick in progress
   ✔  No git am in progress
   ✔  No git rebase in progress
--------------------------------------------------------------------------------
- Bringing origin/main up to date...
From https://github.com/nodejs/node
 * branch                  main       -> FETCH_HEAD
   216718affc..f352556da8  main       -> origin/main
✔  origin/main is now up-to-date
main is out of sync with origin/main. Mismatched commits:
 - ec139d19a4 stream: disallow writing string chunk with 'buffer' encoding
 - f352556da8 stream: disallow writing string chunk with 'buffer' encoding
--------------------------------------------------------------------------------
HEAD is now at f352556da8 stream: disallow writing string chunk with 'buffer' encoding
   ✔  Reset to origin/main
- Downloading patch for 63280
From https://github.com/nodejs/node
 * branch                  refs/pull/63280/merge -> FETCH_HEAD
✔  Fetched commits as 2ebf53330dde..08427d738ec9
--------------------------------------------------------------------------------
[main 91d66a655a] crypto: align verifyOneShot accepted types
 Author: anshikakalpana <anshikajain196872@gmail.com>
 Date: Wed May 13 00:17:20 2026 +0530
 3 files changed, 42 insertions(+), 20 deletions(-)
   ✔  Patches applied
--------------------------------------------------------------------------------
--------------------------------- New Message ----------------------------------
crypto: align verifyOneShot accepted types

Signed-off-by: anshikakalpana <anshikajain196872@gmail.com>
PR-URL: #63280
Fixes: #62903
Fixes: #63268
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>

[main 5d9221f3a6] crypto: align verifyOneShot accepted types
Author: anshikakalpana <anshikajain196872@gmail.com>
Date: Wed May 13 00:17:20 2026 +0530
3 files changed, 42 insertions(+), 20 deletions(-)
✖ 5d9221f3a6acea407dec4c0d014288cab60f4bd0
✔ 0:0 no Assisted-by metadata assisted-by-is-trailer
✔ 0:0 no Co-authored-by metadata co-authored-by-is-trailer
✔ 3:7 Valid fixes URL. fixes-url
✖ 4:7 Pull request URL must reference a comment or discussion. fixes-url
✔ 0:0 blank line after title line-after-title
✔ 0:0 line-lengths are valid line-length
✔ 0:0 metadata is at end of message metadata-end
✔ 2:8 PR-URL is valid. pr-url
✔ 0:0 reviewers are valid reviewers
✔ 0:0 has valid Signed-off-by signed-off-by
✔ 0:0 valid subsystems subsystem
✔ 0:0 Title is formatted correctly. title-format
✔ 0:0 Title is <= 50 columns. title-length

ℹ Please fix the commit message and try again.
Please manually ammend the commit message, by running
git commit --amend
Once commit message is fixed, finish the landing command running
git node land --continue

https://github.com/nodejs/node/actions/runs/26108465715

@aduh95 aduh95 added commit-queue Add this label to land a pull request using GitHub Actions. and removed commit-queue-failed An error occurred while landing this pull request using GitHub Actions. labels May 19, 2026
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label May 19, 2026
@nodejs-github-bot nodejs-github-bot merged commit 7acaa0f into nodejs:main May 19, 2026
94 of 95 checks passed
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

Landed in 7acaa0f

aduh95 pushed a commit that referenced this pull request May 19, 2026
Signed-off-by: anshikakalpana <anshikajain196872@gmail.com>
PR-URL: #63280
Fixes: #62903
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
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-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. 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.

crypto.verify accepted types mismatch documentation (and crypto.sign)

4 participants