Skip to content

chore: backport fixes from the v1x branch#10838

Merged
jasonsaayman merged 9 commits into
v0.xfrom
chore/port-fixes
May 3, 2026
Merged

chore: backport fixes from the v1x branch#10838
jasonsaayman merged 9 commits into
v0.xfrom
chore/port-fixes

Conversation

@jasonsaayman
Copy link
Copy Markdown
Member

@jasonsaayman jasonsaayman commented May 3, 2026

Summary by cubic

Backports security and hardening fixes from v1.x to v0.x. Tightens header/config merging, default error redaction, cookie/XSRF handling, proxy bypass rules, and Unix socket usage, plus test stability on Node 12–24.

Description

A clear and concise description of the PR.

Use this section for review hints, explanations or discussion points.

  • Summary of changes
    • Merge returns null‑prototype objects for configs/headers to block prototype‑pollution gadgets; safer header flattening using own props.
    • AxiosError.toJSON() now redacts sensitive keys by default; configurable via config.redact; defaults exposed on defaults.redact.
    • Cookies/XSRF: read names literally (no regex); only own props respected for withXSRFToken.
    • Proxy bypass: NO_PROXY matching handles canonical IPv4‑mapped IPv6 forms (e.g., ::ffff:127.0.0.1 and ::ffff:7f00:1).
    • Node http adapter: strip Proxy-Authorization when not using a proxy; gate socketPath behind allowedSocketPaths (string/array, normalized); misc hardening.
    • Browser xhr adapter: stricter own‑property checks for config/headers.
    • Params: AxiosURLSearchParams keeps %00 encoded; encoding made consistent.
    • Types/defaults and repo hygiene: add formDataHeaderPolicy, redact, allowedSocketPaths to types; update README.md/CHANGELOG.md; add AGENTS.md; refresh issue/PR templates; .gitignore tweak.
  • Reasoning
    • Prevent prototype‑pollution attacks and credential leaks in logs.
    • Make proxy and cookie handling precise and predictable.
    • Reduce accidental Unix socket access by default.
  • Additional context
    • Tests stabilized across Node 12–24 (e.g., preload dns for Node 12); OpenSSL‑legacy paths handled via existing test harness.

Docs

Update /docs/ for:

  • config.redact defaults and override behavior.
  • formDataHeaderPolicy and serializer depth caps.
  • allowedSocketPaths gating and path normalization.
  • Null‑prototype merge behavior and safe hasOwnProperty usage.
  • Literal cookie/XSRF names.
  • %00 behavior in params.
  • NO_PROXY handling of IPv4‑mapped IPv6.

Testing

  • Added/updated tests for redaction, cookie/XSRF literal reads, proxy bypass (IPv4‑mapped IPv6), header flattening with own props, http adapter safety (Proxy-Authorization stripping, allowedSocketPaths), URL param %00, form‑data depth limits, and TS types.
  • Infra fixes for Node 12 (preload dns) and legacy OpenSSL flows.
  • No additional tests needed beyond those included.

Semantic version impact

Breaking change.

  • Merged config/header objects now have a null prototype. Use Object.prototype.hasOwnProperty.call(obj, key) and avoid implicit string coercion of these objects.
  • Other changes are behavioral hardening and should be compatible.

Written for commit 7fa296c. Summary will update on new commits.

@jasonsaayman jasonsaayman self-assigned this May 3, 2026
@jasonsaayman jasonsaayman added priority::high A high priority issue commit::chore The PR is related to a chore commit::fix The PR is related to a bugfix type::security The PR is a secuirty related changed normally from a CVE labels May 3, 2026
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 issues found across 28 files

Confidence score: 3/5

  • There is some merge risk because lib/core/AxiosError.js has a concrete behavior issue (6/10, high confidence): using {} for redaction lookups can falsely match Object.prototype keys like constructor/toString, leading to incorrect config redaction.
  • The other findings are low impact and non-functional (lib/helpers/AxiosURLSearchParams.js trailing commas and malformed comment text in README.md), so they are unlikely to cause runtime regressions.
  • Given one medium-severity, user-visible correctness issue in core error handling, this is not a no-risk merge even though most items are minor housekeeping.
  • Pay close attention to lib/core/AxiosError.js, lib/helpers/AxiosURLSearchParams.js, README.md - redaction key handling is the main risk; style/docs fixes are straightforward.
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/AxiosURLSearchParams.js">

<violation number="1" location="lib/helpers/AxiosURLSearchParams.js:14">
P3: Remove newly added trailing commas in this `lib/` file to match repository lint/style rules (`no trailing commas`).</violation>
</file>

<file name="README.md">

<violation number="1" location="README.md:407">
P3: Fix the malformed comment text by removing the leading comma.</violation>
</file>

<file name="lib/core/AxiosError.js">

<violation number="1" location="lib/core/AxiosError.js:19">
P2: Use `Object.create(null)` instead of `{}` to avoid false-positive redaction from `Object.prototype` properties. A config key named `"constructor"` or `"toString"` would be incorrectly redacted because `{}["constructor"]` is truthy. The same fix was already applied to `descriptors` in this PR.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread lib/core/AxiosError.js
Comment thread lib/helpers/AxiosURLSearchParams.js Outdated
Comment thread README.md Outdated
@jasonsaayman
Copy link
Copy Markdown
Member Author

@cubic-dev-ai please review this one in depth!

@cubic-dev-ai
Copy link
Copy Markdown
Contributor

cubic-dev-ai Bot commented May 3, 2026

@cubic-dev-ai please review this one in depth!

@jasonsaayman I have started the AI code review. It will take a few minutes to complete.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 29 files

Confidence score: 5/5

  • This looks low risk to merge: the only reported issue is low severity (3/10) and is confined to documentation guidance rather than product/runtime code.
  • The main concern is in AGENTS.md, where references to non-existent workflow paths/command docs could mislead contributors and reduce trust in the agent instructions.
  • Pay close attention to AGENTS.md - remove or correct fabricated-looking workflow/command references so contributor guidance is accurate.
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="AGENTS.md">

<violation number="1" location="AGENTS.md:41">
P3: Custom agent: **Flag AI Slop and Fabricated Changes**

References non-existent workflow paths and command docs, making this guidance look fabricated.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread AGENTS.md Outdated
@jasonsaayman jasonsaayman merged commit 2af6116 into v0.x May 3, 2026
14 checks passed
@jasonsaayman jasonsaayman deleted the chore/port-fixes branch May 3, 2026 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commit::chore The PR is related to a chore commit::fix The PR is related to a bugfix priority::high A high priority issue type::security The PR is a secuirty related changed normally from a CVE

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant