axios 1.6.1 → 1.6.3

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.

Potentially problematic release.


This version of axios might be problematic. Click here for more details.

package/CHANGELOG.md CHANGED
@@ -1,5 +1,40 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.6.3](https://github.com/axios/axios/compare/v1.6.2...v1.6.3) (2023-12-26)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * Regular Expression Denial of Service (ReDoS) ([#6132](https://github.com/axios/axios/issues/6132)) ([5e7ad38](https://github.com/axios/axios/commit/5e7ad38fb0f819fceb19fb2ee5d5d38f56aa837d))
9
+
10
+ ### Contributors to this release
11
+
12
+ - <img src="https://avatars.githubusercontent.com/u/4814473?v&#x3D;4&amp;s&#x3D;18" alt="avatar" width="18"/> [Jay](https://github.com/jasonsaayman "+15/-6 (#6145 )")
13
+ - <img src="https://avatars.githubusercontent.com/u/22686401?v&#x3D;4&amp;s&#x3D;18" alt="avatar" width="18"/> [Willian Agostini](https://github.com/WillianAgostini "+17/-2 (#6132 )")
14
+ - <img src="https://avatars.githubusercontent.com/u/12586868?v&#x3D;4&amp;s&#x3D;18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+3/-0 (#6084 )")
15
+
16
+ ## [1.6.2](https://github.com/axios/axios/compare/v1.6.1...v1.6.2) (2023-11-14)
17
+
18
+
19
+ ### Features
20
+
21
+ * **withXSRFToken:** added withXSRFToken option as a workaround to achieve the old `withCredentials` behavior; ([#6046](https://github.com/axios/axios/issues/6046)) ([cff9967](https://github.com/axios/axios/commit/cff996779b272a5e94c2b52f5503ccf668bc42dc))
22
+
23
+ ### PRs
24
+ - feat(withXSRFToken): added withXSRFToken option as a workaround to achieve the old &#x60;withCredentials&#x60; behavior; ( [#6046](https://api.github.com/repos/axios/axios/pulls/6046) )
25
+ ```
26
+
27
+ 📢 This PR added &#x27;withXSRFToken&#x27; option as a replacement for old withCredentials behaviour.
28
+ You should now use withXSRFToken along with withCredential to get the old behavior.
29
+ This functionality is considered as a fix.
30
+ ```
31
+
32
+ ### Contributors to this release
33
+
34
+ - <img src="https://avatars.githubusercontent.com/u/12586868?v&#x3D;4&amp;s&#x3D;18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+271/-146 (#6081 #6080 #6079 #6078 #6046 #6064 #6063 )")
35
+ - <img src="https://avatars.githubusercontent.com/u/79681367?v&#x3D;4&amp;s&#x3D;18" alt="avatar" width="18"/> [Ng Choon Khon (CK)](https://github.com/ckng0221 "+4/-4 (#6073 )")
36
+ - <img src="https://avatars.githubusercontent.com/u/9162827?v&#x3D;4&amp;s&#x3D;18" alt="avatar" width="18"/> [Muhammad Noman](https://github.com/mnomanmemon "+2/-2 (#6048 )")
37
+
3
38
  ## [1.6.1](https://github.com/axios/axios/compare/v1.6.0...v1.6.1) (2023-11-08)
4
39
 
5
40
 
@@ -13,6 +48,15 @@
13
48
  - <img src="https://avatars.githubusercontent.com/u/12586868?v&#x3D;4&amp;s&#x3D;18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+432/-65 (#6059 #6056 #6055 )")
14
49
  - <img src="https://avatars.githubusercontent.com/u/3982806?v&#x3D;4&amp;s&#x3D;18" alt="avatar" width="18"/> [Fabian Meyer](https://github.com/meyfa "+5/-2 (#5835 )")
15
50
 
51
+ ### PRs
52
+ - feat(withXSRFToken): added withXSRFToken option as a workaround to achieve the old &#x60;withCredentials&#x60; behavior; ( [#6046](https://api.github.com/repos/axios/axios/pulls/6046) )
53
+ ```
54
+
55
+ 📢 This PR added &#x27;withXSRFToken&#x27; option as a replacement for old withCredentials behaviour.
56
+ You should now use withXSRFToken along with withCredential to get the old behavior.
57
+ This functionality is considered as a fix.
58
+ ```
59
+
16
60
  # [1.6.0](https://github.com/axios/axios/compare/v1.5.1...v1.6.0) (2023-10-26)
17
61
 
18
62
 
package/README.md CHANGED
@@ -1,8 +1,17 @@
1
- <h1 align="center">
2
- <b>
3
- <a href="https://axios-http.com"><img src="https://axios-http.com/assets/logo.svg" /></a><br>
4
- </b>
5
- </h1>
1
+ <div align="center">
2
+ <a href="https://axios-http.com"><img src="https://axios-http.com/assets/logo.svg" /></a><br>
3
+ </div>
4
+
5
+ <h3 align="center">
6
+ A special thanks to your headline sponsors
7
+ <br><br>
8
+ </h3>
9
+
10
+ <div align="center">
11
+ <a href="https://runalloy.com?utm_source=github&utm_medium=referral&utm_campaign=121423_axios"><img style="width:20rem" src="https://github.com/axios/axios/assets/4814473/d50a6cbb-bbe7-4e70-9e1a-f698c6cdc437" /></a>
12
+ <br><br>
13
+ </div>
14
+
6
15
 
7
16
  <p align="center">Promise based HTTP client for the browser and node.js</p>
8
17
 
@@ -452,6 +461,9 @@ These are the available config options for making requests. Only the `url` is re
452
461
 
453
462
  // `xsrfHeaderName` is the name of the http header that carries the xsrf token value
454
463
  xsrfHeaderName: 'X-XSRF-TOKEN', // default
464
+
465
+ // `undefined` (default) - set XSRF header only for the same origin requests
466
+ withXSRFToken: boolean | undefined | ((config: InternalAxiosRequestConfig) => boolean | undefined),
455
467
 
456
468
  // `onUploadProgress` allows handling of progress events for uploads
457
469
  // browser & node.js
@@ -543,7 +555,7 @@ These are the available config options for making requests. Only the `url` is re
543
555
  // automatically. If set to `true` will also remove the 'content-encoding' header
544
556
  // from the responses objects of all decompressed responses
545
557
  // - Node only (XHR cannot turn off decompression)
546
- decompress: true // default
558
+ decompress: true, // default
547
559
 
548
560
  // `insecureHTTPParser` boolean.
549
561
  // Indicates where to use an insecure HTTP parser that accepts invalid HTTP headers.
@@ -551,7 +563,7 @@ These are the available config options for making requests. Only the `url` is re
551
563
  // Using the insecure parser should be avoided.
552
564
  // see options https://nodejs.org/dist/latest-v12.x/docs/api/http.html#http_http_request_url_options_callback
553
565
  // see also https://nodejs.org/en/blog/vulnerability/february-2020-security-releases/#strict-http-header-parsing-none
554
- insecureHTTPParser: undefined // default
566
+ insecureHTTPParser: undefined, // default
555
567
 
556
568
  // transitional options for backward compatibility that may be removed in the newer versions
557
569
  transitional: {
package/dist/axios.js CHANGED
@@ -1,4 +1,4 @@
1
- // Axios v1.6.1 Copyright (c) 2023 Matt Zabriskie and contributors
1
+ // Axios v1.6.3 Copyright (c) 2023 Matt Zabriskie and contributors
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) :
@@ -1910,44 +1910,31 @@
1910
1910
 
1911
1911
  var cookies = platform.hasStandardBrowserEnv ?
1912
1912
  // Standard browser envs support document.cookie
1913
- function standardBrowserEnv() {
1914
- return {
1915
- write: function write(name, value, expires, path, domain, secure) {
1916
- var cookie = [];
1917
- cookie.push(name + '=' + encodeURIComponent(value));
1918
- if (utils$1.isNumber(expires)) {
1919
- cookie.push('expires=' + new Date(expires).toGMTString());
1920
- }
1921
- if (utils$1.isString(path)) {
1922
- cookie.push('path=' + path);
1923
- }
1924
- if (utils$1.isString(domain)) {
1925
- cookie.push('domain=' + domain);
1926
- }
1927
- if (secure === true) {
1928
- cookie.push('secure');
1929
- }
1930
- document.cookie = cookie.join('; ');
1931
- },
1932
- read: function read(name) {
1933
- var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
1934
- return match ? decodeURIComponent(match[3]) : null;
1935
- },
1936
- remove: function remove(name) {
1937
- this.write(name, '', Date.now() - 86400000);
1938
- }
1939
- };
1940
- }() :
1941
- // Non standard browser env (web workers, react-native) lack needed support.
1942
- function nonStandardBrowserEnv() {
1943
- return {
1944
- write: function write() {},
1945
- read: function read() {
1946
- return null;
1947
- },
1948
- remove: function remove() {}
1949
- };
1950
- }();
1913
+ {
1914
+ write: function write(name, value, expires, path, domain, secure) {
1915
+ var cookie = [name + '=' + encodeURIComponent(value)];
1916
+ utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
1917
+ utils$1.isString(path) && cookie.push('path=' + path);
1918
+ utils$1.isString(domain) && cookie.push('domain=' + domain);
1919
+ secure === true && cookie.push('secure');
1920
+ document.cookie = cookie.join('; ');
1921
+ },
1922
+ read: function read(name) {
1923
+ var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
1924
+ return match ? decodeURIComponent(match[3]) : null;
1925
+ },
1926
+ remove: function remove(name) {
1927
+ this.write(name, '', Date.now() - 86400000);
1928
+ }
1929
+ } :
1930
+ // Non-standard browser env (web workers, react-native) lack needed support.
1931
+ {
1932
+ write: function write() {},
1933
+ read: function read() {
1934
+ return null;
1935
+ },
1936
+ remove: function remove() {}
1937
+ };
1951
1938
 
1952
1939
  /**
1953
1940
  * Determines whether the specified URL is absolute
@@ -1972,7 +1959,7 @@
1972
1959
  * @returns {string} The combined URL
1973
1960
  */
1974
1961
  function combineURLs(baseURL, relativeURL) {
1975
- return relativeURL ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '') : baseURL;
1962
+ return relativeURL ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '') : baseURL;
1976
1963
  }
1977
1964
 
1978
1965
  /**
@@ -2001,7 +1988,7 @@
2001
1988
  var originURL;
2002
1989
 
2003
1990
  /**
2004
- * Parse a URL to discover it's components
1991
+ * Parse a URL to discover its components
2005
1992
  *
2006
1993
  * @param {String} url The URL to be parsed
2007
1994
  * @returns {Object}
@@ -2120,7 +2107,8 @@
2120
2107
  return new Promise(function dispatchXhrRequest(resolve, reject) {
2121
2108
  var requestData = config.data;
2122
2109
  var requestHeaders = AxiosHeaders$1.from(config.headers).normalize();
2123
- var responseType = config.responseType;
2110
+ var responseType = config.responseType,
2111
+ withXSRFToken = config.withXSRFToken;
2124
2112
  var onCanceled;
2125
2113
  function done() {
2126
2114
  if (config.cancelToken) {
@@ -2245,11 +2233,13 @@
2245
2233
  // This is only done if running in a standard browser environment.
2246
2234
  // Specifically not if we're in a web worker, or react-native.
2247
2235
  if (platform.hasStandardBrowserEnv) {
2248
- // Add xsrf header
2249
- // regarding CVE-2023-45857 config.withCredentials condition was removed temporarily
2250
- var xsrfValue = isURLSameOrigin(fullPath) && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
2251
- if (xsrfValue) {
2252
- requestHeaders.set(config.xsrfHeaderName, xsrfValue);
2236
+ withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config));
2237
+ if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(fullPath)) {
2238
+ // Add xsrf header
2239
+ var xsrfValue = config.xsrfHeaderName && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
2240
+ if (xsrfValue) {
2241
+ requestHeaders.set(config.xsrfHeaderName, xsrfValue);
2242
+ }
2253
2243
  }
2254
2244
  }
2255
2245
 
@@ -2499,6 +2489,7 @@
2499
2489
  timeout: defaultToConfig2,
2500
2490
  timeoutMessage: defaultToConfig2,
2501
2491
  withCredentials: defaultToConfig2,
2492
+ withXSRFToken: defaultToConfig2,
2502
2493
  adapter: defaultToConfig2,
2503
2494
  responseType: defaultToConfig2,
2504
2495
  xsrfCookieName: defaultToConfig2,
@@ -2528,7 +2519,7 @@
2528
2519
  return config;
2529
2520
  }
2530
2521
 
2531
- var VERSION = "1.6.1";
2522
+ var VERSION = "1.6.3";
2532
2523
 
2533
2524
  var validators$1 = {};
2534
2525