From 1dd33358392f7fb4729182a6b2f507cbda93a9f0 Mon Sep 17 00:00:00 2001 From: Anan Zhuang Date: Tue, 9 Aug 2022 12:57:19 -0700 Subject: [PATCH] Bump node version to 14.20.0 (#2101) * bump node version to 14.20.0 to solve CVE issue Issue: N/a CVE issue: https://nvd.nist.gov/vuln/detail/CVE-2022-32214 [Tests] fix issue with tests and 0 values for node version Signed-off-by: Anan Zhuang Signed-off-by: Kawika Avilla Co-authored-by: Kawika Avilla (cherry picked from commit c818d99eaf6d768f5d8a0bb57a9d60325153cd0c) --- .node-version | 2 +- .nvmrc | 2 +- Dockerfile | 2 +- TESTING.md | 2 +- package.json | 4 +-- .../node_version_validator.test.js | 27 ++++++++++++++----- yarn.lock | 16 +++++------ 7 files changed, 35 insertions(+), 20 deletions(-) diff --git a/.node-version b/.node-version index 9ddeebac881c..a3eb5a03fa6a 100644 --- a/.node-version +++ b/.node-version @@ -1 +1 @@ -14.19.1 +14.20.0 diff --git a/.nvmrc b/.nvmrc index 9ddeebac881c..a3eb5a03fa6a 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -14.19.1 +14.20.0 diff --git a/Dockerfile b/Dockerfile index f976d4875114..d5fddcd2c6cf 100755 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -ARG NODE_VERSION=14.19.1 +ARG NODE_VERSION=14.20.0 FROM node:${NODE_VERSION} AS base ENV HOME '.' diff --git a/TESTING.md b/TESTING.md index 62a2dfd53956..d93475e4b317 100644 --- a/TESTING.md +++ b/TESTING.md @@ -24,7 +24,7 @@ In general, we recommend four tiers of tests: # Requirements * Install the latest NodeJS, [NPM](https://www.npmjs.com/get-npm) and [Yarn](https://classic.yarnpkg.com/en/docs/install/#mac-stable) - * `nvm install v14.19.1` + * `nvm install v14.20.0` * `npm install -g yarn` # Running tests diff --git a/package.json b/package.json index 57340a2752be..d2553a7376c6 100644 --- a/package.json +++ b/package.json @@ -451,7 +451,7 @@ "zlib": "^1.0.5" }, "engines": { - "node": "14.19.1", + "node": "14.20.0", "yarn": "^1.21.1" } -} +} \ No newline at end of file diff --git a/src/setup_node_env/node_version_validator.test.js b/src/setup_node_env/node_version_validator.test.js index 4e95f7219d5a..cb3639154c6c 100644 --- a/src/setup_node_env/node_version_validator.test.js +++ b/src/setup_node_env/node_version_validator.test.js @@ -43,7 +43,12 @@ describe('NodeVersionValidator', function () { }); it('should run the script WITH error if the patch version is lower', function (done) { - testValidateNodeVersion(done, requiredNodeVersionWithDiff(0, 0, -1), true); + var lowerPatchversion = requiredNodeVersionWithDiff(0, 0, -1); + testValidateNodeVersion( + done, + lowerPatchversion, + REQUIRED_NODE_JS_VERSION !== lowerPatchversion + ); }); it('should run the script WITH error if the major version is higher', function (done) { @@ -51,7 +56,12 @@ describe('NodeVersionValidator', function () { }); it('should run the script WITH error if the major version is lower', function (done) { - testValidateNodeVersion(done, requiredNodeVersionWithDiff(-1, 0, 0), true); + var lowerMajorVersion = requiredNodeVersionWithDiff(-1, 0, 0); + testValidateNodeVersion( + done, + lowerMajorVersion, + REQUIRED_NODE_JS_VERSION !== lowerMajorVersion + ); }); it('should run the script WITH error if the minor version is higher', function (done) { @@ -59,15 +69,20 @@ describe('NodeVersionValidator', function () { }); it('should run the script WITH error if the minor version is lower', function (done) { - testValidateNodeVersion(done, requiredNodeVersionWithDiff(0, -1, 0), true); + var lowerMinorVersion = requiredNodeVersionWithDiff(0, -1, 0); + testValidateNodeVersion( + done, + lowerMinorVersion, + REQUIRED_NODE_JS_VERSION !== lowerMinorVersion + ); }); }); function requiredNodeVersionWithDiff(majorDiff, minorDiff, patchDiff) { var matches = REQUIRED_NODE_JS_VERSION.match(/^v(\d+)\.(\d+)\.(\d+)/); - var major = parseInt(matches[1]) + majorDiff; - var minor = parseInt(matches[2]) + minorDiff; - var patch = parseInt(matches[3]) + patchDiff; + var major = Math.max(parseInt(matches[1], 10) + majorDiff, 0); + var minor = Math.max(parseInt(matches[2], 10) + minorDiff, 0); + var patch = Math.max(parseInt(matches[3], 10) + patchDiff, 0); return `v${major}.${minor}.${patch}`; } diff --git a/yarn.lock b/yarn.lock index 7aa2b9359a83..7fdc7b394c0f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1120,10 +1120,10 @@ resolved "https://registry.yarnpkg.com/@elastic/eslint-plugin-eui/-/eslint-plugin-eui-0.0.2.tgz#56b9ef03984a05cc213772ae3713ea8ef47b0314" integrity sha512-IoxURM5zraoQ7C8f+mJb9HYSENiZGgRVcG4tLQxE61yHNNRDXtGDWTZh8N1KIHcsqN1CEPETjuzBXkJYF/fDiQ== -"@elastic/eui@34.6.0": - version "34.6.0" - resolved "https://registry.yarnpkg.com/@elastic/eui/-/eui-34.6.0.tgz#a7188bc97d9c3120cd65e52ed423377872b604bd" - integrity sha512-uVMSX0jPJU3LLwD4TRHllyJeTr+Uihh+R5qsFSAzKrCCRZjSfKMmMHKffWhzFyYjG97npdWlMvneXG5q0yobCw== +"@elastic/eui@npm:@opensearch-project/oui@1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@opensearch-project/oui/-/oui-1.0.0.tgz#bf5e115c8d0f230415b07cc6acfb149ab081c5de" + integrity sha512-J709UQc7+il4y3aiqpHzeLOJAQhN6xEGLLHq4sUL3WHTsP37acONINXCpRNMa3FxZ+ChOd2ABmY+Ajs+fIgmug== dependencies: "@types/chroma-js" "^2.0.0" "@types/lodash" "^4.14.160" @@ -1149,7 +1149,7 @@ react-is "~16.3.0" react-virtualized-auto-sizer "^1.0.2" react-window "^1.8.5" - refractor "^3.4.0" + refractor "^3.6.0" rehype-raw "^5.0.0" rehype-react "^6.0.0" rehype-stringify "^8.0.0" @@ -1160,7 +1160,7 @@ text-diff "^1.0.1" unified "^9.2.0" unist-util-visit "^2.0.3" - url-parse "^1.5.0" + url-parse "^1.5.9" uuid "^8.3.0" vfile "^4.2.0" @@ -15010,7 +15010,7 @@ reflect.ownkeys@^0.2.0: resolved "https://registry.yarnpkg.com/reflect.ownkeys/-/reflect.ownkeys-0.2.0.tgz#749aceec7f3fdf8b63f927a04809e90c5c0b3460" integrity sha1-dJrO7H8/34tj+SegSAnpDFwLNGA= -refractor@^3.4.0: +refractor@^3.6.0: version "3.6.0" resolved "https://registry.yarnpkg.com/refractor/-/refractor-3.6.0.tgz#ac318f5a0715ead790fcfb0c71f4dd83d977935a" integrity sha512-MY9W41IOWxxk31o+YvFCNyNzdkc9M20NoZK5vq6jkv4I/uh2zkWcfudj0Q1fovjUQJrNewS9NMzeTtqPf+n5EA== @@ -17806,7 +17806,7 @@ url-loader@^2.2.0: mime "^2.4.4" schema-utils "^2.5.0" -url-parse@^1.5.0: +url-parse@^1.5.9: version "1.5.10" resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.10.tgz#9d3c2f736c1d75dd3bd2be507dcc111f1e2ea9c1" integrity sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==