node: snapshot resizable async StringOrBuffer inputs before worker handoff#31645
node: snapshot resizable async StringOrBuffer inputs before worker handoff#31645EffortlessSteven wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughThis PR refactors array-buffer decoding in the Node runtime types to centralize and unify logic for handling resizable and fixed buffers in async contexts. A new ChangesArray-buffer decoding refactoring and async snapshotting tests
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Async
crypto.scryptcaptured its JS-backed password and salt before scheduling the worker. Resizing a resizableArrayBufferbacking either input then leaves the worker with a stale pointer/length. Reading it is undefined behavior.The shared async
StringOrBufferconversion now snapshots non-shared resizable inputs before handoff, keeping fixed buffers on the pinned fast path.Changes:
StringOrBufferinputs before worker handoffscryptregressions for resized password, salt, and offset-view inputsTest approach
Each regression schedules
crypto.scrypt, resizes the backingArrayBufferto zero, and asserts the key matchesscryptSyncover the submitted bytes.Verification
Review map
src/runtime/node/types.rs: shared asyncStringOrBufferhelper snapshots non-shared resizable buffers before worker handofftest/js/node/crypto/scrypt.test.ts: resized password, salt, and offset-view inputs