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() { 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): 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"