From c0e86bd8b80732a11c4c8936d022212f01b8c5be Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 29 Sep 2022 13:21:32 -0400 Subject: [PATCH 1/3] Bump vm2 from 3.9.10 to 3.9.11 (#2) Bumps [vm2](https://github.com/patriksimek/vm2) from 3.9.10 to 3.9.11. - [Release notes](https://github.com/patriksimek/vm2/releases) - [Changelog](https://github.com/patriksimek/vm2/blob/master/CHANGELOG.md) - [Commits](https://github.com/patriksimek/vm2/compare/3.9.10...3.9.11) --- updated-dependencies: - dependency-name: vm2 dependency-type: indirect ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5baeb964..0831efc1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3460,6 +3460,12 @@ "ms": "^2.0.0" } }, + "husky": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.1.tgz", + "integrity": "sha512-xs7/chUH/CKdOCs7Zy0Aev9e/dKOMZf3K1Az1nar3tzlv0jfqnYtu235bstsWTmXOR0EfINrPa97yy4Lz6RiKw==", + "dev": true + }, "hyperlinker": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/hyperlinker/-/hyperlinker-1.0.0.tgz", @@ -8367,9 +8373,9 @@ } }, "vm2": { - "version": "3.9.10", - "resolved": "https://registry.npmjs.org/vm2/-/vm2-3.9.10.tgz", - "integrity": "sha512-AuECTSvwu2OHLAZYhG716YzwodKCIJxB6u1zG7PgSQwIgAlEaoXH52bxdcvT8GkGjnYK7r7yWDW0m0sOsPuBjQ==", + "version": "3.9.11", + "resolved": "https://registry.npmjs.org/vm2/-/vm2-3.9.11.tgz", + "integrity": "sha512-PFG8iJRSjvvBdisowQ7iVF580DXb1uCIiGaXgm7tynMR1uTBlv7UJlB1zdv5KJ+Tmq1f0Upnj3fayoEOPpCBKg==", "requires": { "acorn": "^8.7.0", "acorn-walk": "^8.2.0" From bbf7e14a364b06fb80394b4da2c33bade9633d16 Mon Sep 17 00:00:00 2001 From: TrellixVulnTeam <112716341+TrellixVulnTeam@users.noreply.github.com> Date: Wed, 26 Oct 2022 15:25:35 -0500 Subject: [PATCH 2/3] Adding tarfile member sanitization to extractall() (#3) --- node_modules/node-gyp/update-gyp.py | 21 ++++++++++++++++++- .../npm/node_modules/node-gyp/update-gyp.py | 21 ++++++++++++++++++- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/node_modules/node-gyp/update-gyp.py b/node_modules/node-gyp/update-gyp.py index bb84f071..73277d80 100755 --- a/node_modules/node-gyp/update-gyp.py +++ b/node_modules/node-gyp/update-gyp.py @@ -33,7 +33,26 @@ print("Unzipping...") with tarfile.open(tar_file, "r:gz") as tar_ref: - tar_ref.extractall(unzip_target) + def is_within_directory(directory, target): + + abs_directory = os.path.abspath(directory) + abs_target = os.path.abspath(target) + + prefix = os.path.commonprefix([abs_directory, abs_target]) + + return prefix == abs_directory + + def safe_extract(tar, path=".", members=None, *, numeric_owner=False): + + for member in tar.getmembers(): + member_path = os.path.join(path, member.name) + if not is_within_directory(path, member_path): + raise Exception("Attempted Path Traversal in Tar File") + + tar.extractall(path, members, numeric_owner=numeric_owner) + + + safe_extract(tar_ref, unzip_target) print("Moving to current checkout (" + CHECKOUT_PATH + ")...") if os.path.exists(CHECKOUT_GYP_PATH): diff --git a/node_modules/npm/node_modules/node-gyp/update-gyp.py b/node_modules/npm/node_modules/node-gyp/update-gyp.py index bb84f071..73277d80 100755 --- a/node_modules/npm/node_modules/node-gyp/update-gyp.py +++ b/node_modules/npm/node_modules/node-gyp/update-gyp.py @@ -33,7 +33,26 @@ print("Unzipping...") with tarfile.open(tar_file, "r:gz") as tar_ref: - tar_ref.extractall(unzip_target) + def is_within_directory(directory, target): + + abs_directory = os.path.abspath(directory) + abs_target = os.path.abspath(target) + + prefix = os.path.commonprefix([abs_directory, abs_target]) + + return prefix == abs_directory + + def safe_extract(tar, path=".", members=None, *, numeric_owner=False): + + for member in tar.getmembers(): + member_path = os.path.join(path, member.name) + if not is_within_directory(path, member_path): + raise Exception("Attempted Path Traversal in Tar File") + + tar.extractall(path, members, numeric_owner=numeric_owner) + + + safe_extract(tar_ref, unzip_target) print("Moving to current checkout (" + CHECKOUT_PATH + ")...") if os.path.exists(CHECKOUT_GYP_PATH): From 04ee87c2439d03f311df6dd6f4487ea5fe88f8c2 Mon Sep 17 00:00:00 2001 From: Ross McIntyre Date: Mon, 1 May 2023 12:36:21 -0700 Subject: [PATCH 3/3] changing hardcoded sfdx command prefix to sfdx-cli --- classes/SfdxCommand.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/SfdxCommand.js b/classes/SfdxCommand.js index 9d078bda..6507344f 100644 --- a/classes/SfdxCommand.js +++ b/classes/SfdxCommand.js @@ -2,7 +2,7 @@ import * as core from "@actions/core"; import { spawnSync } from "node:child_process"; export class SfdxCommand { constructor(commandArgs, errorMessage) { - this.commandArgs = ["sfdx", ...commandArgs]; + this.commandArgs = ["sfdx-cli", ...commandArgs]; this.errorMessage = errorMessage; } run() {