fix(fetch): reject SharedArrayBuffer-backed body views - #5601
Open
Baltsat wants to merge 1 commit into
Open
Conversation
Route all ArrayBuffer views through the Web IDL BufferSource converter so SharedArrayBuffer-backed views are rejected instead of being string-coerced. Add Request and Response regression coverage while preserving ordinary ArrayBuffer-backed body bytes. User-Request: fix Undici issue 5596 | codex:oss-maintainer-loop Signed-off-by: Konstantin Baltsat <baltsat2002@mail.ru>
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.
This relates to...
Fixes #5596.
Rationale
XMLHttpRequestBodyInitrecognized views only when their backing buffer was anArrayBuffer. A typed array orDataViewbacked by aSharedArrayBuffertherefore fell through to string conversion, silently changing the request or response bytes.Routing all ArrayBuffer views through the existing Web IDL
BufferSourceconverter preserves ordinary views and rejects shared-backed views with aTypeError, as required for a non-[AllowShared]buffer source.Changes
Features
N/A.
Bug Fixes
Uint8Array,Buffer, andDataViewbodies backed bySharedArrayBufferin bothRequestandResponse.ArrayBuffer-backed views.Breaking Changes and Deprecations
N/A.
Validation
node --test test/fetch/issue-5596.js— 7/7 passed.npm run lint— passed.npm run test:fetch— 483 fetch, 28 Web IDL, and 47 busboy tests passed.Implementation and validation used Codex assistance. I reviewed the final diff and test results.
Status