You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Binary ArrayBufferView slices send the entire backing buffer #202
Binary requests made with a sliced ArrayBufferView send the view's entire backing buffer instead of only the selected byte range.
methodRequest() converts non-DataView views with new DataView(opts.body.buffer) at src/core.ts:276. That drops the original view's byteOffset and byteLength. RequestOptions explicitly accepts ArrayBufferView, so callers can reasonably pass Buffer.subarray(), Uint8Array.subarray(), or another bounded view.
Only the selected bytes ([20, 30]) are sent, and the request body/content length is 2 bytes.
Actual behavior
All four bytes in the backing buffer are sent.
Why this matters
This corrupts binary payloads and can disclose adjacent bytes that the caller deliberately excluded with a view. The conversion should preserve byteOffset and byteLength, for example with new DataView(view.buffer, view.byteOffset, view.byteLength), and have regression coverage for sliced Uint8Array/Buffer values.
Tested against @browserbasehq/sdk 2.18.0 / current main (b781bd7).
Activity