Skip to content

fix: harden runtime option handling - #11141

Merged
jasonsaayman merged 8 commits into
v1.xfrom
maintenance/runtime-consistency
Aug 12, 2026
Merged

jasonsaayman merged 8 commits into
v1.xfrom
maintenance/runtime-consistency

Conversation

@jasonsaayman

@jasonsaayman jasonsaayman commented Aug 11, 2026 •

Copy link
Copy Markdown
Member

Summary

Harden runtime option handling against shared-prototype pollution and make Fetch, HTTP/2, proxy bypass, and data URI behavior consistent across supported runtimes.

Linked issue

N/A

Changes

  • Filter request behavior inherited only from shared prototypes, including a foreign realm's Object.prototype when its mutable constructor property has been changed, deleted, or replaced by an accessor.
  • Preserve an already-safe merged request config by identity through request interceptors, adapters, and response.config.
  • Normalize interceptor replacement objects with non-terminal application prototypes into null-prototype snapshots while preserving safe inherited fields. Terminal null-prototype ancestors are excluded as a fail-closed boundary.
  • Pass fully resolved Request objects to custom Fetch implementations and honor maxRedirects: 0 with manual redirects.
  • Support custom DNS lookup for HTTP/2, reject explicit proxied HTTP/2 requests, and remove failed pooled sessions safely.
  • Add IPv4 and IPv6 CIDR matching for NO_PROXY and harden malformed data URI parsing.

Intentional compatibility changes

  • Interceptor replacements that require sanitization are normalized snapshots. Their original identity, prototype, instanceof branding, accessor placement, and descriptor attributes are not retained.
  • Custom Fetch implementations receive the authoritative method, headers, body, signal, duplex, and credentials on the resolved Request. Those fields are omitted from the second safe fetchOptions argument; custom implementations that inspected the second argument must migrate to the Request.
  • Fetch maxRedirects: 0 now prevents redirect following. Node may expose the unfollowed 3xx response, while browsers may expose an opaque redirect with status 0 and inaccessible headers.
  • Explicit Axios proxy objects with HTTP/2 now reject with ERR_NOT_SUPPORT instead of being silently ineffective.
  • Media types containing extra slash separators in data URIs now reject with ERR_INVALID_URL.
  • Fields inherited from a terminal Object.create(null) config template are excluded because such a template cannot be distinguished safely from a mutated foreign Object.prototype.
  • NO_PROXY=0.0.0.0/0 bypasses proxying for all IPv4 destinations, and NO_PROXY=::/0 does the same for IPv6.

HTTP/2 proxy policy residual

HTTP/2 remains direct when proxy policy exists only in process environment variables or an HTTP/1 agent's proxyEnv, because http2.connect() cannot apply those proxy mechanisms. Deployments that require proxying as an egress boundary should not treat this change as full HTTP/2 proxy-policy enforcement.

Validation

  • Focused utility, prototype-pollution, and Fetch adapter suites: 164 tests passed.
  • Full unit suite: 57 files, 1,035 tests passed.
  • Browser-headless suite: 57 files, 591 tests passed.
  • Source lint passed.
  • git diff --check passed.

Checklist

  • Tests added or updated.
  • Deferred release documentation notes updated; no public declaration changes.
  • Observable compatibility changes are called out explicitly above.

Semantic version impact

Security/runtime hardening with intentional compatibility changes documented above; this PR does not claim complete backward compatibility.

@jasonsaayman jasonsaayman self-assigned this Aug 11, 2026
@jasonsaayman jasonsaayman added the commit::fix The PR is related to a bugfix label Aug 11, 2026
@greptile-apps

greptile-apps Bot commented Aug 11, 2026 •

Copy link
Copy Markdown

Greptile Summary

This update strengthens runtime option handling across Axios adapters. Direct HTTP/2 requests with proxy: false were verified to complete successfully even when the selected agent supports environment-proxy configuration; the former ERR_NOT_SUPPORT failure was disproved on the current code. Fetch requests were also verified to retain Axios-controlled request fields while safely forwarding unrelated Fetch options and preserving manual redirects.

Confidence Score: 5/5

Safe to merge based on the exercised HTTP/2 proxy-disable and Fetch option-resolution behaviors.

No blocking failure remains.

T-Rex T-Rex Logs

What T-Rex did

  • Validated the focused local HTTP/2 proxyEnv-agent runtime reproduction and confirmed that with proxying disabled the current code returns 200 OK instead of ERR_NOT_SUPPORT.
  • Ran the Fetch adapter validation suite; 69 tests in tests/unit/adapters/fetch.test.js passed, confirming Axios-controlled request fields remain authoritative while unrelated Fetch options and manual redirects work as expected.
  • Verified the HTTP/2 proxy-env behavior path in lib/adapters/http.js; the code now allows direct HTTP/2 requests when proxies are disabled, fixing the previous ERR_NOT_SUPPORT regression.
  • Compared Axios-owned values to custom Fetch initialization; after the change the custom Fetch call receives only safe options while Axios’s request data remains intact, and no finding was reported regarding isolation and redirects.

View all artifacts

T-Rex Ran code and verified through T-Rex

Reviews (7): Last reviewed commit: "test: clarify unsafe prototype fixtures" | Re-trigger Greptile

Comment thread lib/adapters/http.js Outdated

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 20 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread lib/utils.js Outdated
Comment thread lib/adapters/http.js
Comment thread lib/adapters/fetch.js Outdated
Comment thread lib/adapters/fetch.js

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 8 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread lib/utils.js Outdated

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 6 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread lib/utils.js
Comment thread lib/utils.js
Comment thread tests/unit/utils/isX.test.js Outdated
Comment thread tests/unit/utils/isX.test.js Fixed
Comment thread tests/unit/prototypePollution.test.js Fixed
Comment thread tests/unit/utils/isX.test.js Dismissed
Comment thread tests/unit/prototypePollution.test.js Dismissed
@jasonsaayman
jasonsaayman merged commit d19040b into v1.x Aug 12, 2026
32 checks passed
@jasonsaayman
jasonsaayman deleted the maintenance/runtime-consistency branch August 12, 2026 16:27
vinaykushwahavk added a commit to icanbwell/fhir-server-ui that referenced this pull request Sep 11, 2026
Raises axios from ^1.18.0 (resolving to 1.19.0) to ^1.20.0, addressing
the runtime-option prototype-pollution hardening in axios PR #11141
(axios/axios#11141). Verified via GitHub's
official Releases API and the PR's "Intentional compatibility changes"
list that none of the documented behavior changes (interceptor
replacement objects, custom Fetch adapter second argument, maxRedirects:
0, explicit proxy objects over HTTP/2, data-URI parsing) apply to this
repo's usage, which is limited to plain axios.get/axios.post calls with
the default browser XHR adapter in the auth service files.
markharding pushed a commit to futo-org/Harbor that referenced this pull request Oct 16, 2026
This PR contains the following updates:

| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [axios](https://axios-http.com) ([source](https://github.com/axios/axios)) | [`1.18.1` → `1.20.0`](https://renovatebot.com/diffs/npm/axios/1.18.1/1.20.0) | ![age](https://developer.mend.io/api/mc/badges/age/npm/axios/1.20.0?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/axios/1.18.1/1.20.0?slim=true) |

---

> ⚠️ **Warning**
>
> Some dependencies could not be looked up. Check the [Dependency Dashboard](issues/99) for more information.

---

### Release Notes

<details>
<summary>axios/axios (axios)</summary>

### [`v1.20.0`](https://github.com/axios/axios/releases/tag/v1.20.0)

[Compare Source](axios/axios@v1.19.0...v1.20.0)

#### v1.20.0 — August 19, 2026

This release hardens runtime option handling, adds RFC 9110 status-code aliases, fixes Node.js and XHR reliability issues, and refreshes project tooling and documentation.

#### ⚠️ Breaking Changes & Deprecations

- HTTP Status Naming: Added ContentTooLarge (413) and UnprocessableContent (422), while retaining PayloadTooLarge and UnprocessableEntity as backward-compatible deprecated aliases. ([#&#8203;11082](axios/axios#11082))

#### 🔒 Security Fixes

- Runtime Option Handling: Hardened behavioral configuration reads against shared and foreign prototype pollution and normalized unsafe interceptor replacement objects. This also clarifies Fetch redirect and custom implementation behavior, HTTP/2 DNS and proxy handling, CIDR-based NO_PROXY matching, and malformed data URI rejection; see the PR for documented compatibility effects. ([#&#8203;11141](axios/axios#11141))

#### 🐛 Bug Fixes

- Interceptor Lifecycle: Prevented unbounded handler-array growth by trimming trailing ejected interceptors without changing iteration semantics, and kept interceptor operations safe when the public handlers field is nullish. ([#&#8203;11087](axios/axios#11087), [#&#8203;11118](axios/axios#11118))
- Request Error Preservation: Prevented custom Error.prepareStackTrace implementations that return non-string values from replacing the original request failure with an unrelated TypeError. ([#&#8203;11109](axios/axios#11109))
- XHR Reliability: Navigation-canceled requests now reject with ECONNABORTED instead of resolving with status 0, while successful downloads flush their final progress callback during the live loadend dispatch. ([#&#8203;11094](axios/axios#11094), [#&#8203;11121](axios/axios#11121))
- Node.js Socket Memory: Removed request-context retention from per-socket error listeners, preventing completed response data from being pinned for the lifetime of pooled keep-alive sockets. ([#&#8203;11091](axios/axios#11091))
- Core Methods and HTTP Errors: Prevented structural method-header buckets from leaking into outgoing headers, standardized invalid DNS lookup and httpVersion failures as AxiosError.ERR_BAD_OPTION_VALUE, and corrected the timeoutErrorMessage merge strategy. ([#&#8203;11096](axios/axios#11096))

#### 🔧 Maintenance & Chores

- Dependencies: Updated fast-uri, postcss, js-yaml, mocha, development-tooling groups, and GitHub Actions dependencies. ([#&#8203;11092](axios/axios#11092), [#&#8203;11098](axios/axios#11098), [#&#8203;11099](axios/axios#11099), [#&#8203;11106](axios/axios#11106), [#&#8203;11107](axios/axios#11107), [#&#8203;11122](axios/axios#11122), [#&#8203;11123](axios/axios#11123), [#&#8203;11126](axios/axios#11126), [#&#8203;11127](axios/axios#11127), [#&#8203;11133](axios/axios#11133), [#&#8203;11140](axios/axios#11140), [#&#8203;11143](axios/axios#11143), [#&#8203;11144](axios/axios#11144))
- Documentation: Applied the v1.19.0 documentation updates, added the missing fs import to the README stream example, introduced localized global search, and repaired the interceptor test link. ([#&#8203;11101](axios/axios#11101), [#&#8203;11113](axios/axios#11113), [#&#8203;11097](axios/axios#11097), [#&#8203;11119](axios/axios#11119))
- Sponsorship: Updated sponsorship links and data and added ScrapingBee as a sponsor. ([#&#8203;11124](axios/axios#11124), [#&#8203;11136](axios/axios#11136), [#&#8203;11137](axios/axios#11137))
- CI and Release: Switched ESM smoke tests to locked dependencies and synchronized package and runtime version metadata for v1.20.0. ([#&#8203;11128](axios/axios#11128), [#&#8203;11152](axios/axios#11152))

#### 🌟 New Contributors

We are thrilled to welcome our new contributors. Thank you for helping improve axios:

- [@&#8203;yens1](https://github.com/yens1) ([#&#8203;11109](axios/axios#11109))
- [@&#8203;Sasireddy001](https://github.com/Sasireddy001) ([#&#8203;11113](axios/axios#11113))
- [@&#8203;ari-token-security](https://github.com/ari-token-security) ([#&#8203;11094](axios/axios#11094))
- [@&#8203;timothyokooboh](https://github.com/timothyokooboh) ([#&#8203;11097](axios/axios#11097))
- [@&#8203;gi9439041-png](https://github.com/gi9439041-png) ([#&#8203;11119](axios/axios#11119))
- [@&#8203;Hashim1999164](https://github.com/Hashim1999164) ([#&#8203;11082](axios/axios#11082))
- [@&#8203;v-dev-cl](https://github.com/v-dev-cl) ([#&#8203;11091](axios/axios#11091))
- [@&#8203;r0h1tb](https://github.com/r0h1tb) ([#&#8203;11118](axios/axios#11118))
- [@&#8203;ostapondo](https://github.com/ostapondo) ([#&#8203;11121](axios/axios#11121))

Full Changelog (<axios/axios@v1.19.0...v1.20.0>)

### [`v1.19.0`](https://github.com/axios/axios/blob/HEAD/CHANGELOG.md#v1190--July-22-2026)

[Compare Source](axios/axios@v1.18.1...v1.19.0)

This release raises the form-data security floor, adds configuration and type-system capabilities, and fixes NO_PROXY matching, interceptor errors, progress reporting, and serialization edge cases.

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - "before 9am on tuesday"
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xMzMuMCIsInVwZGF0ZWRJblZlciI6IjQ0LjE2NC41IiwidGFyZ2V0QnJhbmNoIjoiZGV2ZWxvcCIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiLCJyZW5vdmF0ZSJdfQ==-->

Reviewed-on: https://code.futo.org/harbor/harbor/pulls/1808
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commit::fix The PR is related to a bugfix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant