lib: reject SharedArrayBuffer in web APIs per spec#62632
lib: reject SharedArrayBuffer in web APIs per spec#62632thisalihassan wants to merge 2 commits intonodejs:mainfrom
Conversation
|
Review requested:
|
|
The webstream changes are not semver-major IMO, as passing a shared view is currently a broken operation – this change simply validates the buffer up-front, rather than throwing a difficult-to-catch exception when data starts flowing. As such, this could be split down into two PRs, one semver-patch for the webstream changes, one semver-major for blob. The compression stream change here is unnecessary because the underlying adapter doesn't accept shared array buffers, so the validation change here is a no-op. (ref #62163) |
|
@Renegade334 thanks for the detailed feedback.
I will check how the adapter handles it with your #62163 in mind. |
2f0223b to
cec023c
Compare
|
@panva @Renegade334 can we drop semver-major label and add semver-patch instead? As I have reverted the blob changes |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #62632 +/- ##
=======================================
Coverage 89.68% 89.69%
=======================================
Files 706 706
Lines 218143 218191 +48
Branches 41732 41742 +10
=======================================
+ Hits 195650 195699 +49
+ Misses 14402 14401 -1
Partials 8091 8091
🚀 New features to boost your workflow:
|
|
@thisalihassan please rebase on top of main |
Signed-off-by: Ali Hassan <ali-hassan27@outlook.com>
Signed-off-by: Ali Hassan <ali-hassan27@outlook.com>
cec023c to
7909167
Compare
|
@panva done |
This comment was marked as outdated.
This comment was marked as outdated.
| if (!ArrayBufferIsView(V)) { | ||
| throw makeException( | ||
| 'is not an ArrayBufferView.', | ||
| opts); | ||
| } |
There was a problem hiding this comment.
Do we need this check given that getDataViewOrTypedArrayBuffer will throw if V is not an ArrayBufferView?
The WebIDL spec requires BufferSource/ArrayBufferView (without AllowShared) to reject SharedArrayBuffer and views backed by one.
Node.js web APIs handle this inconsistently, moved the SAB BufferSource/ArrayBufferView validators from internal/crypto/webidl into the shared internal/webidl module and fixes the non-compliant call sites:
Blob constructor changes (semver-major) will be submitted as a separate PR.
Quick Research:
Deno already rejects these cases while Bun does not (as of Bun 1.3).
Refs: #59688