fix: incorrect assumption on test#10796
Merged
jasonsaayman merged 4 commits intov1.xfrom Apr 22, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
1 issue found across 3 files
Confidence score: 3/5
- There is a concrete medium-risk issue in
lib/helpers/estimateDataURLDecodedBytes.js:TextEncoder().encode(body)creates a full byte array, which defeats the intended non-allocating estimation path. - This can increase memory usage for large data URLs and weaken the guard’s protective behavior under heavy inputs, so there is some regression risk despite being limited to one area.
- Pay close attention to
lib/helpers/estimateDataURLDecodedBytes.js- ensure size estimation stays non-allocating for large payloads.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="lib/helpers/estimateDataURLDecodedBytes.js">
<violation number="1" location="lib/helpers/estimateDataURLDecodedBytes.js:77">
P2: Using `TextEncoder().encode(body)` allocates a full byte array, which undermines this guard’s non-allocating size-estimation path for large data URLs.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Member
Author
|
@cubic-dev-ai, please check this again. Since it is high-value, please be as thorough as possible |
Contributor
@jasonsaayman I have started the AI code review. It will take a few minutes to complete. |
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.
Summary by cubic
Enforces
maxBodyLengthandmaxContentLengthin thefetchadapter to match thehttpadapter, includingdata:URLs and streamed responses. Closes the bypass reported in GHSA-777c-7fjr-54vf and addresses Linear AXI-201.Description
maxBodyLengthbefore dispatch by measuring outbound body size.maxContentLengthvia Content-Length pre-check, during streaming, and as a fallback when no stream is available.data:URLs withestimateDataURLDecodedBytesto avoid materializing oversized payloads.response.bodyso checks run only when a stream exists.estimateDataURLDecodedBytes: useBuffer.byteLengthin Node; otherwise compute UTF‑8 byte length manually without allocating large buffers./docs/to state thefetchadapter enforces these limits (includingdata:URLs and streams) with parity to thehttpadapter and the errors raised on exceed.axiosv1.x.Testing
data:URLs (base64 and non-base64).Written for commit ca87246. Summary will update on new commits.