Skip to content

crypto: runtime-deprecate calling Hmac.digest() more than once (DEP0206)#63162

Open
Anshikakalpana wants to merge 1 commit intonodejs:mainfrom
Anshikakalpana:hmac-runtime-dep-0206
Open

crypto: runtime-deprecate calling Hmac.digest() more than once (DEP0206)#63162
Anshikakalpana wants to merge 1 commit intonodejs:mainfrom
Anshikakalpana:hmac-runtime-dep-0206

Conversation

@Anshikakalpana
Copy link
Copy Markdown
Contributor

Refs: #62838
Refs: #63121

Situation

Calling digest() on an already-finalized Hmac instance currently returns an empty buffer silently instead of throwing an error. This is inconsistent with Hash behavior which throws ERR_CRYPTO_HASH_FINALIZED and is a potential security footgun.

Change

Add a runtime deprecation warning (DEP0206) when digest() is called more than once on an Hmac instance. The existing behavior (returning an empty buffer) is preserved during the deprecation cycle to avoid breaking changes. docs-only deprecation was introduced in #63121.

@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/crypto
  • @nodejs/userland-migrations

@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 6, 2026
@Anshikakalpana Anshikakalpana force-pushed the hmac-runtime-dep-0206 branch 3 times, most recently from c26a78a to 096abf3 Compare May 6, 2026 20:11
Signed-off-by: anshikakalpana <anshikajain196872@gmail.com>
@Anshikakalpana Anshikakalpana force-pushed the hmac-runtime-dep-0206 branch from 096abf3 to b7bc8a8 Compare May 6, 2026 21:18
@codecov
Copy link
Copy Markdown

codecov Bot commented May 6, 2026

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #63162      +/-   ##
==========================================
- Coverage   90.04%   90.04%   -0.01%     
==========================================
  Files         713      713              
  Lines      224484   224505      +21     
  Branches    42430    42426       -4     
==========================================
+ Hits       202134   202146      +12     
- Misses      14156    14161       +5     
- Partials     8194     8198       +4     
Files with missing lines Coverage Δ
lib/internal/crypto/hash.js 99.03% <100.00%> (+0.02%) ⬆️

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

2 participants