fix: gadgets and smaller issues#10833
Conversation
There was a problem hiding this comment.
2 issues found across 19 files
Confidence score: 3/5
- There is a concrete regression risk in
lib/core/AxiosError.js: the redaction traversal can break existingtoJSONObjectbehavior for values withtoJSON(likeDate), which may cause serialized config data loss whenconfig.redactis enabled. - The issue is moderately severe (6/10) with high confidence, so this is not a merge-blocker by itself, but it does introduce meaningful user-impacting behavior change that should be reviewed before relying on redacted serialization paths.
tests/unit/prototypePollution.test.jsappears to have a coverage gap (missingcustomNestedin the source object), so the inherited-read scenario described by the test is not actually being validated.- Pay close attention to
lib/core/AxiosError.jsandtests/unit/prototypePollution.test.js- preservetoJSONserialization semantics during redaction and ensure the inherited-read test path is truly exercised.
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/core/AxiosError.js">
<violation number="1" location="lib/core/AxiosError.js:27">
P2: Redaction traversal breaks existing `toJSONObject` semantics for objects with `toJSON` (e.g., `Date`), causing serialized config data loss when `config.redact` is used.</violation>
</file>
<file name="tests/unit/prototypePollution.test.js">
<violation number="1" location="tests/unit/prototypePollution.test.js:996">
P3: This test never exercises the inherited-read path it describes because `customNested` is missing from the source object.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
|
@cubic-dev-ai please review in depth again! |
@jasonsaayman I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
1 issue found across 23 files
Confidence score: 4/5
- This PR is likely safe to merge with minimal risk, since the only reported issue is moderate severity (5/10) and scoped to cookie parsing behavior.
- In
lib/helpers/cookies.js, splittingdocument.cookieon'; 'is brittle; browsers that emit';'without a space may cause cookie reads to fail for some users. - Pay close attention to
lib/helpers/cookies.js- cookie parsing should tolerate semicolons with or without trailing spaces.
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/cookies.js">
<violation number="1" location="lib/helpers/cookies.js:37">
P2: Splitting `document.cookie` by `'; '` is too strict and can fail to read cookies when the browser omits the space after semicolons.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
|
@cubic-dev-ai one last pass please with the highest effort! |
@jasonsaayman I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
1 issue found across 23 files
Confidence score: 4/5
- This PR looks safe to merge overall: the reported issue is low-to-moderate severity (4/10) and appears limited to address normalization edge cases rather than broad functionality breaks.
- The main risk is in
lib/helpers/shouldBypassProxy.js, where strict IPv4-mapped IPv6 regex handling may miss zero-padded expanded equivalents and causeNO_PROXYmismatches for logically identical addresses. - Pay close attention to
lib/helpers/shouldBypassProxy.js- IPv4-mapped IPv6 normalization may fail for expanded/zero-padded forms, leading to proxy bypass behavior inconsistencies.
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/shouldBypassProxy.js">
<violation number="1" location="lib/helpers/shouldBypassProxy.js:96">
P2: The IPv4-mapped IPv6 regexes are too strict and fail to normalize zero-padded expanded forms, which can cause NO_PROXY mismatches for equivalent addresses.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
|
@cubic-dev-ai one last run through and check please! |
@jasonsaayman I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
1 issue found across 23 files
Confidence score: 3/5
- There is a concrete medium-severity risk in
lib/core/AxiosError.js: readingconfig.redactwithout an own-property check could execute prototype-chain getters during error serialization. - Given the 6/10 severity and 8/10 confidence, this is likely user-impacting in edge cases and introduces regression/security-adjacent behavior, so the merge risk is moderate rather than minimal.
- Pay close attention to
lib/core/AxiosError.js- ensureconfig.redactis accessed via an own-property check to prevent unintended getter execution from the prototype chain.
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/core/AxiosError.js">
<violation number="1" location="lib/core/AxiosError.js:116">
P2: Read `config.redact` via an own-property check to avoid prototype-chain getter execution during error serialization.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
|
@cubic-dev-ai please check again, do a full review in depth! |
@jasonsaayman I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
1 issue found across 23 files
Confidence score: 2/5
- There is a high-confidence, medium-high severity issue in
lib/core/AxiosError.jswhere prototype-chaintoJSONdetection can bypass masking logic, creating a real regression risk for redaction behavior. - Because this can expose data that should be redacted (especially if
Object.prototype.toJSONis polluted), the impact is security-sensitive and not just cosmetic. - Given the concrete user-impacting risk (severity 7/10, confidence 8/10), this is better treated as high risk until the own-prototype check is enforced.
- Pay close attention to
lib/core/AxiosError.js- ensuretoJSONchecks are own-prototype based so masking cannot be short-circuited by prototype pollution.
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/core/AxiosError.js">
<violation number="1" location="lib/core/AxiosError.js:36">
P1: Prototype-chain `toJSON` detection can bypass redaction for non-plain objects. Use an own-prototype check so polluted `Object.prototype.toJSON` does not short-circuit masking.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
|
@cubic-dev-ai please give the full pr another in depth review |
@jasonsaayman I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
2 issues found across 23 files
Confidence score: 3/5
- There is some real merge risk:
lib/core/AxiosError.jshas a medium-severity, high-confidence concern where redaction output should use a null-prototype object to avoid prototype-setter traps when copying keys. lib/helpers/shouldBypassProxy.jsmay incorrectly handle IPv4-mapped IPv6 compressed forms, so equivalent addresses can failNO_PROXYmatching and cause unexpected proxy bypass behavior.- Given one concrete correctness issue and one defensive-hardening gap (both with high confidence), this looks manageable but not entirely low-risk.
- Pay close attention to
lib/core/AxiosError.jsandlib/helpers/shouldBypassProxy.js- redaction object safety and IPv6/NO_PROXYequivalence handling need careful validation.
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/core/AxiosError.js">
<violation number="1" location="lib/core/AxiosError.js:59">
P2: Use a null-prototype object for redaction output to avoid prototype-setter traps when copying keys.</violation>
</file>
<file name="lib/helpers/shouldBypassProxy.js">
<violation number="1" location="lib/helpers/shouldBypassProxy.js:96">
P2: The IPv4-mapped IPv6 regex is too narrow and misses valid compressed forms, which can cause NO_PROXY host comparisons to fail for equivalent addresses.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
|
@cubic-dev-ai please review in depth again! |
@jasonsaayman I have started the AI code review. It will take a few minutes to complete. |
Summary by cubic
Improves security and robustness across request handling and errors. Adds opt-in
config.redactfor masking inAxiosError#toJSON, introduces Node-onlyformDataHeaderPolicy(default'legacy') to controlFormData#getHeaders()copying, enforces streamedmaxContentLengthand uploadmaxBodyLength, and hardens proxy/cookie/merge behaviors.Description
redact?: string[]to request config;AxiosError#toJSONmasks matching keys (case-insensitive, deep, arrays,AxiosHeaders, cycle-safe; does not mutate the original config).formDataHeaderPolicy?: 'legacy' | 'content-only'; policy applied in resolve and Nodehttpadapter to control whichFormData#getHeaders()values are copied.httpadapter: own‑prop reads for proxy fields and nestedauth, preserve userHostwhile ignoring polluted prototypes, strip staleProxy-Authorizationon redirects that end up without a proxy, and handle malformed userinfo; apply header policy when sendingFormData.maxContentLengthon streamed responses andmaxBodyLengthon uploads (Node andfetch).NO_PROXYby normalizing IPv4‑mapped IPv6 addresses (dotted and hex forms).;, exact-name matching, support separators without spaces; avoids regex interpolation.hasOwnProperty; null‑protodefinePropertydescriptors for adapter metadata andAxiosHeadersaccessors to block pollutedget/settraps.FormDataheaders.index.d.ts/index.d.cts. README and advanced docs updated. Defaults preserve v1 behavior (formDataHeaderPolicy: 'legacy'). No intended breaking runtime changes.Docs
/docs/withconfig.redactusage andformDataHeaderPolicydetails (default'legacy','content-only'copies onlyContent-Type/Content-Length). Ensure site rebuild reflects README and advanced guides.Testing
Hostpreservation, staleProxy-Authorizationstripping, malformed credentials handling.AxiosHeaders, cycles, non‑mutation.NO_PROXY: IPv4‑mapped IPv6 normalization (dotted and hex).fetch).Semantic version impact
Minor: backward‑compatible features and fixes. Adds
config.redactand NodeformDataHeaderPolicy(default preserves v1 behavior).Written for commit 58816ea. Summary will update on new commits.