Title: Non-compliant handling of shared array buffers/views in web APIs · Issue #59688 · nodejs/node · GitHub
Open Graph Title: Non-compliant handling of shared array buffers/views in web APIs · Issue #59688 · nodejs/node
X Title: Non-compliant handling of shared array buffers/views in web APIs · Issue #59688 · nodejs/node
Description: In the web specification, an ArrayBufferView is explicitly a TypedArray/DataView that views an ArrayBuffer. Unless marked as AllowShared, an ArrayBufferView cannot be backed by a SharedArrayBuffer, nor can a BufferSource be a SharedArray...
Open Graph Description: In the web specification, an ArrayBufferView is explicitly a TypedArray/DataView that views an ArrayBuffer. Unless marked as AllowShared, an ArrayBufferView cannot be backed by a SharedArrayBuffer,...
X Description: In the web specification, an ArrayBufferView is explicitly a TypedArray/DataView that views an ArrayBuffer. Unless marked as AllowShared, an ArrayBufferView cannot be backed by a SharedArrayBuffer,...
Opengraph URL: https://github.com/nodejs/node/issues/59688
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Non-compliant handling of shared array buffers/views in web APIs","articleBody":"In the web specification, an ArrayBufferView is explicitly a TypedArray/DataView that views an ArrayBuffer. Unless marked as AllowShared, an ArrayBufferView cannot be backed by a SharedArrayBuffer, nor can a BufferSource be a SharedArrayBuffer itself (whatwg/webidl#353), and compliant implementations will consider these invalid. This impacts many APIs that interact with byte sources.\n\nThe compliance with this in Node.js's various web API implementations is really hit-and-miss, and there's no indication that any divergence is deliberate. (WPT does not cover these cases.)\n\n\u003ctable\u003e\n\u003cthead\u003e\n\u003cth\u003eAPI\u003c/th\u003e\n\u003cth\u003ecomponent\u003c/th\u003e\n\u003cth\u003ecompliance\u003c/th\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003eFetch\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003eBodyInit\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ca href=\"https://github.com/nodejs/undici/blob/4eddf5a08f4271b7f545c0dfeb3e79c745d6e3eb/lib/web/fetch/body.js#L39-L271\"\u003ePartial\u003c/a\u003e.\u003cbr\u003e✅ SharedArrayBuffers are rejected as invalid sources.\u003cbr\u003e❌ Views on SharedArrayBuffers are accepted, and result in the source being copied into a new SharedArrayBuffer internally.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eWebSockets\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003eWebSocket#send()\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ca href=\"https://github.com/nodejs/undici/blob/4eddf5a08f4271b7f545c0dfeb3e79c745d6e3eb/lib/web/websocket/websocket.js#L215-L311\"\u003ePartial\u003c/a\u003e.\u003cbr\u003e✅ The \u003ccode\u003edata\u003c/code\u003e parameter rejects SharedArrayBuffers.\u003cbr\u003e❌ Views on SharedArrayBuffers are accepted.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eFile\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003eBlobPart\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e❌ Both SharedArrayBuffers and views on SharedArrayBuffers are accepted as valid sources.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd rowspan=\"2\"\u003eStreams\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003eReadableStreamBYOBReader#read()\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e❌ The \u003ccode\u003eview\u003c/code\u003e argument accepts views on SharedArrayBuffers.\u003cbr\u003eThis will result in delayed errors, as the underlying SharedArrayBuffer cannot be transferred.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003eReadableByteStreamController#enqueue()\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e❌ The \u003ccode\u003echunk\u003c/code\u003e argument accepts views on SharedArrayBuffers.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eCompression Streams\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003eCompressionStream\u003c/code\u003e and \u003ccode\u003eDecompressionStream\u003c/code\u003e chunk type\u003c/td\u003e\n\u003ctd\u003e❌ Does not accept ArrayBuffers at all, as the webstream wraps an underlying Duplex. (#43433)\u003cbr\u003e❌ Accepts views over SharedArrayBuffers.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eEncoding\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003eTextDecoder#decode()\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003e✅ The API specifies AllowSharedBufferSource.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eWeb Cryptography\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003edata\u003c/code\u003e parameters\u003c/td\u003e\n\u003ctd\u003e✅ Validates input to be an ArrayBuffer or non-shared ArrayBufferView.\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\n`internal/crypto/webidl` already defines compatible validators for non-shared BufferSource and ArrayBufferView types. These should probably be moved into the `internal/webidl` namespace and used more widely across the various web API implementations.\n\ncc: @nodejs/web-standards","author":{"url":"https://github.com/Renegade334","@type":"Person","name":"Renegade334"},"datePublished":"2025-08-30T18:56:32.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":6},"url":"https://github.com/59688/node/issues/59688"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:34806137-9a0d-4a7a-f6ae-6b9963a9d8f4 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CEA2:1EEB:4C9720:739D0D:6A4CC59B |
| html-safe-nonce | e352415b384f5dac0f11e032ac1d98c386e9b281f290ab9e4511f401fbc07e3e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRUEyOjFFRUI6NEM5NzIwOjczOUQwRDo2QTRDQzU5QiIsInZpc2l0b3JfaWQiOiI4NjU4MjY2NDE1MzYxMjEzODUxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 89c9a69ebe942e882a104d96aa1e93d2022fded139f73d5c5b3734c0efc6d973 |
| hovercard-subject-tag | issue:3369391940 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/59688/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2827f4a92a7565164a6b3d6482c1cd08563231523547cc68659ef5dd83e1f33e/nodejs/node/issues/59688 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2827f4a92a7565164a6b3d6482c1cd08563231523547cc68659ef5dd83e1f33e/nodejs/node/issues/59688 |
| og:image:alt | In the web specification, an ArrayBufferView is explicitly a TypedArray/DataView that views an ArrayBuffer. Unless marked as AllowShared, an ArrayBufferView cannot be backed by a SharedArrayBuffer,... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Renegade334 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3d11bb817438277de2a940854450e83a7d32b6aeb5014e9e6b00a6423900251c |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | d0da0eb92994395299ed4450bf67b0373005be36 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width