chore(ext/node): strengthen scrypt regression test for 128-byte keylen#34601
Merged
Conversation
The existing "log_n > 64 doesn't panic" test was misnamed (it tested keylen=128 with default options, not log_n > 64) and resolved its promise regardless of the callback's error argument, so a silent failure would not surface. Replace it with two assertive tests against the reproduction from #27716: one verifying both the async and sync paths produce the hash Node.js emits, and one running two scrypt calls concurrently (matching the original report's double panic). Co-Authored-By: Divy Srivastava <me@littledivy.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The existing
log_n > 64 doesn't panictest, added with the AWS-LC scryptmigration, was misnamed (it actually tests
keylen=128with default options,not
log_n > 64) and resolved its promise unconditionally — so a silentfailure inside the callback would not surface.
Replace it with two assertive tests against the original reproduction from
#27716:
scrypt with 128-byte keylen matches Noderuns both the async and sync APIswith
keylen=128and asserts the output matches Node.js's hash byte-for-byte.scrypt handles concurrent 128-byte keylen callsissues two scrypt calls inparallel (mirroring the original report's double panic) and verifies both
callbacks fire cleanly with identical output.
The Node-compatible behavior itself was already implemented when scrypt
switched to AWS-LC's
EVP_PBE_scryptin #33773; this just hardens theregression coverage so a future regression would be caught.
Closes denoland/orchid#353
Test plan
dprint fmtcleandeno lint --config tests/config/deno.jsonclean2.8.1 release
cargo test unit_node::crypto::crypto_scrypt_test