Skip to content

Commit

Permalink
Bump node version to 14.20.0 (#2101) (#2109)
Browse files Browse the repository at this point in the history
* 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 <ananzh@amazon.com>

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>

Co-authored-by: Kawika Avilla <kavilla414@gmail.com>
(cherry picked from commit c818d99)

Co-authored-by: Anan Zhuang <ananzh@amazon.com>
  • Loading branch information
opensearch-trigger-bot[bot] and ananzh authored Aug 9, 2022
1 parent 3bf21c9 commit 0a848a7
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.19.1
14.20.0
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.19.1
14.20.0
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG NODE_VERSION=14.19.1
ARG NODE_VERSION=14.20.0
FROM node:${NODE_VERSION} AS base

ENV HOME '.'
Expand Down
2 changes: 1 addition & 1 deletion TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@
"zlib": "^1.0.5"
},
"engines": {
"node": "14.19.1",
"node": "14.20.0",
"yarn": "^1.21.1"
}
}
}
27 changes: 21 additions & 6 deletions src/setup_node_env/node_version_validator.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,31 +43,46 @@ 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) {
testValidateNodeVersion(done, requiredNodeVersionWithDiff(+1, 0, 0), true);
});

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) {
testValidateNodeVersion(done, requiredNodeVersionWithDiff(0, +1, 0), true);
});

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}`;
}
Expand Down
16 changes: 8 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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"

Expand Down Expand Up @@ -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==
Expand Down Expand Up @@ -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==
Expand Down

0 comments on commit 0a848a7

Please sign in to comment.