axios 0.32.0 → 0.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,16 +1,148 @@
1
1
  # Changelog
2
2
 
3
- ## Unreleased
3
+ ## v0.32.0 — May 4, 2026
4
4
 
5
- ### Notable behavior changes
5
+ This release backports a comprehensive set of security and hardening fixes from the v1.x branch into v0.x, covering prototype-pollution protections, default error redaction, stricter proxy/cookie/socket handling, and one breaking change to merged config and header object prototypes.
6
6
 
7
- - `utils.merge` (used internally by `mergeConfig` and to merge request headers) now returns objects with a `null` prototype to harden against prototype-pollution gadgets. As a result, `error.config`, `error.config.headers`, and any merged header bucket no longer inherit from `Object.prototype`. Two consequences:
8
- - `obj.hasOwnProperty(key)` on a merged config or header object throws `TypeError: obj.hasOwnProperty is not a function`. Use `Object.prototype.hasOwnProperty.call(obj, key)` or `key in obj` instead.
9
- - Implicit string coercion (e.g. `String(obj)`, `'' + obj`, or any path that calls `ToPrimitive`) throws `TypeError: Cannot convert object to primitive value` because there is no inherited `toString`. Coerce explicitly via `JSON.stringify(obj)` or by reading individual properties.
7
+ ## ⚠️ Breaking Changes & Deprecations
10
8
 
11
- Property access (`obj[key]`), enumeration, and `JSON.stringify` are unaffected.
9
+ - Null-prototype merged objects: mergeConfig and header merging now return objects with a null prototype to block prototype-pollution gadgets. Consumers must use Object.prototype.hasOwnProperty.call(obj, key) and avoid implicit string coercion against merged config or header objects. (#10838)
12
10
 
13
- ## [0.30.0](https://github.com/axios/axios/compare/v0.29.0...v0.30.0) (2025-03-26)
11
+ ## 🔒 Security Fixes
12
+
13
+ - Default error redaction: AxiosError.toJSON() now redacts sensitive keys by default to prevent credential leaks in logs. The behavior is configurable via config.redact, with defaults exposed on defaults.redact. (#10838)
14
+ - Cookie & XSRF handling: Cookie names are read literally rather than via regex, and only own properties are respected when evaluating withXSRFToken. (#10838)
15
+ - Proxy bypass IPv6 parity: NO_PROXY matching now handles canonical IPv4-mapped IPv6 forms such as ::ffff:127.0.0.1 and ::ffff:7f00:1. (#10838)
16
+ - Node http adapter hardening: Strips Proxy-Authorization when no proxy is in use and gates socketPath behind a new allowedSocketPaths allowlist (string or array, normalized) to reduce accidental Unix socket exposure. (#10838)
17
+ - Browser xhr adapter: Stricter own-property checks when reading config and headers. (#10838)
18
+ - URL parameters: AxiosURLSearchParams keeps %00 encoded and applies consistent encoding throughout. (#10838)
19
+ - Public type surface: Adds formDataHeaderPolicy, redact, and allowedSocketPaths to the TypeScript declarations alongside their runtime defaults. (#10838)
20
+
21
+ ## 🔧 Maintenance & Chores
22
+
23
+ - Repo hygiene: Updates README.md and CHANGELOG.md, adds AGENTS.md, and refreshes the issue and PR templates. (#10838)
24
+
25
+ [**Full Changelog**](https://github.com/axios/axios/compare/v0.31.1...v0.32.0)
26
+
27
+ ## 0.31.1 (2024-12-19)
28
+
29
+ This release backports a broad set of security hardenings from the v1 line — covering prototype-pollution defences, stream size enforcement, XSRF handling, URL null-byte encoding, and bounded FormData recursion — and drops committed `dist/` artefacts along with Bower support.
30
+
31
+ ## ⚠️ Breaking Changes & Deprecations
32
+
33
+ * **Bower & Committed `dist/` Removed:** `dist/` bundles are no longer committed to the repo, and `bower.json` plus the Grunt `package2bower` task have been removed. CI still builds bundles before publish, so npm/yarn/pnpm consumers are unaffected; installs via Bower or directly from the git tree must migrate to npm or a CDN. (__#10747__)
34
+
35
+ ## 🔒 Security Fixes
36
+
37
+ * **Prototype Pollution in Header Merge (GHSA-6chq-wfr3-2hj9):** Tightened `isFormData` to reject plain/null-prototype objects and require `append`, and guarded the Node HTTP adapter so `data.getHeaders()` is only merged when it is not inherited from `Object.prototype`. Blocks injected headers via polluted `getHeaders`. (__#10750__)
38
+ * **Prototype Pollution in Config Merging (GHSA-pf86-5x62-jrwf):** `mergeConfig`, defaults resolution, and the HTTP adapter now uses own-property checks for `transport`, `env`, `Blob`, `formSerializer`, and transforms arrays, and merged configs are returned as null-prototype objects. Prevents hijacking of the request flow through polluted prototypes. (__#10752__)
39
+ * **FormData / Params Recursion DoS:** Added a configurable `maxDepth` (default `100`, `Infinity` disables) to `toFormData` and params serialisation, throwing `AxiosError` with code `ERR_FORM_DATA_DEPTH_EXCEEDED` when exceeded. Circular-reference detection is preserved. (__#10728__)
40
+ * **Null-Byte Injection in Query Strings:** Removed the unsafe `%00` → null-byte substitution from `AxiosURLSearchParams.encode` so `%00` is preserved as-is. Other encoding behaviour (including `%20` → `+`) unchanged. (__#10737__)
41
+ * **Consolidated v1 Security Backport:** Rolls up remaining v1 hardenings into `v0.x`: `maxContentLength` enforcement for `responseType: 'stream'` via a guarded transform with deferred piping, `maxBodyLength` enforcement for streamed uploads on native `http`/`https` with `maxRedirects: 0`, and stricter `withXSRFToken` handling so only own boolean `true` enables cross-origin XSRF headers. (__#10764__)
42
+
43
+ ## 🔧 Maintenance & Chores
44
+
45
+ * **CODEOWNERS:** Added `.github/CODEOWNERS` with `* @jasonsaayman` to set a default reviewer for all paths. (__#10740__)
46
+
47
+ [Full Changelog](https://github.com/axios/axios/compare/v0.31.0...v0.31.1)
48
+
49
+ ## 0.31.0 (2024-12-17)
50
+
51
+ This release backports security fixes from v1.x, hardens the CI/CD supply chain with OIDC publishing and `zizmor` scanning, resolves TypeScript typing issues in `AxiosInstance`, and fixes a performance regression in `isEmptyObject()`.
52
+
53
+ ## 🔒 Security Fixes
54
+
55
+ * **Header Injection & Proxy Bypass:** Backports v1 security hardening — sanitizes outgoing header values to strip invalid bytes, CRLF sequences, and boundary whitespace (including array values); adds proper `NO_PROXY`/`no_proxy` enforcement covering wildcards, explicit ports, loopback aliases (`localhost`, `127.0.0.1`, `::1`), bracketed IPv6, and trailing-dot hostnames. Proxy bypass is now checked before the proxy URL is parsed, and `parsed.host` is used for correct port and IPv6 handling. (__#10688__)
56
+
57
+ * **CI Security:** SHA-pins all actions and disables credential persistence in v0.x CI, introduces `zizmor` security scanning with SARIF upload to code scanning, adds an OIDC Trusted Publishing workflow with npm provenance attestations, and gates all publishes behind a required `npm-publish` GitHub Environment with configurable reviewer protections. (__#10638__, __#10639__, __#10667__)
58
+
59
+ ## 🐛 Bug Fixes
60
+
61
+ * **TypeScript — `AxiosInstance` Return Types:** Fixes return types in `AxiosInstance` methods to correctly resolve to `Promise<R>` (matching `AxiosPromise<T>` semantics), and corrects the generic call signature so TypeScript properly enforces the response data type. TypeScript-only changes; no runtime impact. (__#6253__, __#7328__)
62
+
63
+ * **Performance:** Fixes a performance regression in `isEmptyObject()` that caused excessive computation when the argument was a large string. (__#6484__)
64
+
65
+ ## 🔧 Maintenance & Chores
66
+
67
+ * **Versioning & CI Workflow:** Adds an automated versioning flow for v0.x, renames the CI workflow for consistency with the v1.x naming convention, and corrects the branch name reference in CI config. (__#10690__, __#10691__, __#10692__)
68
+
69
+ ## 🌟 New Contributors
70
+
71
+ We are thrilled to welcome our new contributors. Thank you for helping improve axios:
72
+
73
+ * __@nakataki17__ (__#6253__)
74
+ * __@gmasclet__ (__#6484__)
75
+ * __@shaanmajid__ (__#10638__, __#10639__, __#10667__)
76
+ * __@ivan-churakov__ (__#7328__)
77
+
78
+ [Full Changelog](https://github.com/axios/axios/compare/v0.30.3...v0.31.0)
79
+
80
+ ## 0.30.3 (2024-12-10)
81
+
82
+ This is a critical security maintenance release for the v0.x branch. It addresses a high-priority vulnerability involving prototype pollution that could lead to a Denial of Service (DoS).
83
+
84
+ Recommendation: All users currently on the 0.x release line should upgrade to this version immediately to ensure environment stability.
85
+
86
+ ## 🛡️ Security Fixes
87
+
88
+ - **Backport: Fix DoS via __proto__ key in merge config**
89
+ - Patched a vulnerability where specifically crafted configuration objects using the __proto__ key could cause a Denial of Service during the merge process. - _by @FeBe95 in [PR #7388](https://github.com/axios/axios/pull/7388)_
90
+
91
+ ## ⚙️ Maintenance & CI
92
+
93
+ - **CI Infrastructure Update**
94
+ - Updated Continuous Integration workflows for the v0.x branch to maintain long-term support and build reliability. - _by @jasonsaayman in [PR #7407](https://github.com/axios/axios/pull/7407)_
95
+
96
+ ## ⚠️ Breaking Changes
97
+
98
+ Configuration Merging Behavior:
99
+
100
+ As part of the security fix, Axios now restricts the merging of the __proto__ key within configuration objects. If your codebase relies on unconventional deep-merging patterns that target the object prototype via Axios config, those operations will now be blocked. This is a necessary change to prevent prototype pollution.
101
+
102
+ Full Changelog: [v0.30.2...v0.30.3](https://github.com/axios/axios/compare/v0.30.2...v0.30.3)
103
+
104
+ ## 0.30.2 (2024-11-28)
105
+
106
+ ## What's Changed
107
+ * Backport `maxContentLength` vulnerability fix to v0.x by @FeBe95 in https://github.com/axios/axios/pull/7034
108
+
109
+ ## New Contributors
110
+ * @FeBe95 made their first contribution in https://github.com/axios/axios/pull/7034
111
+
112
+ **Full Changelog**: https://github.com/axios/axios/compare/v0.30.1...v0.30.2
113
+
114
+ ## 0.30.1 (2024-11-27)
115
+
116
+ ## Release notes:
117
+
118
+ ### Bug Fixes
119
+ * chore(deps): bump form-data from 4.0.0 to 4.0.4 for v0.x by @wolandec in https://github.com/axios/axios/pull/6978
120
+
121
+ ### Contributors to this release
122
+ * @wolandec made their first contribution in https://github.com/axios/axios/pull/6978
123
+
124
+ **Full Changelog**: https://github.com/axios/axios/compare/v0.30.0...v0.30.1
125
+
126
+ ## 0.30.0 (2024-11-21)
127
+
128
+ ## Release notes:
129
+
130
+ ### Bug Fixes
131
+ * fix: modify log while request is aborted by @mori5321 in https://github.com/axios/axios/pull/4917
132
+ * fix: update CHANGELOG.md for v0.x by @TehZarathustra in https://github.com/axios/axios/pull/6271
133
+ * fix: modify upgrade guide for 0.28.1's breaking change by @nafeger in https://github.com/axios/axios/pull/6787
134
+ * fix: backport allowAbsoluteUrls vulnerability fix to v0.x by @thatguyinabeanie in https://github.com/axios/axios/pull/6829
135
+ * fix: add allowAbsoluteUrls type by @thatguyinabeanie in https://github.com/axios/axios/pull/6849
136
+
137
+ ### Contributors to this release
138
+ * @mori5321 made their first contribution in https://github.com/axios/axios/pull/4917
139
+ * @TehZarathustra made their first contribution in https://github.com/axios/axios/pull/6271
140
+ * @nafeger made their first contribution in https://github.com/axios/axios/pull/6787
141
+ * @thatguyinabeanie made their first contribution in https://github.com/axios/axios/pull/6829
142
+
143
+ **Full Changelog**: https://github.com/axios/axios/compare/v0.29.0...v0.30.0
144
+
145
+ ## 0.29.0 (2024-11-21)
14
146
 
15
147
  ## Release notes:
16
148
 
@@ -24,6 +156,8 @@
24
156
 
25
157
  ## [0.29.0](https://github.com/axios/axios/compare/v0.28.1...v0.29.0) (2024-11-21)
26
158
 
159
+ ## 0.28.1 (2024-03-24)
160
+
27
161
  ## Release notes:
28
162
 
29
163
  ### Bug Fixes
@@ -35,6 +169,8 @@
35
169
 
36
170
  ## [0.28.1](https://github.com/axios/axios/compare/v0.28.0...v0.28.1) (2024-03-24)
37
171
 
172
+ ## 0.28.0 (2024-02-12)
173
+
38
174
  ## Release notes:
39
175
 
40
176
  ### Bug Fixes
package/dist/axios.js CHANGED
@@ -1,4 +1,4 @@
1
- // axios v0.32.0 Copyright (c) 2026 Matt Zabriskie
1
+ // axios v0.33.0 Copyright (c) 2026 Matt Zabriskie
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4
4
  typeof define === 'function' && define.amd ? define(factory) :
@@ -840,6 +840,29 @@
840
840
  return value;
841
841
  }
842
842
 
843
+ var stack = [];
844
+
845
+ function assertValueDepth(value, depth) {
846
+ if (depth > maxDepth) {
847
+ throw new AxiosError_1(
848
+ 'Maximum object depth of ' + maxDepth + ' exceeded (got ' + depth + ' levels)',
849
+ AxiosError_1.ERR_FORM_DATA_DEPTH_EXCEEDED
850
+ );
851
+ }
852
+
853
+ if (!utils.isObject(value) || stack.indexOf(value) !== -1) {
854
+ return;
855
+ }
856
+
857
+ stack.push(value);
858
+
859
+ utils.forEach(value, function each(el) {
860
+ assertValueDepth(el, depth + 1);
861
+ });
862
+
863
+ stack.pop();
864
+ }
865
+
843
866
  /**
844
867
  *
845
868
  * @param {*} value
@@ -855,6 +878,7 @@
855
878
  if (utils.endsWith(key, '{}')) {
856
879
  // eslint-disable-next-line no-param-reassign
857
880
  key = metaTokens ? key : key.slice(0, -2);
881
+ assertValueDepth(value, 1);
858
882
  // eslint-disable-next-line no-param-reassign
859
883
  value = JSON.stringify(value);
860
884
  } else if (
@@ -884,8 +908,6 @@
884
908
  return false;
885
909
  }
886
910
 
887
- var stack = [];
888
-
889
911
  var exposedHelpers = Object.assign(predicates, {
890
912
  defaultVisitor: defaultVisitor,
891
913
  convertValue: convertValue,
@@ -1012,9 +1034,17 @@
1012
1034
  url = url.slice(0, hashmarkIndex);
1013
1035
  }
1014
1036
 
1015
- var _encode = options && options.encode || encode;
1037
+ var _encode = encode;
1038
+ var serializeFn;
1016
1039
 
1017
- var serializeFn = options && options.serialize;
1040
+ if (options) {
1041
+ if (utils.isFunction(options)) {
1042
+ serializeFn = options;
1043
+ } else {
1044
+ _encode = utils.hasOwnProperty(options, 'encode') && options.encode || encode;
1045
+ serializeFn = utils.hasOwnProperty(options, 'serialize') ? options.serialize : undefined;
1046
+ }
1047
+ }
1018
1048
 
1019
1049
  var serializedParams;
1020
1050
 
@@ -1137,6 +1167,19 @@
1137
1167
  }, options));
1138
1168
  };
1139
1169
 
1170
+ var MAX_FORM_DATA_TO_JSON_DEPTH = 100;
1171
+
1172
+ function assertPathDepth(path) {
1173
+ var depth = path.length - 1;
1174
+
1175
+ if (depth > MAX_FORM_DATA_TO_JSON_DEPTH) {
1176
+ throw new AxiosError_1(
1177
+ 'Maximum object depth of ' + MAX_FORM_DATA_TO_JSON_DEPTH + ' exceeded (got ' + depth + ' levels)',
1178
+ AxiosError_1.ERR_FORM_DATA_DEPTH_EXCEEDED
1179
+ );
1180
+ }
1181
+ }
1182
+
1140
1183
  function parsePropPath(name) {
1141
1184
  // foo[x][y][z]
1142
1185
  // foo.x.y.z
@@ -1197,7 +1240,10 @@
1197
1240
  var obj = {};
1198
1241
 
1199
1242
  utils.forEachEntry(formData, function(name, value) {
1200
- buildPath(parsePropPath(name), value, obj, 0);
1243
+ var path = parsePropPath(name);
1244
+
1245
+ assertPathDepth(path);
1246
+ buildPath(path, value, obj, 0);
1201
1247
  });
1202
1248
 
1203
1249
  return obj;
@@ -1505,10 +1551,11 @@
1505
1551
  var request = new XMLHttpRequest();
1506
1552
 
1507
1553
  // HTTP basic authentication
1508
- if (config.auth) {
1509
- var username = config.auth.username || '';
1510
- var password = config.auth.password
1511
- ? unescape(encodeURIComponent(config.auth.password))
1554
+ var configAuth = utils.hasOwnProperty(config, 'auth') ? config.auth : undefined;
1555
+ if (configAuth) {
1556
+ var username = utils.hasOwnProperty(configAuth, 'username') ? configAuth.username || '' : '';
1557
+ var password = utils.hasOwnProperty(configAuth, 'password') && configAuth.password
1558
+ ? unescape(encodeURIComponent(configAuth.password))
1512
1559
  : '';
1513
1560
  requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
1514
1561
  }
@@ -1521,7 +1568,11 @@
1521
1568
 
1522
1569
  request.open(
1523
1570
  config.method.toUpperCase(),
1524
- buildURL(fullPath, config.params, config.paramsSerializer),
1571
+ buildURL(
1572
+ fullPath,
1573
+ config.params,
1574
+ utils.hasOwnProperty(config, 'paramsSerializer') ? config.paramsSerializer : undefined
1575
+ ),
1525
1576
  true
1526
1577
  );
1527
1578
 
@@ -2186,7 +2237,7 @@
2186
2237
  };
2187
2238
 
2188
2239
  var data = {
2189
- "version": "0.32.0"
2240
+ "version": "0.33.0"
2190
2241
  };
2191
2242
 
2192
2243
  var VERSION = data.version;
@@ -2410,10 +2461,12 @@
2410
2461
  utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
2411
2462
  /*eslint func-names:0*/
2412
2463
  Axios.prototype[method] = function(url, config) {
2413
- return this.request(mergeConfig(config || {}, {
2464
+ var requestConfig = config || {};
2465
+
2466
+ return this.request(mergeConfig(requestConfig, {
2414
2467
  method: method,
2415
2468
  url: url,
2416
- data: (config || {}).data
2469
+ data: utils.hasOwnProperty(requestConfig, 'data') ? requestConfig.data : undefined
2417
2470
  }));
2418
2471
  };
2419
2472
  });