Use `@actions/io` to locate binaries
This commit is contained in:
Родитель
64cc90bcd4
Коммит
b58f4471c8
|
@ -53,7 +53,7 @@ const fs = __importStar(require("fs"));
|
|||
const path = __importStar(require("path"));
|
||||
const core = __importStar(require("@actions/core"));
|
||||
const toolrunner = __importStar(require("@actions/exec/lib/toolrunner"));
|
||||
const safeWhich = __importStar(require("@chrisgavin/safe-which"));
|
||||
const io = __importStar(require("@actions/io"));
|
||||
const util_1 = require("./util");
|
||||
// eslint-disable-next-line import/no-commonjs, @typescript-eslint/no-require-imports
|
||||
const pkg = require("../package.json");
|
||||
|
@ -219,7 +219,7 @@ const getFileType = async (filePath) => {
|
|||
let stdout = "";
|
||||
let fileCmdPath;
|
||||
try {
|
||||
fileCmdPath = await safeWhich.safeWhich("file");
|
||||
fileCmdPath = await io.which("file", true);
|
||||
}
|
||||
catch (e) {
|
||||
throw new FileCmdNotFoundError(`The \`file\` program is required, but does not appear to be installed. Please install it: ${e}`);
|
||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -47,7 +47,7 @@ exports.runCleanup = runCleanup;
|
|||
const fs = __importStar(require("fs"));
|
||||
const path = __importStar(require("path"));
|
||||
const perf_hooks_1 = require("perf_hooks");
|
||||
const safe_which_1 = require("@chrisgavin/safe-which");
|
||||
const io = __importStar(require("@actions/io"));
|
||||
const del_1 = __importDefault(require("del"));
|
||||
const yaml = __importStar(require("js-yaml"));
|
||||
const actionsUtil = __importStar(require("./actions-util"));
|
||||
|
@ -437,7 +437,7 @@ async function warnIfGoInstalledAfterInit(config, logger) {
|
|||
const goInitPath = process.env[environment_1.EnvVar.GO_BINARY_LOCATION];
|
||||
if (process.env[environment_1.EnvVar.DID_AUTOBUILD_GOLANG] !== "true" &&
|
||||
goInitPath !== undefined) {
|
||||
const goBinaryPath = await (0, safe_which_1.safeWhich)("go");
|
||||
const goBinaryPath = await io.which("go", true);
|
||||
if (goInitPath !== goBinaryPath) {
|
||||
logger.warning(`Expected \`which go\` to return ${goInitPath}, but got ${goBinaryPath}: please ensure that the correct version of Go is installed before the \`codeql-action/init\` Action is used.`);
|
||||
(0, diagnostics_1.addDiagnostic)(config, languages_1.Language.go, (0, diagnostics_1.makeDiagnostic)("go/workflow/go-installed-after-codeql-init", "Go was installed after the `codeql-action/init` Action was run", {
|
||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -39,8 +39,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
exports.stubToolRunnerConstructor = stubToolRunnerConstructor;
|
||||
const fs = __importStar(require("fs"));
|
||||
const toolrunner = __importStar(require("@actions/exec/lib/toolrunner"));
|
||||
const io = __importStar(require("@actions/io"));
|
||||
const toolcache = __importStar(require("@actions/tool-cache"));
|
||||
const safeWhich = __importStar(require("@chrisgavin/safe-which"));
|
||||
const ava_1 = __importDefault(require("ava"));
|
||||
const del_1 = __importDefault(require("del"));
|
||||
const yaml = __importStar(require("js-yaml"));
|
||||
|
@ -539,8 +539,8 @@ for (const { codeqlVersion, flagPassed, githubVersion, negativeFlagPassed, } of
|
|||
const runnerConstructorStub = stubToolRunnerConstructor();
|
||||
const codeqlObject = await codeql.getCodeQLForTesting();
|
||||
sinon.stub(codeqlObject, "getVersion").resolves(codeqlVersion);
|
||||
// safeWhich throws because of the test CodeQL object.
|
||||
sinon.stub(safeWhich, "safeWhich").resolves("");
|
||||
// io throws because of the test CodeQL object.
|
||||
sinon.stub(io, "which").resolves("");
|
||||
await codeqlObject.databaseInterpretResults("", [], "", "", "", "-v", undefined, "", Object.assign({}, stubConfig, { gitHubVersion: githubVersion }), (0, testing_utils_1.createFeatures)([]));
|
||||
const actualArgs = runnerConstructorStub.firstCall.args[1];
|
||||
t.is(actualArgs.includes("--new-analysis-summary"), flagPassed, `--new-analysis-summary should${flagPassed ? "" : "n't"} be passed`);
|
||||
|
@ -555,8 +555,8 @@ for (const { codeqlVersion, flagPassed, githubVersion, negativeFlagPassed, } of
|
|||
stubToolRunnerConstructor(32, cliStderr);
|
||||
const codeqlObject = await codeql.getCodeQLForTesting();
|
||||
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.17.6"));
|
||||
// safeWhich throws because of the test CodeQL object.
|
||||
sinon.stub(safeWhich, "safeWhich").resolves("");
|
||||
// io throws because of the test CodeQL object.
|
||||
sinon.stub(io, "which").resolves("");
|
||||
await t.throwsAsync(async () => await codeqlObject.finalizeDatabase("db", "--threads=2", "--ram=2048", false), {
|
||||
instanceOf: util.ConfigurationError,
|
||||
message: new RegExp('Encountered a fatal error while running \\"codeql-for-testing database finalize --finalize-dataset --threads=2 --ram=2048 db\\"\\. ' +
|
||||
|
@ -578,8 +578,8 @@ for (const { codeqlVersion, flagPassed, githubVersion, negativeFlagPassed, } of
|
|||
const codeqlObject = await codeql.getCodeQLForTesting();
|
||||
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.17.6"));
|
||||
sinon.stub(codeqlObject, "resolveExtractor").resolves("/path/to/extractor");
|
||||
// safeWhich throws because of the test CodeQL object.
|
||||
sinon.stub(safeWhich, "safeWhich").resolves("");
|
||||
// io throws because of the test CodeQL object.
|
||||
sinon.stub(io, "which").resolves("");
|
||||
await t.throwsAsync(async () => await codeqlObject.runAutobuild(stubConfig, languages_1.Language.java), {
|
||||
instanceOf: util.ConfigurationError,
|
||||
message: "We were unable to automatically build your code. Please provide manual build steps. " +
|
||||
|
@ -596,8 +596,8 @@ for (const { codeqlVersion, flagPassed, githubVersion, negativeFlagPassed, } of
|
|||
const codeqlObject = await codeql.getCodeQLForTesting();
|
||||
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.17.6"));
|
||||
sinon.stub(codeqlObject, "resolveExtractor").resolves("/path/to/extractor");
|
||||
// safeWhich throws because of the test CodeQL object.
|
||||
sinon.stub(safeWhich, "safeWhich").resolves("");
|
||||
// io throws because of the test CodeQL object.
|
||||
sinon.stub(io, "which").resolves("");
|
||||
await t.throwsAsync(async () => await codeqlObject.runAutobuild(stubConfig, languages_1.Language.java), {
|
||||
instanceOf: util.ConfigurationError,
|
||||
message: "We were unable to automatically build your code. Please provide manual build steps. " +
|
||||
|
@ -616,8 +616,8 @@ for (const { codeqlVersion, flagPassed, githubVersion, negativeFlagPassed, } of
|
|||
const codeqlObject = await codeql.getCodeQLForTesting();
|
||||
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.17.6"));
|
||||
sinon.stub(codeqlObject, "resolveExtractor").resolves("/path/to/extractor");
|
||||
// safeWhich throws because of the test CodeQL object.
|
||||
sinon.stub(safeWhich, "safeWhich").resolves("");
|
||||
// io throws because of the test CodeQL object.
|
||||
sinon.stub(io, "which").resolves("");
|
||||
await t.throwsAsync(async () => await codeqlObject.databaseRunQueries(stubConfig.dbLocation, []), {
|
||||
instanceOf: cli_errors_1.CliError,
|
||||
message: `Encountered a fatal error while running "codeql-for-testing database run-queries --expect-discarded-cache --min-disk-free=1024 -v --intra-layer-parallelism". Exit code was 1 and error was: Oops! A fatal internal error occurred. Details:
|
||||
|
@ -630,8 +630,8 @@ for (const { codeqlVersion, flagPassed, githubVersion, negativeFlagPassed, } of
|
|||
stubToolRunnerConstructor(32, cliStderr);
|
||||
const codeqlObject = await codeql.getCodeQLForTesting();
|
||||
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.17.6"));
|
||||
// safeWhich throws because of the test CodeQL object.
|
||||
sinon.stub(safeWhich, "safeWhich").resolves("");
|
||||
// io throws because of the test CodeQL object.
|
||||
sinon.stub(io, "which").resolves("");
|
||||
await t.throwsAsync(async () => await codeqlObject.finalizeDatabase("db", "--threads=2", "--ram=2048", false), {
|
||||
instanceOf: util.ConfigurationError,
|
||||
message: new RegExp('Encountered a fatal error while running \\"codeql-for-testing database finalize --finalize-dataset --threads=2 --ram=2048 db\\"\\. ' +
|
||||
|
@ -642,8 +642,8 @@ for (const { codeqlVersion, flagPassed, githubVersion, negativeFlagPassed, } of
|
|||
const runnerConstructorStub = stubToolRunnerConstructor();
|
||||
const codeqlObject = await codeql.getCodeQLForTesting();
|
||||
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.17.6"));
|
||||
// safeWhich throws because of the test CodeQL object.
|
||||
sinon.stub(safeWhich, "safeWhich").resolves("");
|
||||
// io throws because of the test CodeQL object.
|
||||
sinon.stub(io, "which").resolves("");
|
||||
process.env["CODEQL_ACTION_EXTRA_OPTIONS"] =
|
||||
'{ "database": { "init": ["--overwrite"] } }';
|
||||
await codeqlObject.databaseInitCluster(stubConfig, "sourceRoot", undefined, undefined, (0, logging_1.getRunnerLogger)(false));
|
||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -38,7 +38,7 @@ exports.getRef = getRef;
|
|||
exports.isAnalyzingDefaultBranch = isAnalyzingDefaultBranch;
|
||||
const core = __importStar(require("@actions/core"));
|
||||
const toolrunner = __importStar(require("@actions/exec/lib/toolrunner"));
|
||||
const safeWhich = __importStar(require("@chrisgavin/safe-which"));
|
||||
const io = __importStar(require("@actions/io"));
|
||||
const actions_util_1 = require("./actions-util");
|
||||
const util_1 = require("./util");
|
||||
async function runGitCommand(checkoutPath, args, customErrorMessage) {
|
||||
|
@ -46,7 +46,7 @@ async function runGitCommand(checkoutPath, args, customErrorMessage) {
|
|||
let stderr = "";
|
||||
core.debug(`Running git command: git ${args.join(" ")}`);
|
||||
try {
|
||||
await new toolrunner.ToolRunner(await safeWhich.safeWhich("git"), args, {
|
||||
await new toolrunner.ToolRunner(await io.which("git", true), args, {
|
||||
silent: true,
|
||||
listeners: {
|
||||
stdout: (data) => {
|
||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -36,7 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
const fs = __importStar(require("fs"));
|
||||
const path = __importStar(require("path"));
|
||||
const core = __importStar(require("@actions/core"));
|
||||
const safe_which_1 = require("@chrisgavin/safe-which");
|
||||
const io = __importStar(require("@actions/io"));
|
||||
const uuid_1 = require("uuid");
|
||||
const actions_util_1 = require("./actions-util");
|
||||
const api_client_1 = require("./api-client");
|
||||
|
@ -258,7 +258,7 @@ async function run() {
|
|||
if (config.languages.includes(languages_1.Language.go) &&
|
||||
process.platform === "linux") {
|
||||
try {
|
||||
const goBinaryPath = await (0, safe_which_1.safeWhich)("go");
|
||||
const goBinaryPath = await io.which("go", true);
|
||||
const fileOutput = await (0, actions_util_1.getFileType)(goBinaryPath);
|
||||
// Go 1.21 and above ships with statically linked binaries on Linux. CodeQL cannot currently trace custom builds
|
||||
// where the entry point is a statically linked binary. Until that is fixed, we work around the problem by
|
||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -42,7 +42,7 @@ exports.cleanupDatabaseClusterDirectory = cleanupDatabaseClusterDirectory;
|
|||
const fs = __importStar(require("fs"));
|
||||
const path = __importStar(require("path"));
|
||||
const toolrunner = __importStar(require("@actions/exec/lib/toolrunner"));
|
||||
const safeWhich = __importStar(require("@chrisgavin/safe-which"));
|
||||
const io = __importStar(require("@actions/io"));
|
||||
const actions_util_1 = require("./actions-util");
|
||||
const codeql_1 = require("./codeql");
|
||||
const configUtils = __importStar(require("./config-utils"));
|
||||
|
@ -102,7 +102,7 @@ async function checkInstallPython311(languages, codeql) {
|
|||
process.platform === "win32" &&
|
||||
!(await codeql.getVersion()).features?.supportsPython312) {
|
||||
const script = path.resolve(__dirname, "../python-setup", "check_python12.ps1");
|
||||
await new toolrunner.ToolRunner(await safeWhich.safeWhich("powershell"), [
|
||||
await new toolrunner.ToolRunner(await io.which("powershell", true), [
|
||||
script,
|
||||
]).exec();
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,gCAyCC;AAED,gCAgBC;AAED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AAM,CAAC,MAAM,CAAC,UAAU,EAAE;gBACxB,KAAK,EAAE,IAAI;gBACX,UAAU,EAAE,CAAC;gBACb,SAAS,EAAE,IAAI;aAChB,CAAC,CAAC;YAEH,MAAM,CAAC,IAAI,CACT,yCAAyC,MAAM,CAAC,UAAU,GAAG,CAC9D,CAAC;QACJ,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,MAAM,KAAK,GAAG,mEACZ,IAAA,+BAAgB,EAAC,aAAa,CAAC;gBAC7B,CAAC,CAAC,sCAAsC,MAAM,CAAC,UAAU,IAAI;gBAC7D,CAAC,CAAC,kCAAkC,MAAM,CAAC,UAAU,IAAI;oBACvD,yEACN,iEAAiE,CAAC;YAElE,kGAAkG;YAClG,IAAI,IAAA,iCAAkB,GAAE,EAAE,CAAC;gBACzB,MAAM,IAAI,IAAI,CAAC,kBAAkB,CAC/B,GAAG,KAAK,4GAA4G;oBAClH,sEAAsE,IAAI,CAAC,eAAe,CACxF,CAAC,CACF,EAAE,CACN,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,KAAK,CACb,GAAG,KAAK,sDAAsD;oBAC5D,+EAA+E;oBAC/E,yCAAyC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,CACrE,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@ -41,14 +41,14 @@ const child_process_1 = require("child_process");
|
|||
const fs = __importStar(require("fs"));
|
||||
const stream = __importStar(require("stream"));
|
||||
const toolrunner_1 = require("@actions/exec/lib/toolrunner");
|
||||
const io = __importStar(require("@actions/io"));
|
||||
const toolcache = __importStar(require("@actions/tool-cache"));
|
||||
const safe_which_1 = require("@chrisgavin/safe-which");
|
||||
const actions_util_1 = require("./actions-util");
|
||||
const util_1 = require("./util");
|
||||
const MIN_REQUIRED_BSD_TAR_VERSION = "3.4.3";
|
||||
const MIN_REQUIRED_GNU_TAR_VERSION = "1.31";
|
||||
async function getTarVersion() {
|
||||
const tar = await (0, safe_which_1.safeWhich)("tar");
|
||||
const tar = await io.which("tar", true);
|
||||
let stdout = "";
|
||||
const exitCode = await new toolrunner_1.ToolRunner(tar, ["--version"], {
|
||||
listeners: {
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"tar.js","sourceRoot":"","sources":["../src/tar.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2DA,0CA+BC;AAID,0BAyBC;AAQD,sCA2EC;AAED,wDAKC;AAjND,iDAAsC;AACtC,uCAAyB;AACzB,+CAAiC;AAEjC,6DAA0D;AAC1D,+DAAiD;AACjD,uDAAmD;AAEnD,iDAAwD;AAExD,iCAAsE;AAEtE,MAAM,4BAA4B,GAAG,OAAO,CAAC;AAC7C,MAAM,4BAA4B,GAAG,MAAM,CAAC;AAO5C,KAAK,UAAU,aAAa;IAC1B,MAAM,GAAG,GAAG,MAAM,IAAA,sBAAS,EAAC,KAAK,CAAC,CAAC;IACnC,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,MAAM,QAAQ,GAAG,MAAM,IAAI,uBAAU,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,EAAE;QACxD,SAAS,EAAE;YACT,MAAM,EAAE,CAAC,IAAY,EAAE,EAAE;gBACvB,MAAM,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAC5B,CAAC;SACF;KACF,CAAC,CAAC,IAAI,EAAE,CAAC;IACV,IAAI,QAAQ,KAAK,CAAC,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAClD,CAAC;IACD,oEAAoE;IACpE,IAAI,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;QAC/B,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC;QACxD,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;YACxB,MAA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,CAAC,IAAI,EAAE,EAAE;gBAC7B,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;oBACf,MAAM,CACJ,IAAI,qCAAsB,CACxB,KAAK,EACL,IAAI,EACJ,IAAI,IAAI,SAAS,EACjB,MAAM,EACN,MAAM,CACP,CACF,CAAC;gBACJ,CAAC;gBACD,OAAO,EAAE,CAAC;YACZ,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,IAAA,kBAAW,EAAC,IAAI,EAAE,kCAAkC,EAAE,MAAM,CAAC,CAAC;QACpE,MAAM,CAAC,CAAC;IACV,CAAC;AACH,CAAC;AAED,SAAgB,sBAAsB,CAAC,OAAe;IACpD,IAAI,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;QAChC,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@ -86,7 +86,7 @@ const path = __importStar(require("path"));
|
|||
const util_1 = require("util");
|
||||
const core = __importStar(require("@actions/core"));
|
||||
const exec = __importStar(require("@actions/exec/lib/exec"));
|
||||
const safe_which_1 = require("@chrisgavin/safe-which");
|
||||
const io = __importStar(require("@actions/io"));
|
||||
const check_disk_space_1 = __importDefault(require("check-disk-space"));
|
||||
const del_1 = __importDefault(require("del"));
|
||||
const get_folder_size_1 = __importDefault(require("get-folder-size"));
|
||||
|
@ -940,7 +940,7 @@ async function cleanUpGlob(glob, name, logger) {
|
|||
}
|
||||
async function isBinaryAccessible(binary, logger) {
|
||||
try {
|
||||
await (0, safe_which_1.safeWhich)(binary);
|
||||
await io.which(binary, true);
|
||||
logger.debug(`Found ${binary}.`);
|
||||
return true;
|
||||
}
|
||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -555,10 +555,6 @@
|
|||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@chrisgavin/safe-which": {
|
||||
"version": "1.0.2",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@eslint-community/eslint-utils": {
|
||||
"version": "4.4.0",
|
||||
"dev": true,
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
# safe-which
|
||||
A NodeJS library to guard against Windows binary planting attacks.
|
|
@ -1,2 +0,0 @@
|
|||
export declare const isWindows: boolean;
|
||||
export declare function safeWhich(program: string): Promise<string>;
|
|
@ -1,40 +0,0 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.safeWhich = exports.isWindows = void 0;
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
exports.isWindows = process.platform === "win32";
|
||||
const pathSeparator = exports.isWindows ? ";" : ":";
|
||||
const defaultPathExt = exports.isWindows ? [".com", ".exe", ".bat", ".cmd"] : [""];
|
||||
async function safeWhich(program) {
|
||||
if (program.includes("/") || (program.includes("\\") && exports.isWindows)) {
|
||||
// If the path contains slashes it's either absolute or relative and should not be searched for.
|
||||
return program;
|
||||
}
|
||||
let pathValue = process.env.PATH;
|
||||
if (pathValue === undefined) {
|
||||
throw new Error(`Could not resolve program ${program} because no PATH environment variable was set.`);
|
||||
}
|
||||
let searchPaths = pathValue.split(pathSeparator);
|
||||
let pathExts = defaultPathExt;
|
||||
if (exports.isWindows && process.env.PATHEXT !== undefined) {
|
||||
pathExts = process.env.PATHEXT.split(pathSeparator);
|
||||
}
|
||||
for (let searchPath of searchPaths) {
|
||||
for (let pathExt of pathExts) {
|
||||
let completePath = path.join(searchPath, program + pathExt);
|
||||
try {
|
||||
await fs.promises.access(completePath, fs.constants.X_OK);
|
||||
return completePath;
|
||||
}
|
||||
catch (err) {
|
||||
if (err.code !== "ENOENT") {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new Error(`Could not find program ${program} on PATH.`);
|
||||
}
|
||||
exports.safeWhich = safeWhich;
|
||||
//# sourceMappingURL=index.js.map
|
|
@ -1 +0,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AAM,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,YAAY,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;gBAC1D,OAAO,YAAY,CAAC;aACpB;YACD,OAAO,GAAG,EAAE;gBACX,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE;oBAC1B,MAAM,GAAG,CAAC;iBACV;aACD;SACD;KACD;IAED,MAAM,IAAI,KAAK,CAAC,0BAA0B,OAAO,WAAW,CAAC,CAAC;AAC/D,CAAC;AAhCD,8BAgCC"}
|
|
@ -1 +0,0 @@
|
|||
export {};
|
|
@ -1,75 +0,0 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const ava_1 = require("ava");
|
||||
const index_1 = require("./index");
|
||||
const path = require("path");
|
||||
const originalEnv = process.env;
|
||||
const originalWorkingDirectory = process.cwd();
|
||||
const testResources = path.resolve(path.join("src", "index.test"));
|
||||
ava_1.default.beforeEach(_ => {
|
||||
process.env = { ...originalEnv };
|
||||
});
|
||||
ava_1.default.afterEach(_ => {
|
||||
process.env = originalEnv;
|
||||
process.chdir(originalWorkingDirectory);
|
||||
});
|
||||
ava_1.default("relative path with forward-slash is returned as-is", async (t) => {
|
||||
process.env.PATH = path.join(testResources, "path");
|
||||
t.deepEqual(await index_1.safeWhich("./anything"), "./anything");
|
||||
});
|
||||
ava_1.default("absolute path with forward-slash is returned as-is", async (t) => {
|
||||
process.env.PATH = path.join(testResources, "path");
|
||||
t.deepEqual(await index_1.safeWhich("/usr/bin/anything"), "/usr/bin/anything");
|
||||
});
|
||||
ava_1.default("binaries in cwd are not returned", async (t) => {
|
||||
process.env.PATH = path.join(testResources, "empty");
|
||||
process.chdir(path.join(testResources, "path"));
|
||||
await t.throwsAsync(index_1.safeWhich("program"));
|
||||
await t.throwsAsync(index_1.safeWhich("has-an-extension"));
|
||||
await t.throwsAsync(index_1.safeWhich("has-an-extension.exe"));
|
||||
});
|
||||
if (index_1.isWindows) {
|
||||
ava_1.default("program is found if on path with correct extension preference", async (t) => {
|
||||
process.env.PATH = path.join(testResources, "path");
|
||||
process.env.PATHEXT = ".com;.exe";
|
||||
t.deepEqual(await index_1.safeWhich("has-an-extension"), path.join(testResources, "path", "has-an-extension.com"));
|
||||
process.env.PATHEXT = ".exe;.com";
|
||||
t.deepEqual(await index_1.safeWhich("has-an-extension"), path.join(testResources, "path", "has-an-extension.exe"));
|
||||
});
|
||||
ava_1.default("program is not found if no extension", async (t) => {
|
||||
process.env.PATH = path.join(testResources, "path");
|
||||
await t.throwsAsync(index_1.safeWhich("program"));
|
||||
});
|
||||
ava_1.default("relative path with backward-slash is returned as-is", async (t) => {
|
||||
process.env.PATH = path.join(testResources, "path");
|
||||
t.deepEqual(await index_1.safeWhich(".\\anything"), ".\\anything");
|
||||
});
|
||||
ava_1.default("absolute path with backward-slash is returned as-is", async (t) => {
|
||||
process.env.PATH = path.join(testResources, "path");
|
||||
t.deepEqual(await index_1.safeWhich("C:\\Python27\\python.exe"), "C:\\Python27\\python.exe");
|
||||
});
|
||||
ava_1.default("path order is respected", async (t) => {
|
||||
process.env.PATHEXT = ".com;.exe;.bat";
|
||||
process.env.PATH = path.join(testResources, "path") + ";" + path.join(testResources, "second-path");
|
||||
t.deepEqual(await index_1.safeWhich("has-an-extension"), path.join(testResources, "path", "has-an-extension.com"));
|
||||
process.env.PATH = path.join(testResources, "second-path") + ";" + path.join(testResources, "path");
|
||||
t.deepEqual(await index_1.safeWhich("has-an-extension"), path.join(testResources, "second-path", "has-an-extension.bat"));
|
||||
});
|
||||
}
|
||||
else {
|
||||
ava_1.default("program is found if on path and executable", async (t) => {
|
||||
process.env.PATH = path.join(testResources, "path");
|
||||
t.deepEqual(await index_1.safeWhich("program"), path.join(testResources, "path", "program"));
|
||||
});
|
||||
ava_1.default("program is not found if not executable", async (t) => {
|
||||
process.env.PATH = path.join(testResources, "path");
|
||||
await t.throwsAsync(index_1.safeWhich("non-executable-file"));
|
||||
});
|
||||
ava_1.default("path order is respected", async (t) => {
|
||||
process.env.PATH = path.join(testResources, "path") + ":" + path.join(testResources, "second-path");
|
||||
t.deepEqual(await index_1.safeWhich("program"), path.join(testResources, "path", "program"));
|
||||
process.env.PATH = path.join(testResources, "second-path") + ":" + path.join(testResources, "path");
|
||||
t.deepEqual(await index_1.safeWhich("program"), path.join(testResources, "second-path", "program"));
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=index.test.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../src/index.test.ts"],"names":[],"mappings":";;AAAA,6BAAuB;AACvB,mCAA+C;AAC/C,6BAA6B;AAE7B,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC;AAChC,MAAM,wBAAwB,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;AAC/C,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC;AAEnE,aAAI,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE;IACnB,OAAO,CAAC,GAAG,GAAG,EAAC,GAAG,WAAW,EAAC,CAAC;AAChC,CAAC,CAAC,CAAC;AAEH,aAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE;IAClB,OAAO,CAAC,GAAG,GAAG,WAAW,CAAC;IAC1B,OAAO,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC;AACzC,CAAC,CAAC,CAAC;AAEH,aAAI,CAAC,oDAAoD,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IACtE,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;IACpD,CAAC,CAAC,SAAS,CAAC,MAAM,iBAAS,CAAC,YAAY,CAAC,EAAE,YAAY,CAAC,CAAC;AAC1D,CAAC,CAAC,CAAC;AAEH,aAAI,CAAC,oDAAoD,EAAE,KA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a,EAAE,aAAa,CAAC,CAAC;QACpG,CAAC,CAAC,SAAS,CAAC,MAAM,iBAAS,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;QACrF,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,aAAa,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;QACpG,CAAC,CAAC,SAAS,CAAC,MAAM,iBAAS,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC,CAAC;IAC7F,CAAC,CAAC,CAAC;CACH"}
|
|
@ -1,32 +0,0 @@
|
|||
{
|
||||
"name": "@chrisgavin/safe-which",
|
||||
"version": "1.0.2",
|
||||
"description": "A NodeJS library to guard against Windows binary planting attacks.",
|
||||
"license": "MIT",
|
||||
"homepage": "https://github.com/chrisgavin/safe-which/",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"main": "./build/index.js",
|
||||
"types": "./build/index.d.ts",
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"pretest": "npm install && npm run build",
|
||||
"test": "ava --verbose --serial ./src/**",
|
||||
"prepublishOnly": "npm install && npm run build && npm version --allow-same-version=true --git-tag-version=false ${GITHUB_REF#refs/tags/}"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"@ava/typescript": "^1.1.1",
|
||||
"@types/node": "^14.14.7",
|
||||
"ava": "^3.13.0",
|
||||
"typescript": "^3.8.3"
|
||||
},
|
||||
"ava": {
|
||||
"typescript": {
|
||||
"rewritePaths": {
|
||||
"./src/": "./build/"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -19,7 +19,6 @@
|
|||
"@actions/http-client": "^2.2.3",
|
||||
"@actions/io": "^1.1.3",
|
||||
"@actions/tool-cache": "^2.0.1",
|
||||
"@chrisgavin/safe-which": "^1.0.2",
|
||||
"@octokit/plugin-retry": "^5.0.2",
|
||||
"@octokit/types": "^13.6.2",
|
||||
"@schemastore/package": "0.0.10",
|
||||
|
@ -624,10 +623,6 @@
|
|||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@chrisgavin/safe-which": {
|
||||
"version": "1.0.2",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@eslint-community/eslint-utils": {
|
||||
"version": "4.4.0",
|
||||
"dev": true,
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
"@actions/http-client": "^2.2.3",
|
||||
"@actions/io": "^1.1.3",
|
||||
"@actions/tool-cache": "^2.0.1",
|
||||
"@chrisgavin/safe-which": "^1.0.2",
|
||||
"@octokit/plugin-retry": "^5.0.2",
|
||||
"@octokit/types": "^13.6.2",
|
||||
"@schemastore/package": "0.0.10",
|
||||
|
|
|
@ -10,8 +10,8 @@ import javascript
|
|||
import DataFlow
|
||||
import DataFlow::PathGraph
|
||||
|
||||
class SafeWhichBarrierGuardNode extends DataFlow::BarrierGuardNode, DataFlow::InvokeNode {
|
||||
SafeWhichBarrierGuardNode() { getCalleeName() = "safeWhich" }
|
||||
class WhichBarrierGuardNode extends DataFlow::BarrierGuardNode, DataFlow::InvokeNode {
|
||||
WhichBarrierGuardNode() { getCalleeName() = "which" }
|
||||
|
||||
override predicate blocks(boolean outcome, Expr e) {
|
||||
outcome = true and
|
||||
|
@ -36,7 +36,7 @@ class BinaryPlantingConfiguration extends DataFlow::Configuration {
|
|||
}
|
||||
|
||||
override predicate isBarrierGuard(DataFlow::BarrierGuardNode guard) {
|
||||
guard instanceof SafeWhichBarrierGuardNode
|
||||
guard instanceof WhichBarrierGuardNode
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ import * as path from "path";
|
|||
|
||||
import * as core from "@actions/core";
|
||||
import * as toolrunner from "@actions/exec/lib/toolrunner";
|
||||
import * as safeWhich from "@chrisgavin/safe-which";
|
||||
import * as io from "@actions/io";
|
||||
import { JSONSchemaForNPMPackageJsonFiles } from "@schemastore/package";
|
||||
|
||||
import type { Config } from "./config-utils";
|
||||
|
@ -209,7 +209,7 @@ export const getFileType = async (filePath: string): Promise<string> => {
|
|||
let fileCmdPath: string;
|
||||
|
||||
try {
|
||||
fileCmdPath = await safeWhich.safeWhich("file");
|
||||
fileCmdPath = await io.which("file", true);
|
||||
} catch (e) {
|
||||
throw new FileCmdNotFoundError(
|
||||
`The \`file\` program is required, but does not appear to be installed. Please install it: ${e}`,
|
||||
|
|
|
@ -2,7 +2,7 @@ import * as fs from "fs";
|
|||
import * as path from "path";
|
||||
import { performance } from "perf_hooks";
|
||||
|
||||
import { safeWhich } from "@chrisgavin/safe-which";
|
||||
import * as io from "@actions/io";
|
||||
import del from "del";
|
||||
import * as yaml from "js-yaml";
|
||||
|
||||
|
@ -660,7 +660,7 @@ export async function warnIfGoInstalledAfterInit(
|
|||
process.env[EnvVar.DID_AUTOBUILD_GOLANG] !== "true" &&
|
||||
goInitPath !== undefined
|
||||
) {
|
||||
const goBinaryPath = await safeWhich("go");
|
||||
const goBinaryPath = await io.which("go", true);
|
||||
|
||||
if (goInitPath !== goBinaryPath) {
|
||||
logger.warning(
|
||||
|
|
|
@ -2,8 +2,8 @@ import * as fs from "fs";
|
|||
|
||||
import { ExecOptions } from "@actions/exec";
|
||||
import * as toolrunner from "@actions/exec/lib/toolrunner";
|
||||
import * as io from "@actions/io";
|
||||
import * as toolcache from "@actions/tool-cache";
|
||||
import * as safeWhich from "@chrisgavin/safe-which";
|
||||
import test, { ExecutionContext } from "ava";
|
||||
import del from "del";
|
||||
import * as yaml from "js-yaml";
|
||||
|
@ -819,8 +819,8 @@ for (const {
|
|||
const runnerConstructorStub = stubToolRunnerConstructor();
|
||||
const codeqlObject = await codeql.getCodeQLForTesting();
|
||||
sinon.stub(codeqlObject, "getVersion").resolves(codeqlVersion);
|
||||
// safeWhich throws because of the test CodeQL object.
|
||||
sinon.stub(safeWhich, "safeWhich").resolves("");
|
||||
// io throws because of the test CodeQL object.
|
||||
sinon.stub(io, "which").resolves("");
|
||||
await codeqlObject.databaseInterpretResults(
|
||||
"",
|
||||
[],
|
||||
|
@ -860,8 +860,8 @@ test("runTool summarizes several fatal errors", async (t) => {
|
|||
stubToolRunnerConstructor(32, cliStderr);
|
||||
const codeqlObject = await codeql.getCodeQLForTesting();
|
||||
sinon.stub(codeqlObject, "getVersion").resolves(makeVersionInfo("2.17.6"));
|
||||
// safeWhich throws because of the test CodeQL object.
|
||||
sinon.stub(safeWhich, "safeWhich").resolves("");
|
||||
// io throws because of the test CodeQL object.
|
||||
sinon.stub(io, "which").resolves("");
|
||||
|
||||
await t.throwsAsync(
|
||||
async () =>
|
||||
|
@ -902,8 +902,8 @@ test("runTool summarizes autobuilder errors", async (t) => {
|
|||
const codeqlObject = await codeql.getCodeQLForTesting();
|
||||
sinon.stub(codeqlObject, "getVersion").resolves(makeVersionInfo("2.17.6"));
|
||||
sinon.stub(codeqlObject, "resolveExtractor").resolves("/path/to/extractor");
|
||||
// safeWhich throws because of the test CodeQL object.
|
||||
sinon.stub(safeWhich, "safeWhich").resolves("");
|
||||
// io throws because of the test CodeQL object.
|
||||
sinon.stub(io, "which").resolves("");
|
||||
|
||||
await t.throwsAsync(
|
||||
async () => await codeqlObject.runAutobuild(stubConfig, Language.java),
|
||||
|
@ -929,8 +929,8 @@ test("runTool truncates long autobuilder errors", async (t) => {
|
|||
const codeqlObject = await codeql.getCodeQLForTesting();
|
||||
sinon.stub(codeqlObject, "getVersion").resolves(makeVersionInfo("2.17.6"));
|
||||
sinon.stub(codeqlObject, "resolveExtractor").resolves("/path/to/extractor");
|
||||
// safeWhich throws because of the test CodeQL object.
|
||||
sinon.stub(safeWhich, "safeWhich").resolves("");
|
||||
// io throws because of the test CodeQL object.
|
||||
sinon.stub(io, "which").resolves("");
|
||||
|
||||
await t.throwsAsync(
|
||||
async () => await codeqlObject.runAutobuild(stubConfig, Language.java),
|
||||
|
@ -957,8 +957,8 @@ test("runTool recognizes fatal internal errors", async (t) => {
|
|||
const codeqlObject = await codeql.getCodeQLForTesting();
|
||||
sinon.stub(codeqlObject, "getVersion").resolves(makeVersionInfo("2.17.6"));
|
||||
sinon.stub(codeqlObject, "resolveExtractor").resolves("/path/to/extractor");
|
||||
// safeWhich throws because of the test CodeQL object.
|
||||
sinon.stub(safeWhich, "safeWhich").resolves("");
|
||||
// io throws because of the test CodeQL object.
|
||||
sinon.stub(io, "which").resolves("");
|
||||
|
||||
await t.throwsAsync(
|
||||
async () =>
|
||||
|
@ -977,8 +977,8 @@ test("runTool outputs last line of stderr if fatal error could not be found", as
|
|||
stubToolRunnerConstructor(32, cliStderr);
|
||||
const codeqlObject = await codeql.getCodeQLForTesting();
|
||||
sinon.stub(codeqlObject, "getVersion").resolves(makeVersionInfo("2.17.6"));
|
||||
// safeWhich throws because of the test CodeQL object.
|
||||
sinon.stub(safeWhich, "safeWhich").resolves("");
|
||||
// io throws because of the test CodeQL object.
|
||||
sinon.stub(io, "which").resolves("");
|
||||
|
||||
await t.throwsAsync(
|
||||
async () =>
|
||||
|
@ -1002,8 +1002,8 @@ test("Avoids duplicating --overwrite flag if specified in CODEQL_ACTION_EXTRA_OP
|
|||
const runnerConstructorStub = stubToolRunnerConstructor();
|
||||
const codeqlObject = await codeql.getCodeQLForTesting();
|
||||
sinon.stub(codeqlObject, "getVersion").resolves(makeVersionInfo("2.17.6"));
|
||||
// safeWhich throws because of the test CodeQL object.
|
||||
sinon.stub(safeWhich, "safeWhich").resolves("");
|
||||
// io throws because of the test CodeQL object.
|
||||
sinon.stub(io, "which").resolves("");
|
||||
|
||||
process.env["CODEQL_ACTION_EXTRA_OPTIONS"] =
|
||||
'{ "database": { "init": ["--overwrite"] } }';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import * as core from "@actions/core";
|
||||
import * as toolrunner from "@actions/exec/lib/toolrunner";
|
||||
import * as safeWhich from "@chrisgavin/safe-which";
|
||||
import * as io from "@actions/io";
|
||||
|
||||
import {
|
||||
getOptionalInput,
|
||||
|
@ -18,7 +18,7 @@ async function runGitCommand(
|
|||
let stderr = "";
|
||||
core.debug(`Running git command: git ${args.join(" ")}`);
|
||||
try {
|
||||
await new toolrunner.ToolRunner(await safeWhich.safeWhich("git"), args, {
|
||||
await new toolrunner.ToolRunner(await io.which("git", true), args, {
|
||||
silent: true,
|
||||
listeners: {
|
||||
stdout: (data) => {
|
||||
|
|
|
@ -2,7 +2,7 @@ import * as fs from "fs";
|
|||
import * as path from "path";
|
||||
|
||||
import * as core from "@actions/core";
|
||||
import { safeWhich } from "@chrisgavin/safe-which";
|
||||
import * as io from "@actions/io";
|
||||
import { v4 as uuidV4 } from "uuid";
|
||||
|
||||
import {
|
||||
|
@ -445,7 +445,7 @@ async function run() {
|
|||
process.platform === "linux"
|
||||
) {
|
||||
try {
|
||||
const goBinaryPath = await safeWhich("go");
|
||||
const goBinaryPath = await io.which("go", true);
|
||||
const fileOutput = await getFileType(goBinaryPath);
|
||||
|
||||
// Go 1.21 and above ships with statically linked binaries on Linux. CodeQL cannot currently trace custom builds
|
||||
|
|
|
@ -2,7 +2,7 @@ import * as fs from "fs";
|
|||
import * as path from "path";
|
||||
|
||||
import * as toolrunner from "@actions/exec/lib/toolrunner";
|
||||
import * as safeWhich from "@chrisgavin/safe-which";
|
||||
import * as io from "@actions/io";
|
||||
|
||||
import { getOptionalInput, isSelfHostedRunner } from "./actions-util";
|
||||
import { GitHubApiCombinedDetails, GitHubApiDetails } from "./api-client";
|
||||
|
@ -150,7 +150,7 @@ export async function checkInstallPython311(
|
|||
"../python-setup",
|
||||
"check_python12.ps1",
|
||||
);
|
||||
await new toolrunner.ToolRunner(await safeWhich.safeWhich("powershell"), [
|
||||
await new toolrunner.ToolRunner(await io.which("powershell", true), [
|
||||
script,
|
||||
]).exec();
|
||||
}
|
||||
|
|
|
@ -3,8 +3,8 @@ import * as fs from "fs";
|
|||
import * as stream from "stream";
|
||||
|
||||
import { ToolRunner } from "@actions/exec/lib/toolrunner";
|
||||
import * as io from "@actions/io";
|
||||
import * as toolcache from "@actions/tool-cache";
|
||||
import { safeWhich } from "@chrisgavin/safe-which";
|
||||
|
||||
import { CommandInvocationError } from "./actions-util";
|
||||
import { Logger } from "./logging";
|
||||
|
@ -19,7 +19,7 @@ export type TarVersion = {
|
|||
};
|
||||
|
||||
async function getTarVersion(): Promise<TarVersion> {
|
||||
const tar = await safeWhich("tar");
|
||||
const tar = await io.which("tar", true);
|
||||
let stdout = "";
|
||||
const exitCode = await new ToolRunner(tar, ["--version"], {
|
||||
listeners: {
|
||||
|
|
|
@ -5,7 +5,7 @@ import { promisify } from "util";
|
|||
|
||||
import * as core from "@actions/core";
|
||||
import * as exec from "@actions/exec/lib/exec";
|
||||
import { safeWhich } from "@chrisgavin/safe-which";
|
||||
import * as io from "@actions/io";
|
||||
import checkDiskSpace from "check-disk-space";
|
||||
import del from "del";
|
||||
import getFolderSize from "get-folder-size";
|
||||
|
@ -1194,7 +1194,7 @@ export async function isBinaryAccessible(
|
|||
logger: Logger,
|
||||
): Promise<boolean> {
|
||||
try {
|
||||
await safeWhich(binary);
|
||||
await io.which(binary, true);
|
||||
logger.debug(`Found ${binary}.`);
|
||||
return true;
|
||||
} catch (e) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче