Skip to content

Commit

Permalink
[7.17] Upgrades [email protected]→1.6.0 (elastic#170070) (elastic#170175)
Browse files Browse the repository at this point in the history
# Backport

This will backport the following commits from `main` to `7.17`:
- [Upgrades [email protected]→1.6.0
(elastic#170070)](elastic#170070)

<!--- Backport version: 8.9.8 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Jeramy
Soucy","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-10-30T18:40:50Z","message":"Upgrades
[email protected]→1.6.0 (elastic#170070)\n\n## Summary\r\n\r\nUpgrades the `axios`
dependency from v1.4.0 to v1.6.0 wherever possible.\r\nWe have lingering
dependencies on older versions 0.21.4 and 0.26.1
via\r\n`@slack/webhook`@5.0.4 and `openai`@3.3.0
respectively.","sha":"e17988c3d8a75712862b2ed06598d76dff7412ac","branchLabelMapping":{"^v8.12.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Security","release_note:skip","backport:all-open","v8.12.0"],"number":170070,"url":"https://github.com/elastic/kibana/pull/170070","mergeCommit":{"message":"Upgrades
[email protected]→1.6.0 (elastic#170070)\n\n## Summary\r\n\r\nUpgrades the `axios`
dependency from v1.4.0 to v1.6.0 wherever possible.\r\nWe have lingering
dependencies on older versions 0.21.4 and 0.26.1
via\r\n`@slack/webhook`@5.0.4 and `openai`@3.3.0
respectively.","sha":"e17988c3d8a75712862b2ed06598d76dff7412ac"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.12.0","labelRegex":"^v8.12.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/170070","number":170070,"mergeCommit":{"message":"Upgrades
[email protected]→1.6.0 (elastic#170070)\n\n## Summary\r\n\r\nUpgrades the `axios`
dependency from v1.4.0 to v1.6.0 wherever possible.\r\nWe have lingering
dependencies on older versions 0.21.4 and 0.26.1
via\r\n`@slack/webhook`@5.0.4 and `openai`@3.3.0
respectively.","sha":"e17988c3d8a75712862b2ed06598d76dff7412ac"}},{"url":"https://github.com/elastic/kibana/pull/170170","number":170170,"branch":"8.11","state":"OPEN"}]}]
BACKPORT-->

---------

Co-authored-by: kibanamachine <[email protected]>
  • Loading branch information
jeramysoucy and kibanamachine authored Nov 1, 2023
1 parent a3a94fe commit 35c228a
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 75 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@
"JSONStream": "1.3.5",
"ansi-regex": "^5.0.1",
"antlr4ts": "^0.5.0-alpha.3",
"archiver": "^5.2.0",
"axios": "^1.4.0",
"archiver": "^5.3.1",
"axios": "^1.6.0",
"base64-js": "^1.3.1",
"bluebird": "3.5.5",
"brace": "0.11.1",
Expand Down
150 changes: 98 additions & 52 deletions packages/kbn-pm/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11902,6 +11902,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AxiosHeaders", function() { return AxiosHeaders; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpStatusCode", function() { return HttpStatusCode; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "formToJSON", function() { return formToJSON; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getAdapter", function() { return getAdapter; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mergeConfig", function() { return mergeConfig; });
/* harmony import */ var _lib_axios_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(178);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _lib_axios_js__WEBPACK_IMPORTED_MODULE_0__["default"]; });
Expand All @@ -11926,6 +11927,7 @@ const {
AxiosHeaders,
HttpStatusCode,
formToJSON,
getAdapter,
mergeConfig
} = _lib_axios_js__WEBPACK_IMPORTED_MODULE_0__["default"];

Expand Down Expand Up @@ -11953,7 +11955,9 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var _helpers_spread_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(253);
/* harmony import */ var _helpers_isAxiosError_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(254);
/* harmony import */ var _core_AxiosHeaders_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(217);
/* harmony import */ var _helpers_HttpStatusCode_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(255);
/* harmony import */ var _adapters_adapters_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(221);
/* harmony import */ var _helpers_HttpStatusCode_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(255);




Expand Down Expand Up @@ -12034,7 +12038,9 @@ axios.AxiosHeaders = _core_AxiosHeaders_js__WEBPACK_IMPORTED_MODULE_14__["defaul

axios.formToJSON = thing => Object(_helpers_formDataToJSON_js__WEBPACK_IMPORTED_MODULE_5__["default"])(_utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].isHTMLForm(thing) ? new FormData(thing) : thing);

axios.HttpStatusCode = _helpers_HttpStatusCode_js__WEBPACK_IMPORTED_MODULE_15__["default"];
axios.getAdapter = _adapters_adapters_js__WEBPACK_IMPORTED_MODULE_15__["default"].getAdapter;

axios.HttpStatusCode = _helpers_HttpStatusCode_js__WEBPACK_IMPORTED_MODULE_16__["default"];

axios.default = axios;

Expand Down Expand Up @@ -12591,8 +12597,9 @@ const reduceDescriptors = (obj, reducer) => {
const reducedDescriptors = {};

forEach(descriptors, (descriptor, name) => {
if (reducer(descriptor, name, obj) !== false) {
reducedDescriptors[name] = descriptor;
let ret;
if ((ret = reducer(descriptor, name, obj)) !== false) {
reducedDescriptors[name] = ret || descriptor;
}
});

Expand Down Expand Up @@ -12878,15 +12885,13 @@ class Axios {
// Set config.method
config.method = (config.method || this.defaults.method || 'get').toLowerCase();

let contextHeaders;

// Flatten headers
contextHeaders = headers && _utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].merge(
let contextHeaders = headers && _utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].merge(
headers.common,
headers[config.method]
);

contextHeaders && _utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].forEach(
headers && _utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].forEach(
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
(method) => {
delete headers[method];
Expand Down Expand Up @@ -15258,10 +15263,6 @@ __webpack_require__.r(__webpack_exports__);



const DEFAULT_CONTENT_TYPE = {
'Content-Type': undefined
};

/**
* It takes a string, tries to parse it, and if it fails, it returns the stringified version
* of the input
Expand Down Expand Up @@ -15400,19 +15401,16 @@ const defaults = {

headers: {
common: {
'Accept': 'application/json, text/plain, */*'
'Accept': 'application/json, text/plain, */*',
'Content-Type': undefined
}
}
};

_utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
_utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
defaults.headers[method] = {};
});

_utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
defaults.headers[method] = _utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].merge(DEFAULT_CONTENT_TYPE);
});

/* harmony default export */ __webpack_exports__["default"] = (defaults);


Expand Down Expand Up @@ -15904,7 +15902,17 @@ class AxiosHeaders {

AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);

_utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].freezeMethods(AxiosHeaders.prototype);
// reserved names hotfix
_utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
return {
get: () => value,
set(headerValue) {
this[mapped] = headerValue;
}
}
});

_utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].freezeMethods(AxiosHeaders);

/* harmony default export */ __webpack_exports__["default"] = (AxiosHeaders);
Expand Down Expand Up @@ -16044,7 +16052,7 @@ const knownAdapters = {
}

_utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].forEach(knownAdapters, (fn, value) => {
if(fn) {
if (fn) {
try {
Object.defineProperty(fn, 'name', {value});
} catch (e) {
Expand All @@ -16054,6 +16062,10 @@ _utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].forEach(knownAdapters, (fn, va
}
});

const renderReason = (reason) => `- ${reason}`;

const isResolvedHandle = (adapter) => _utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].isFunction(adapter) || adapter === null || adapter === false;

/* harmony default export */ __webpack_exports__["default"] = ({
getAdapter: (adapters) => {
adapters = _utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].isArray(adapters) ? adapters : [adapters];
Expand All @@ -16062,30 +16074,44 @@ _utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].forEach(knownAdapters, (fn, va
let nameOrAdapter;
let adapter;

const rejectedReasons = {};

for (let i = 0; i < length; i++) {
nameOrAdapter = adapters[i];
if((adapter = _utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].isString(nameOrAdapter) ? knownAdapters[nameOrAdapter.toLowerCase()] : nameOrAdapter)) {
let id;

adapter = nameOrAdapter;

if (!isResolvedHandle(nameOrAdapter)) {
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];

if (adapter === undefined) {
throw new _core_AxiosError_js__WEBPACK_IMPORTED_MODULE_3__["default"](`Unknown adapter '${id}'`);
}
}

if (adapter) {
break;
}

rejectedReasons[id || '#' + i] = adapter;
}

if (!adapter) {
if (adapter === false) {
throw new _core_AxiosError_js__WEBPACK_IMPORTED_MODULE_3__["default"](
`Adapter ${nameOrAdapter} is not supported by the environment`,
'ERR_NOT_SUPPORT'

const reasons = Object.entries(rejectedReasons)
.map(([id, state]) => `adapter ${id} ` +
(state === false ? 'is not supported by the environment' : 'is not available in the build')
);
}

throw new Error(
_utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].hasOwnProp(knownAdapters, nameOrAdapter) ?
`Adapter '${nameOrAdapter}' is not available in the build` :
`Unknown adapter '${nameOrAdapter}'`
);
}
let s = length ?
(reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
'as no adapter specified';

if (!_utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].isFunction(adapter)) {
throw new TypeError('adapter is not a function');
throw new _core_AxiosError_js__WEBPACK_IMPORTED_MODULE_3__["default"](
`There is no suitable adapter to dispatch the request ` + s,
'ERR_NOT_SUPPORT'
);
}

return adapter;
Expand Down Expand Up @@ -16279,6 +16305,18 @@ const wrapAsync = (asyncExecutor) => {
})
};

const resolveFamily = ({address, family}) => {
if (!_utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].isString(address)) {
throw TypeError('address must be a string');
}
return ({
address,
family: family || (address.indexOf('.') < 0 ? 6 : 4)
});
}

const buildAddressEntry = (address, family) => resolveFamily(_utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].isObject(address) ? address : {address, family});

/*eslint consistent-return:0*/
/* harmony default export */ __webpack_exports__["default"] = (isHttpAdapterSupported && function httpAdapter(config) {
return wrapAsync(async function dispatchHttpRequest(resolve, reject, onDone) {
Expand All @@ -16289,15 +16327,16 @@ const wrapAsync = (asyncExecutor) => {
let rejected = false;
let req;

if (lookup && _utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].isAsyncFn(lookup)) {
lookup = Object(_helpers_callbackify_js__WEBPACK_IMPORTED_MODULE_23__["default"])(lookup, (entry) => {
if(_utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].isString(entry)) {
entry = [entry, entry.indexOf('.') < 0 ? 6 : 4]
} else if (!_utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].isArray(entry)) {
throw new TypeError('lookup async function must return an array [ip: string, family: number]]')
}
return entry;
})
if (lookup) {
const _lookup = Object(_helpers_callbackify_js__WEBPACK_IMPORTED_MODULE_23__["default"])(lookup, (value) => _utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].isArray(value) ? value : [value]);
// hotfix to support opt.all option which is required for node 20.x
lookup = (hostname, opt, cb) => {
_lookup(hostname, opt, (err, arg0, arg1) => {
const addresses = _utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].isArray(arg0) ? arg0.map(addr => buildAddressEntry(addr)) : [buildAddressEntry(arg0, arg1)];

opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
});
}
}

// temporary internal emitter until the AxiosRequest class will be implemented
Expand Down Expand Up @@ -16526,11 +16565,13 @@ const wrapAsync = (asyncExecutor) => {
auth,
protocol,
family,
lookup,
beforeRedirect: dispatchBeforeRedirect,
beforeRedirects: {}
};

// cacheable-lookup integration hotfix
!_utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].isUndefined(lookup) && (options.lookup = lookup);

if (config.socketPath) {
options.socketPath = config.socketPath;
} else {
Expand Down Expand Up @@ -16604,7 +16645,7 @@ const wrapAsync = (asyncExecutor) => {
delete res.headers['content-encoding'];
}

switch (res.headers['content-encoding']) {
switch ((res.headers['content-encoding'] || '').toLowerCase()) {
/*eslint default-case:0*/
case 'gzip':
case 'x-gzip':
Expand Down Expand Up @@ -16700,7 +16741,7 @@ const wrapAsync = (asyncExecutor) => {
}
response.data = responseData;
} catch (err) {
reject(_core_AxiosError_js__WEBPACK_IMPORTED_MODULE_12__["default"].from(err, null, config, response.request, response));
return reject(_core_AxiosError_js__WEBPACK_IMPORTED_MODULE_12__["default"].from(err, null, config, response.request, response));
}
Object(_core_settle_js__WEBPACK_IMPORTED_MODULE_1__["default"])(resolve, reject, response);
});
Expand Down Expand Up @@ -16737,7 +16778,7 @@ const wrapAsync = (asyncExecutor) => {
// This is forcing a int timeout to avoid problems if the `req` interface doesn't handle other types.
const timeout = parseInt(config.timeout, 10);

if (isNaN(timeout)) {
if (Number.isNaN(timeout)) {
reject(new _core_AxiosError_js__WEBPACK_IMPORTED_MODULE_12__["default"](
'error trying to parse `config.timeout` to int',
_core_AxiosError_js__WEBPACK_IMPORTED_MODULE_12__["default"].ERR_BAD_OPTION_VALUE,
Expand Down Expand Up @@ -18527,7 +18568,7 @@ module.exports = require("zlib");
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VERSION", function() { return VERSION; });
const VERSION = "1.4.0";
const VERSION = "1.6.0";

/***/ }),
/* 238 */
Expand Down Expand Up @@ -19210,11 +19251,16 @@ const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
}
}

let contentType;

if (_utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].isFormData(requestData)) {
if (_platform_index_js__WEBPACK_IMPORTED_MODULE_10__["default"].isStandardBrowserEnv || _platform_index_js__WEBPACK_IMPORTED_MODULE_10__["default"].isStandardBrowserWebWorkerEnv) {
requestHeaders.setContentType(false); // Let the browser set it
} else {
requestHeaders.setContentType('multipart/form-data;', false); // mobile/desktop app frameworks
} else if(!requestHeaders.getContentType(/^\s*multipart\/form-data/)){
requestHeaders.setContentType('multipart/form-data'); // mobile/desktop app frameworks
} else if(_utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].isString(contentType = requestHeaders.getContentType())){
// fix semicolon duplication issue for ReactNative FormData implementation
requestHeaders.setContentType(contentType.replace(/^\s*(multipart\/form-data);+/, '$1'))
}
}

Expand Down Expand Up @@ -19332,8 +19378,8 @@ const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
// Specifically not if we're in a web worker, or react-native.
if (_platform_index_js__WEBPACK_IMPORTED_MODULE_10__["default"].isStandardBrowserEnv) {
// Add xsrf header
const xsrfValue = (config.withCredentials || Object(_helpers_isURLSameOrigin_js__WEBPACK_IMPORTED_MODULE_5__["default"])(fullPath))
&& config.xsrfCookieName && _helpers_cookies_js__WEBPACK_IMPORTED_MODULE_2__["default"].read(config.xsrfCookieName);
// regarding CVE-2023-45857 config.withCredentials condition was removed temporarily
const xsrfValue = Object(_helpers_isURLSameOrigin_js__WEBPACK_IMPORTED_MODULE_5__["default"])(fullPath) && config.xsrfCookieName && _helpers_cookies_js__WEBPACK_IMPORTED_MODULE_2__["default"].read(config.xsrfCookieName);

if (xsrfValue) {
requestHeaders.set(config.xsrfHeaderName, xsrfValue);
Expand Down
29 changes: 8 additions & 21 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8047,19 +8047,6 @@ archiver-utils@^2.1.0:
normalize-path "^3.0.0"
readable-stream "^2.0.0"

archiver@^5.2.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/archiver/-/archiver-5.2.0.tgz#25aa1b3d9febf7aec5b0f296e77e69960c26db94"
integrity sha512-QEAKlgQuAtUxKeZB9w5/ggKXh21bZS+dzzuQ0RPBC20qtDCbTyzqmisoeJP46MP39fg4B4IcyvR+yeyEBdblsQ==
dependencies:
archiver-utils "^2.1.0"
async "^3.2.0"
buffer-crc32 "^0.2.1"
readable-stream "^3.6.0"
readdir-glob "^1.0.0"
tar-stream "^2.1.4"
zip-stream "^4.0.4"

archiver@^5.3.1:
version "5.3.1"
resolved "https://registry.yarnpkg.com/archiver/-/archiver-5.3.1.tgz#21e92811d6f09ecfce649fbefefe8c79e57cbbb6"
Expand Down Expand Up @@ -8594,9 +8581,9 @@ aws-sign2@~0.7.0:
integrity sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=

aws4@^1.8.0:
version "1.8.0"
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.8.0.tgz#f0e003d9ca9e7f59c7a508945d7b2ef9a04a542f"
integrity sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==
version "1.12.0"
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.12.0.tgz#ce1c9d143389679e253b314241ea9aa5cec980d3"
integrity sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg==

axe-core@^4.0.2:
version "4.0.2"
Expand All @@ -8615,10 +8602,10 @@ axios@^0.21.1:
dependencies:
follow-redirects "^1.14.0"

axios@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/axios/-/axios-1.4.0.tgz#38a7bf1224cd308de271146038b551d725f0be1f"
integrity sha512-S4XCWMEmzvo64T9GfvQDOXgYRDJ/wsSZc7Jvdgx5u1sd0JwsuPLqb3SYmusag+edF6ziyMensPVqLTSc1PiSEA==
axios@^1.4.0, axios@^1.6.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/axios/-/axios-1.6.0.tgz#f1e5292f26b2fd5c2e66876adc5b06cdbd7d2102"
integrity sha512-EZ1DYihju9pwVB+jg67ogm+Tmqc6JmhamRN6I4Zt8DfZu5lbcQGw3ozH9lFejSJgs/ibaef3A9PMXPLeefFGJg==
dependencies:
follow-redirects "^1.15.0"
form-data "^4.0.0"
Expand Down Expand Up @@ -30262,7 +30249,7 @@ z-schema@~5.0.2:
optionalDependencies:
commander "^2.20.3"

zip-stream@^4.0.4, zip-stream@^4.1.0:
zip-stream@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/zip-stream/-/zip-stream-4.1.0.tgz#51dd326571544e36aa3f756430b313576dc8fc79"
integrity sha512-zshzwQW7gG7hjpBlgeQP9RuyPGNxvJdzR8SUM3QhxCnLjWN2E7j3dOvpeDcQoETfHx0urRS7EtmVToql7YpU4A==
Expand Down

0 comments on commit 35c228a

Please sign in to comment.