Merge remote-tracking branch 'origin/main' into dependabot/npm_and_yarn/types/long-5.0.0
This commit is contained in:
commit
68f1d68743
61 changed files with 882 additions and 116 deletions
2
.github/query-filter-test/action.yml
vendored
2
.github/query-filter-test/action.yml
vendored
|
|
@ -1,5 +1,5 @@
|
||||||
name: Query Filter Test
|
name: Query Filter Test
|
||||||
description: Runs a test of query filters using the check sarif action
|
description: Runs a test of query filters using the check SARIF action
|
||||||
inputs:
|
inputs:
|
||||||
sarif-file:
|
sarif-file:
|
||||||
required: true
|
required: true
|
||||||
|
|
|
||||||
4
.github/workflows/expected-queries-runs.yml
vendored
4
.github/workflows/expected-queries-runs.yml
vendored
|
|
@ -1,6 +1,4 @@
|
||||||
name: Expected queries runs
|
name: Check queries that ran
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
|
|
||||||
56
.github/workflows/query-filters.yml
vendored
Normal file
56
.github/workflows/query-filters.yml
vendored
Normal file
|
|
@ -0,0 +1,56 @@
|
||||||
|
name: Query filters tests
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- releases/v1
|
||||||
|
- releases/v2
|
||||||
|
pull_request:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- synchronize
|
||||||
|
- reopened
|
||||||
|
- ready_for_review
|
||||||
|
workflow_dispatch: {}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
query-filters:
|
||||||
|
name: Query Filters Tests
|
||||||
|
timeout-minutes: 45
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check out repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Prepare test
|
||||||
|
id: prepare-test
|
||||||
|
uses: ./.github/prepare-test
|
||||||
|
with:
|
||||||
|
version: latest
|
||||||
|
|
||||||
|
- name: Check SARIF for default queries with Single include, Single exclude
|
||||||
|
uses: ./../action/.github/query-filter-test
|
||||||
|
with:
|
||||||
|
sarif-file: ${{ runner.temp }}/results/javascript.sarif
|
||||||
|
queries-run: js/zipslip
|
||||||
|
queries-not-run: js/path-injection
|
||||||
|
config-file: ./.github/codeql/codeql-config-query-filters1.yml
|
||||||
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
|
|
||||||
|
- name: Check SARIF for query packs with Single include, Single exclude
|
||||||
|
uses: ./../action/.github/query-filter-test
|
||||||
|
with:
|
||||||
|
sarif-file: ${{ runner.temp }}/results/javascript.sarif
|
||||||
|
queries-run: js/zipslip,javascript/example/empty-or-one-block
|
||||||
|
queries-not-run: js/path-injection
|
||||||
|
config-file: ./.github/codeql/codeql-config-query-filters2.yml
|
||||||
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
|
|
||||||
|
- name: Check SARIF for query packs and local queries with Single include, Single exclude
|
||||||
|
uses: ./../action/.github/query-filter-test
|
||||||
|
with:
|
||||||
|
sarif-file: ${{ runner.temp }}/results/javascript.sarif
|
||||||
|
queries-run: js/zipslip,javascript/example/empty-or-one-block,inrepo-javascript-querypack/show-ifs
|
||||||
|
queries-not-run: js/path-injection,complex-python-querypack/show-ifs,complex-python-querypack/foo/bar/show-ifs
|
||||||
|
config-file: ./.github/codeql/codeql-config-query-filters3.yml
|
||||||
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
|
|
@ -29,6 +29,7 @@ No user facing changes.
|
||||||
|
|
||||||
## 2.1.13 - 21 Jun 2022
|
## 2.1.13 - 21 Jun 2022
|
||||||
|
|
||||||
|
- Add the ability to filter queries from a code scanning run by using the `query-filters` option in the code scanning configuration file. [#1098](https://github.com/github/codeql-action/pull/1098)
|
||||||
- Update default CodeQL bundle version to 2.9.4. [#1100](https://github.com/github/codeql-action/pull/1100)
|
- Update default CodeQL bundle version to 2.9.4. [#1100](https://github.com/github/codeql-action/pull/1100)
|
||||||
|
|
||||||
## 2.1.12 - 01 Jun 2022
|
## 2.1.12 - 01 Jun 2022
|
||||||
|
|
|
||||||
1
lib/analyze-action-env.test.js
generated
1
lib/analyze-action-env.test.js
generated
|
|
@ -40,6 +40,7 @@ const util = __importStar(require("./util"));
|
||||||
await util.withTmpDir(async (tmpDir) => {
|
await util.withTmpDir(async (tmpDir) => {
|
||||||
process.env["GITHUB_SERVER_URL"] = util.GITHUB_DOTCOM_URL;
|
process.env["GITHUB_SERVER_URL"] = util.GITHUB_DOTCOM_URL;
|
||||||
process.env["GITHUB_REPOSITORY"] = "github/codeql-action-fake-repository";
|
process.env["GITHUB_REPOSITORY"] = "github/codeql-action-fake-repository";
|
||||||
|
process.env["GITHUB_API_URL"] = "https://api.github.com";
|
||||||
sinon
|
sinon
|
||||||
.stub(actionsUtil, "createStatusReportBase")
|
.stub(actionsUtil, "createStatusReportBase")
|
||||||
.resolves({});
|
.resolves({});
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"analyze-action-env.test.js","sourceRoot":"","sources":["../src/analyze-action-env.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAAuB;AACvB,6CAA+B;AAE/B,4DAA8C;AAC9C,mDAAqC;AACrC,4DAA8C;AAC9C,mDAIyB;AACzB,6CAA+B;AAE/B,IAAA,0BAAU,EAAC,aAAI,CAAC,CAAC;AAEjB,4EAA4E;AAC5E,4EAA4E;AAC5E,+EAA+E;AAC/E,+EAA+E;AAC/E,gFAAgF;AAChF,iCAAiC;AAEjC,IAAA,aAAI,EAAC,8DAA8D,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IAC/E,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;QACrC,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,GAAG,IAAI,CAAC,iBAAiB,CAAC;QAC1D,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,GAAG,sCAAsC,CAAC;QAC1E,K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AAC,GAAG,EAAE,EAAE,CAAC,CAAC;QAEpC,uEAAuE;QACvE,0EAA0E;QAC1E,iBAAiB;QACjB,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,GAAG,IAAI,CAAC;QACrC,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,MAAM,CAAC;QAEnC,MAAM,eAAe,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;QAC3D,MAAM,cAAc,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;QACzD,MAAM,aAAa,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;QAElD,uEAAuE;QACvE,oEAAoE;QACpE,4EAA4E;QAC5E,wEAAwE;QACxE,MAAM,aAAa,CAAC,UAAU,CAAC;QAE/B,CAAC,CAAC,SAAS,CAAC,eAAe,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC;QAC/D,CAAC,CAAC,SAAS,CAAC,eAAe,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;QAC7D,CAAC,CAAC,SAAS,CAAC,cAAc,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC;QAC9D,CAAC,CAAC,SAAS,CAAC,cAAc,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
||||||
1
lib/analyze-action-input.test.js
generated
1
lib/analyze-action-input.test.js
generated
|
|
@ -40,6 +40,7 @@ const util = __importStar(require("./util"));
|
||||||
await util.withTmpDir(async (tmpDir) => {
|
await util.withTmpDir(async (tmpDir) => {
|
||||||
process.env["GITHUB_SERVER_URL"] = util.GITHUB_DOTCOM_URL;
|
process.env["GITHUB_SERVER_URL"] = util.GITHUB_DOTCOM_URL;
|
||||||
process.env["GITHUB_REPOSITORY"] = "github/codeql-action-fake-repository";
|
process.env["GITHUB_REPOSITORY"] = "github/codeql-action-fake-repository";
|
||||||
|
process.env["GITHUB_API_URL"] = "https://api.github.com";
|
||||||
sinon
|
sinon
|
||||||
.stub(actionsUtil, "createStatusReportBase")
|
.stub(actionsUtil, "createStatusReportBase")
|
||||||
.resolves({});
|
.resolves({});
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"analyze-action-input.test.js","sourceRoot":"","sources":["../src/analyze-action-input.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAAuB;AACvB,6CAA+B;AAE/B,4DAA8C;AAC9C,mDAAqC;AACrC,4DAA8C;AAC9C,mDAIyB;AACzB,6CAA+B;AAE/B,IAAA,0BAAU,EAAC,aAAI,CAAC,CAAC;AAEjB,4EAA4E;AAC5E,4EAA4E;AAC5E,+EAA+E;AAC/E,+EAA+E;AAC/E,gFAAgF;AAChF,iCAAiC;AAEjC,IAAA,aAAI,EAAC,sDAAsD,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IACvE,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;QACrC,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,GAAG,IAAI,CAAC,iBAAiB,CAAC;QAC1D,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,GAAG,sCAAsC,CAAC;QAC1E,KAAK;aACF,IAAI,CAAC,WAAW,EAAE,wBAAwB,CAAC;aAC3C,QAAQ,CAAC,EAAkC,CAAC,CAAC;QAChD,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC3D,MAAM,aAAa,GAAuB;YACxC,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,MAAM;SAChC,CAAC;QACF,KAAK,CAAC,IAAI,CAAC,WAAW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AA4D;QAC5D,iBAAiB,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACpD,iBAAiB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAElD,MAAM,eAAe,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;QAC3D,MAAM,cAAc,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;QACzD,MAAM,aAAa,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;QAElD,uEAAuE;QACvE,oEAAoE;QACpE,4EAA4E;QAC5E,wEAAwE;QACxE,MAAM,aAAa,CAAC,UAAU,CAAC;QAE/B,CAAC,CAAC,SAAS,CAAC,eAAe,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC;QAC/D,CAAC,CAAC,SAAS,CAAC,eAAe,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;QAC7D,CAAC,CAAC,SAAS,CAAC,cAAc,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC;QAC9D,CAAC,CAAC,SAAS,CAAC,cAAc,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
||||||
1
lib/analyze-action.js
generated
1
lib/analyze-action.js
generated
|
|
@ -70,6 +70,7 @@ async function run() {
|
||||||
const apiDetails = {
|
const apiDetails = {
|
||||||
auth: actionsUtil.getRequiredInput("token"),
|
auth: actionsUtil.getRequiredInput("token"),
|
||||||
url: util.getRequiredEnvParam("GITHUB_SERVER_URL"),
|
url: util.getRequiredEnvParam("GITHUB_SERVER_URL"),
|
||||||
|
apiURL: util.getRequiredEnvParam("GITHUB_API_URL"),
|
||||||
};
|
};
|
||||||
const outputDir = actionsUtil.getRequiredInput("output");
|
const outputDir = actionsUtil.getRequiredInput("output");
|
||||||
const threads = util.getThreadsFlag(actionsUtil.getOptionalInput("threads") || process.env["CODEQL_THREADS"], logger);
|
const threads = util.getThreadsFlag(actionsUtil.getOptionalInput("threads") || process.env["CODEQL_THREADS"], logger);
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
67
lib/analyze.js
generated
67
lib/analyze.js
generated
|
|
@ -22,7 +22,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.runCleanup = exports.runFinalize = exports.runQueries = exports.dbIsFinalized = exports.createdDBForScannedLanguages = exports.CodeQLAnalysisError = void 0;
|
exports.validateQueryFilters = exports.runCleanup = exports.runFinalize = exports.createQuerySuiteContents = exports.convertPackToQuerySuiteEntry = exports.runQueries = exports.dbIsFinalized = exports.createdDBForScannedLanguages = exports.CodeQLAnalysisError = void 0;
|
||||||
const fs = __importStar(require("fs"));
|
const fs = __importStar(require("fs"));
|
||||||
const path = __importStar(require("path"));
|
const path = __importStar(require("path"));
|
||||||
const toolrunner = __importStar(require("@actions/exec/lib/toolrunner"));
|
const toolrunner = __importStar(require("@actions/exec/lib/toolrunner"));
|
||||||
|
|
@ -30,6 +30,7 @@ const del_1 = __importDefault(require("del"));
|
||||||
const yaml = __importStar(require("js-yaml"));
|
const yaml = __importStar(require("js-yaml"));
|
||||||
const analysisPaths = __importStar(require("./analysis-paths"));
|
const analysisPaths = __importStar(require("./analysis-paths"));
|
||||||
const codeql_1 = require("./codeql");
|
const codeql_1 = require("./codeql");
|
||||||
|
const configUtils = __importStar(require("./config-utils"));
|
||||||
const count_loc_1 = require("./count-loc");
|
const count_loc_1 = require("./count-loc");
|
||||||
const languages_1 = require("./languages");
|
const languages_1 = require("./languages");
|
||||||
const sharedEnv = __importStar(require("./shared-environment"));
|
const sharedEnv = __importStar(require("./shared-environment"));
|
||||||
|
|
@ -127,6 +128,7 @@ async function runQueries(sarifFolder, memoryFlag, addSnippetsFlag, threadsFlag,
|
||||||
}
|
}
|
||||||
for (const language of config.languages) {
|
for (const language of config.languages) {
|
||||||
const queries = config.queries[language];
|
const queries = config.queries[language];
|
||||||
|
const queryFilters = validateQueryFilters(config.originalUserInput["query-filters"]);
|
||||||
const packsWithVersion = config.packs[language] || [];
|
const packsWithVersion = config.packs[language] || [];
|
||||||
const hasBuiltinQueries = (queries === null || queries === void 0 ? void 0 : queries.builtin.length) > 0;
|
const hasBuiltinQueries = (queries === null || queries === void 0 ? void 0 : queries.builtin.length) > 0;
|
||||||
const hasCustomQueries = (queries === null || queries === void 0 ? void 0 : queries.custom.length) > 0;
|
const hasCustomQueries = (queries === null || queries === void 0 ? void 0 : queries.custom.length) > 0;
|
||||||
|
|
@ -149,7 +151,7 @@ async function runQueries(sarifFolder, memoryFlag, addSnippetsFlag, threadsFlag,
|
||||||
const querySuitePaths = [];
|
const querySuitePaths = [];
|
||||||
if (queries["builtin"].length > 0) {
|
if (queries["builtin"].length > 0) {
|
||||||
const startTimeBuiltIn = new Date().getTime();
|
const startTimeBuiltIn = new Date().getTime();
|
||||||
querySuitePaths.push(await runQueryGroup(language, "builtin", createQuerySuiteContents(queries["builtin"]), undefined));
|
querySuitePaths.push(await runQueryGroup(language, "builtin", createQuerySuiteContents(queries["builtin"], queryFilters), undefined));
|
||||||
statusReport[`analyze_builtin_queries_${language}_duration_ms`] =
|
statusReport[`analyze_builtin_queries_${language}_duration_ms`] =
|
||||||
new Date().getTime() - startTimeBuiltIn;
|
new Date().getTime() - startTimeBuiltIn;
|
||||||
}
|
}
|
||||||
|
|
@ -157,12 +159,12 @@ async function runQueries(sarifFolder, memoryFlag, addSnippetsFlag, threadsFlag,
|
||||||
let ranCustom = false;
|
let ranCustom = false;
|
||||||
for (let i = 0; i < queries["custom"].length; ++i) {
|
for (let i = 0; i < queries["custom"].length; ++i) {
|
||||||
if (queries["custom"][i].queries.length > 0) {
|
if (queries["custom"][i].queries.length > 0) {
|
||||||
querySuitePaths.push(await runQueryGroup(language, `custom-${i}`, createQuerySuiteContents(queries["custom"][i].queries), queries["custom"][i].searchPath));
|
querySuitePaths.push(await runQueryGroup(language, `custom-${i}`, createQuerySuiteContents(queries["custom"][i].queries, queryFilters), queries["custom"][i].searchPath));
|
||||||
ranCustom = true;
|
ranCustom = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (packsWithVersion.length > 0) {
|
if (packsWithVersion.length > 0) {
|
||||||
querySuitePaths.push(...(await runQueryPacks(language, "packs", packsWithVersion, undefined)));
|
querySuitePaths.push(await runQueryPacks(language, "packs", packsWithVersion, queryFilters));
|
||||||
ranCustom = true;
|
ranCustom = true;
|
||||||
}
|
}
|
||||||
if (ranCustom) {
|
if (ranCustom) {
|
||||||
|
|
@ -220,23 +222,41 @@ async function runQueries(sarifFolder, memoryFlag, addSnippetsFlag, threadsFlag,
|
||||||
logger.debug(`BQRS results produced for ${language} (queries: ${type})"`);
|
logger.debug(`BQRS results produced for ${language} (queries: ${type})"`);
|
||||||
return querySuitePath;
|
return querySuitePath;
|
||||||
}
|
}
|
||||||
async function runQueryPacks(language, type, packs, searchPath) {
|
async function runQueryPacks(language, type, packs, queryFilters) {
|
||||||
const databasePath = util.getCodeQLDatabasePath(config, language);
|
const databasePath = util.getCodeQLDatabasePath(config, language);
|
||||||
// Run the queries individually instead of all at once to avoid command
|
|
||||||
// line length restrictions, particularly on windows.
|
|
||||||
for (const pack of packs) {
|
for (const pack of packs) {
|
||||||
logger.debug(`Running query pack for ${language}-${type}: ${pack}`);
|
logger.debug(`Running query pack for ${language}-${type}: ${pack}`);
|
||||||
const codeql = await (0, codeql_1.getCodeQL)(config.codeQLCmd);
|
|
||||||
await codeql.databaseRunQueries(databasePath, searchPath, pack, memoryFlag, threadsFlag);
|
|
||||||
logger.debug(`BQRS results produced for ${language} (queries: ${type})"`);
|
|
||||||
}
|
}
|
||||||
return packs;
|
// combine the list of packs into a query suite in order to run them all simultaneously.
|
||||||
|
const querySuite = packs.map(convertPackToQuerySuiteEntry).concat(queryFilters);
|
||||||
|
const querySuitePath = `${databasePath}-queries-${type}.qls`;
|
||||||
|
fs.writeFileSync(querySuitePath, yaml.dump(querySuite));
|
||||||
|
logger.debug(`BQRS results produced for ${language} (queries: ${type})"`);
|
||||||
|
const codeql = await (0, codeql_1.getCodeQL)(config.codeQLCmd);
|
||||||
|
await codeql.databaseRunQueries(databasePath, undefined, querySuitePath, memoryFlag, threadsFlag);
|
||||||
|
return querySuitePath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.runQueries = runQueries;
|
exports.runQueries = runQueries;
|
||||||
function createQuerySuiteContents(queries) {
|
function convertPackToQuerySuiteEntry(packStr) {
|
||||||
return queries.map((q) => `- query: ${q}`).join("\n");
|
var _a, _b, _c, _d;
|
||||||
|
const pack = configUtils.parsePacksSpecification(packStr);
|
||||||
|
return {
|
||||||
|
qlpack: !pack.path ? pack.name : undefined,
|
||||||
|
from: pack.path ? pack.name : undefined,
|
||||||
|
version: pack.version,
|
||||||
|
query: ((_a = pack.path) === null || _a === void 0 ? void 0 : _a.endsWith(".ql")) ? pack.path : undefined,
|
||||||
|
queries: !((_b = pack.path) === null || _b === void 0 ? void 0 : _b.endsWith(".ql")) && !((_c = pack.path) === null || _c === void 0 ? void 0 : _c.endsWith(".qls"))
|
||||||
|
? pack.path
|
||||||
|
: undefined,
|
||||||
|
apply: ((_d = pack.path) === null || _d === void 0 ? void 0 : _d.endsWith(".qls")) ? pack.path : undefined,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
exports.convertPackToQuerySuiteEntry = convertPackToQuerySuiteEntry;
|
||||||
|
function createQuerySuiteContents(queries, queryFilters) {
|
||||||
|
return yaml.dump(queries.map((q) => ({ query: q })).concat(queryFilters));
|
||||||
|
}
|
||||||
|
exports.createQuerySuiteContents = createQuerySuiteContents;
|
||||||
async function runFinalize(outputDir, threadsFlag, memoryFlag, config, logger, featureFlags) {
|
async function runFinalize(outputDir, threadsFlag, memoryFlag, config, logger, featureFlags) {
|
||||||
try {
|
try {
|
||||||
await (0, del_1.default)(outputDir, { force: true });
|
await (0, del_1.default)(outputDir, { force: true });
|
||||||
|
|
@ -302,4 +322,25 @@ function printLinesOfCodeSummary(logger, language, lineCounts) {
|
||||||
logger.info(`Counted a baseline of ${lineCounts[language]} lines of code for ${language}.`);
|
logger.info(`Counted a baseline of ${lineCounts[language]} lines of code for ${language}.`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// exported for testing
|
||||||
|
function validateQueryFilters(queryFilters) {
|
||||||
|
if (!queryFilters) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
const errors = [];
|
||||||
|
for (const qf of queryFilters) {
|
||||||
|
const keys = Object.keys(qf);
|
||||||
|
if (keys.length !== 1) {
|
||||||
|
errors.push(`Query filter must have exactly one key: ${JSON.stringify(qf)}`);
|
||||||
|
}
|
||||||
|
if (!["exclude", "include"].includes(keys[0])) {
|
||||||
|
errors.push(`Only "include" or "exclude" filters are allowed:\n${JSON.stringify(qf)}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (errors.length) {
|
||||||
|
throw new Error(`Invalid query filter.\n${errors.join("\n")}`);
|
||||||
|
}
|
||||||
|
return queryFilters;
|
||||||
|
}
|
||||||
|
exports.validateQueryFilters = validateQueryFilters;
|
||||||
//# sourceMappingURL=analyze.js.map
|
//# sourceMappingURL=analyze.js.map
|
||||||
File diff suppressed because one or more lines are too long
132
lib/analyze.test.js
generated
132
lib/analyze.test.js
generated
|
|
@ -212,6 +212,138 @@ const util = __importStar(require("./util"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
(0, ava_1.default)("validateQueryFilters", (t) => {
|
||||||
|
t.notThrows(() => (0, analyze_1.validateQueryFilters)([]));
|
||||||
|
t.notThrows(() => (0, analyze_1.validateQueryFilters)(undefined));
|
||||||
|
t.notThrows(() => {
|
||||||
|
return (0, analyze_1.validateQueryFilters)([
|
||||||
|
{
|
||||||
|
exclude: {
|
||||||
|
"problem.severity": "recommendation",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
exclude: {
|
||||||
|
"tags contain": ["foo", "bar"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
include: {
|
||||||
|
"problem.severity": "something-to-think-about",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
include: {
|
||||||
|
"tags contain": ["baz", "bop"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
t.throws(() => {
|
||||||
|
return (0, analyze_1.validateQueryFilters)([
|
||||||
|
{
|
||||||
|
exclude: {
|
||||||
|
"tags contain": ["foo", "bar"],
|
||||||
|
},
|
||||||
|
include: {
|
||||||
|
"tags contain": ["baz", "bop"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
}, { message: /Query filter must have exactly one key/ });
|
||||||
|
t.throws(() => {
|
||||||
|
return (0, analyze_1.validateQueryFilters)([{ xxx: "foo" }]);
|
||||||
|
}, { message: /Only "include" or "exclude" filters are allowed/ });
|
||||||
|
});
|
||||||
|
const convertPackToQuerySuiteEntryMacro = ava_1.default.macro({
|
||||||
|
exec: (t, packSpec, suiteEntry) => t.deepEqual((0, analyze_1.convertPackToQuerySuiteEntry)(packSpec), suiteEntry),
|
||||||
|
title: (_providedTitle, packSpec) => `Query Suite Entry: ${packSpec}`,
|
||||||
|
});
|
||||||
|
(0, ava_1.default)(convertPackToQuerySuiteEntryMacro, "a/b", {
|
||||||
|
qlpack: "a/b",
|
||||||
|
from: undefined,
|
||||||
|
version: undefined,
|
||||||
|
query: undefined,
|
||||||
|
queries: undefined,
|
||||||
|
apply: undefined,
|
||||||
|
});
|
||||||
|
(0, ava_1.default)(convertPackToQuerySuiteEntryMacro, "a/b@~1.2.3", {
|
||||||
|
qlpack: "a/b",
|
||||||
|
from: undefined,
|
||||||
|
version: "~1.2.3",
|
||||||
|
query: undefined,
|
||||||
|
queries: undefined,
|
||||||
|
apply: undefined,
|
||||||
|
});
|
||||||
|
(0, ava_1.default)(convertPackToQuerySuiteEntryMacro, "a/b:my/path", {
|
||||||
|
qlpack: undefined,
|
||||||
|
from: "a/b",
|
||||||
|
version: undefined,
|
||||||
|
query: undefined,
|
||||||
|
queries: "my/path",
|
||||||
|
apply: undefined,
|
||||||
|
});
|
||||||
|
(0, ava_1.default)(convertPackToQuerySuiteEntryMacro, "a/b@~1.2.3:my/path", {
|
||||||
|
qlpack: undefined,
|
||||||
|
from: "a/b",
|
||||||
|
version: "~1.2.3",
|
||||||
|
query: undefined,
|
||||||
|
queries: "my/path",
|
||||||
|
apply: undefined,
|
||||||
|
});
|
||||||
|
(0, ava_1.default)(convertPackToQuerySuiteEntryMacro, "a/b:my/path/query.ql", {
|
||||||
|
qlpack: undefined,
|
||||||
|
from: "a/b",
|
||||||
|
version: undefined,
|
||||||
|
query: "my/path/query.ql",
|
||||||
|
queries: undefined,
|
||||||
|
apply: undefined,
|
||||||
|
});
|
||||||
|
(0, ava_1.default)(convertPackToQuerySuiteEntryMacro, "a/b@~1.2.3:my/path/query.ql", {
|
||||||
|
qlpack: undefined,
|
||||||
|
from: "a/b",
|
||||||
|
version: "~1.2.3",
|
||||||
|
query: "my/path/query.ql",
|
||||||
|
queries: undefined,
|
||||||
|
apply: undefined,
|
||||||
|
});
|
||||||
|
(0, ava_1.default)(convertPackToQuerySuiteEntryMacro, "a/b:my/path/suite.qls", {
|
||||||
|
qlpack: undefined,
|
||||||
|
from: "a/b",
|
||||||
|
version: undefined,
|
||||||
|
query: undefined,
|
||||||
|
queries: undefined,
|
||||||
|
apply: "my/path/suite.qls",
|
||||||
|
});
|
||||||
|
(0, ava_1.default)(convertPackToQuerySuiteEntryMacro, "a/b@~1.2.3:my/path/suite.qls", {
|
||||||
|
qlpack: undefined,
|
||||||
|
from: "a/b",
|
||||||
|
version: "~1.2.3",
|
||||||
|
query: undefined,
|
||||||
|
queries: undefined,
|
||||||
|
apply: "my/path/suite.qls",
|
||||||
|
});
|
||||||
|
(0, ava_1.default)("convertPackToQuerySuiteEntry Failure", (t) => {
|
||||||
|
t.throws(() => (0, analyze_1.convertPackToQuerySuiteEntry)("this-is-not-a-pack"));
|
||||||
|
});
|
||||||
|
(0, ava_1.default)("createQuerySuiteContents", (t) => {
|
||||||
|
const yamlResult = (0, analyze_1.createQuerySuiteContents)(["query1.ql", "query2.ql"], [
|
||||||
|
{
|
||||||
|
exclude: { "problem.severity": "recommendation" },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
include: { "problem.severity": "recommendation" },
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
const expected = `- query: query1.ql
|
||||||
|
- query: query2.ql
|
||||||
|
- exclude:
|
||||||
|
problem.severity: recommendation
|
||||||
|
- include:
|
||||||
|
problem.severity: recommendation
|
||||||
|
`;
|
||||||
|
t.deepEqual(yamlResult, expected);
|
||||||
|
});
|
||||||
const stubConfig = {
|
const stubConfig = {
|
||||||
languages: [languages_1.Language.cpp, languages_1.Language.go],
|
languages: [languages_1.Language.cpp, languages_1.Language.go],
|
||||||
queries: {},
|
queries: {},
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
7
lib/api-client.js
generated
7
lib/api-client.js
generated
|
|
@ -40,14 +40,16 @@ var DisallowedAPIVersionReason;
|
||||||
const getApiClient = function (apiDetails, { allowExternal = false } = {}) {
|
const getApiClient = function (apiDetails, { allowExternal = false } = {}) {
|
||||||
const auth = (allowExternal && apiDetails.externalRepoAuth) || apiDetails.auth;
|
const auth = (allowExternal && apiDetails.externalRepoAuth) || apiDetails.auth;
|
||||||
const retryingOctokit = githubUtils.GitHub.plugin(retry.retry);
|
const retryingOctokit = githubUtils.GitHub.plugin(retry.retry);
|
||||||
|
const apiURL = apiDetails.apiURL || deriveApiUrl(apiDetails.url);
|
||||||
return new retryingOctokit(githubUtils.getOctokitOptions(auth, {
|
return new retryingOctokit(githubUtils.getOctokitOptions(auth, {
|
||||||
baseUrl: getApiUrl(apiDetails.url),
|
baseUrl: apiURL,
|
||||||
userAgent: `CodeQL-${(0, util_1.getMode)()}/${pkg.version}`,
|
userAgent: `CodeQL-${(0, util_1.getMode)()}/${pkg.version}`,
|
||||||
log: (0, console_log_level_1.default)({ level: "debug" }),
|
log: (0, console_log_level_1.default)({ level: "debug" }),
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
exports.getApiClient = getApiClient;
|
exports.getApiClient = getApiClient;
|
||||||
function getApiUrl(githubUrl) {
|
// Once the runner is deleted, this can also be removed since the GitHub API URL is always available in an environment variable on Actions.
|
||||||
|
function deriveApiUrl(githubUrl) {
|
||||||
const url = new URL(githubUrl);
|
const url = new URL(githubUrl);
|
||||||
// If we detect this is trying to connect to github.com
|
// If we detect this is trying to connect to github.com
|
||||||
// then return with a fixed canonical URL.
|
// then return with a fixed canonical URL.
|
||||||
|
|
@ -62,6 +64,7 @@ function getApiDetails() {
|
||||||
return {
|
return {
|
||||||
auth: (0, actions_util_1.getRequiredInput)("token"),
|
auth: (0, actions_util_1.getRequiredInput)("token"),
|
||||||
url: (0, util_1.getRequiredEnvParam)("GITHUB_SERVER_URL"),
|
url: (0, util_1.getRequiredEnvParam)("GITHUB_SERVER_URL"),
|
||||||
|
apiURL: (0, util_1.getRequiredEnvParam)("GITHUB_API_URL"),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
// Temporary function to aid in the transition to running on and off of github actions.
|
// Temporary function to aid in the transition to running on and off of github actions.
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"api-client.js","sourceRoot":"","sources":["../src/api-client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;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,MAAM,EAAE,IAAA,0BAAmB,EAAC,gBAAgB,CAAC;KAC9C,CAAC;AACJ,CAAC;AAED,uFAAuF;AACvF,qFAAqF;AACrF,+CAA+C;AAC/C,SAAgB,mBAAmB;IACjC,OAAO,IAAA,oBAAY,EAAC,aAAa,EAAE,CAAC,CAAC;AACvC,CAAC;AAFD,kDAEC;AAED,IAAI,mBAAmB,GAA8B,SAAS,CAAC;AAE/D;;;;;;;GAOG;AACI,KAAK,UAAU,2BAA2B;IAC/C,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE;QACrB,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;KAC1E;IACD,IAAI,mBAAmB,KAAK,SAAS,EAAE;QACrC,mBAAmB,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,aAAa,EAAE,CAAC,CAAC;KACpE;IACD,OAAO,mBAAmB,CAAC;AAC7B,CAAC;AARD,kEAQC"}
|
||||||
11
lib/api-client.test.js
generated
11
lib/api-client.test.js
generated
|
|
@ -81,6 +81,17 @@ ava_1.default.beforeEach(() => {
|
||||||
userAgent: `CodeQL-Action/${pkg.version}`,
|
userAgent: `CodeQL-Action/${pkg.version}`,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
(0, ava_1.default)("Get the API with an API URL directly", async (t) => {
|
||||||
|
doTest(t, {
|
||||||
|
auth: "xyz",
|
||||||
|
url: "http://github.localhost",
|
||||||
|
apiURL: "http://api.github.localhost",
|
||||||
|
}, undefined, {
|
||||||
|
auth: "token xyz",
|
||||||
|
baseUrl: "http://api.github.localhost",
|
||||||
|
userAgent: `CodeQL-Action/${pkg.version}`,
|
||||||
|
});
|
||||||
|
});
|
||||||
function doTest(t, clientArgs, clientOptions, expected) {
|
function doTest(t, clientArgs, clientOptions, expected) {
|
||||||
(0, api_client_1.getApiClient)(clientArgs, clientOptions);
|
(0, api_client_1.getApiClient)(clientArgs, clientOptions);
|
||||||
const firstCallArgs = githubStub.args[0];
|
const firstCallArgs = githubStub.args[0];
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"api-client.test.js","sourceRoot":"","sources":["../src/api-client.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,uEAAyD;AACzD,8CAA6C;AAC7C,6CAA+B;AAE/B,6CAA4C;AAC5C,mDAA6C;AAC7C,iCAAqD;AAErD,8CAA8C;AAC9C,MAAM,GAAG,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAEvC,IAAA,0BAAU,EAAC,aAAI,CAAC,CAAC;AAEjB,IAAI,UAA2B,CAAC;AAChC,IAAI,UAA2B,CAAC;AAEhC,aAAI,CAAC,UAAU,CAAC,GAAG,EAAE;IACnB,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACtD,UAAU,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC1B,UAAU,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAC/B,IAAA,4BAAqB,EAAC,WAAI,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;AACnD,CAAC,CAAC,CAAC;AAEH,IAAA,aAAI,EAAC,oBAAoB,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IACrC,MAAM,CACJ,CAAC,EACD;QACE,IAAI,EAAE,KAAK;QACX,gBAAgB,EAAE,KAAK;QACvB,GAAG,EAAE,gBAAgB;KACtB,EACD,SAAS,EACT;QACE,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,uBAAuB;QAChC,SAAS,EAAE,iBAAiB,GAAG,CAAC,OAAO,EAAE;KAC1C,CACF,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,IAAA,aAAI,EAAC,6BAA6B,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IAC9C,MAAM,CACJ,CAAC,EACD;QACE,IAAI,EAAE,KAAK;QACX,gBAAgB,EAAE,KAAK;QAC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;IAExC,MAAM,aAAa,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACzC,iEAAiE;IACjE,OAAO,aAAa,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IAC5B,CAAC,CAAC,SAAS,CAAC,aAAa,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;AACzC,CAAC"}
|
||||||
2
lib/codeql.test.js
generated
2
lib/codeql.test.js
generated
|
|
@ -41,10 +41,12 @@ const util_1 = require("./util");
|
||||||
const sampleApiDetails = {
|
const sampleApiDetails = {
|
||||||
auth: "token",
|
auth: "token",
|
||||||
url: "https://github.com",
|
url: "https://github.com",
|
||||||
|
apiURL: undefined,
|
||||||
};
|
};
|
||||||
const sampleGHAEApiDetails = {
|
const sampleGHAEApiDetails = {
|
||||||
auth: "token",
|
auth: "token",
|
||||||
url: "https://example.githubenterprise.com",
|
url: "https://example.githubenterprise.com",
|
||||||
|
apiURL: undefined,
|
||||||
};
|
};
|
||||||
ava_1.default.beforeEach(() => {
|
ava_1.default.beforeEach(() => {
|
||||||
(0, util_1.initializeEnvironment)(util_1.Mode.actions, "1.2.3");
|
(0, util_1.initializeEnvironment)(util_1.Mode.actions, "1.2.3");
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
31
lib/config-utils.js
generated
31
lib/config-utils.js
generated
|
|
@ -19,7 +19,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.getConfig = exports.getPathToParsedConfigFile = exports.initConfig = exports.parsePacks = exports.validatePacksSpecification = exports.parsePacksFromConfig = exports.getDefaultConfig = exports.getUnknownLanguagesError = exports.getNoLanguagesError = exports.getConfigFileDirectoryGivenMessage = exports.getConfigFileFormatInvalidMessage = exports.getConfigFileRepoFormatInvalidMessage = exports.getConfigFileDoesNotExistErrorMessage = exports.getConfigFileOutsideWorkspaceErrorMessage = exports.getLocalPathDoesNotExist = exports.getLocalPathOutsideOfRepository = exports.getPacksStrInvalid = exports.getPacksInvalid = exports.getPacksInvalidSplit = exports.getPathsInvalid = exports.getPathsIgnoreInvalid = exports.getQueryUsesInvalid = exports.getQueriesInvalid = exports.getDisableDefaultQueriesInvalid = exports.getNameInvalid = exports.validateAndSanitisePath = void 0;
|
exports.getConfig = exports.getPathToParsedConfigFile = exports.initConfig = exports.parsePacks = exports.validatePackSpecification = exports.prettyPrintPack = exports.parsePacksSpecification = exports.parsePacksFromConfig = exports.getDefaultConfig = exports.getUnknownLanguagesError = exports.getNoLanguagesError = exports.getConfigFileDirectoryGivenMessage = exports.getConfigFileFormatInvalidMessage = exports.getConfigFileRepoFormatInvalidMessage = exports.getConfigFileDoesNotExistErrorMessage = exports.getConfigFileOutsideWorkspaceErrorMessage = exports.getLocalPathDoesNotExist = exports.getLocalPathOutsideOfRepository = exports.getPacksStrInvalid = exports.getPacksInvalid = exports.getPacksInvalidSplit = exports.getPathsInvalid = exports.getPathsIgnoreInvalid = exports.getQueryUsesInvalid = exports.getQueriesInvalid = exports.getDisableDefaultQueriesInvalid = exports.getNameInvalid = exports.validateAndSanitisePath = void 0;
|
||||||
const fs = __importStar(require("fs"));
|
const fs = __importStar(require("fs"));
|
||||||
const path = __importStar(require("path"));
|
const path = __importStar(require("path"));
|
||||||
const yaml = __importStar(require("js-yaml"));
|
const yaml = __importStar(require("js-yaml"));
|
||||||
|
|
@ -151,9 +151,7 @@ async function addBuiltinSuiteQueries(languages, codeQL, resultMap, packs, suite
|
||||||
return injectedMlQueries;
|
return injectedMlQueries;
|
||||||
}
|
}
|
||||||
function isMlPoweredJsQueriesPack(pack) {
|
function isMlPoweredJsQueriesPack(pack) {
|
||||||
return (pack === util_1.ML_POWERED_JS_QUERIES_PACK_NAME ||
|
return parsePacksSpecification(pack).name === util_1.ML_POWERED_JS_QUERIES_PACK_NAME;
|
||||||
pack.startsWith(`${util_1.ML_POWERED_JS_QUERIES_PACK_NAME}@`) ||
|
|
||||||
pack.startsWith(`${util_1.ML_POWERED_JS_QUERIES_PACK_NAME}:`));
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Retrieve the set of queries at localQueryPath and add them to resultMap.
|
* Retrieve the set of queries at localQueryPath and add them to resultMap.
|
||||||
|
|
@ -650,10 +648,7 @@ function parsePacksFromConfig(packsByLanguage, languages, configFile, logger) {
|
||||||
throw new Error(getPacksRequireLanguage(configFile, lang));
|
throw new Error(getPacksRequireLanguage(configFile, lang));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
packs[lang] = [];
|
packs[lang] = packsArr.map((packStr) => validatePackSpecification(packStr, configFile));
|
||||||
for (const packStr of packsArr) {
|
|
||||||
packs[lang].push(validatePacksSpecification(packStr, configFile));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return packs;
|
return packs;
|
||||||
}
|
}
|
||||||
|
|
@ -677,7 +672,7 @@ function parsePacksFromInput(packsInput, languages) {
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
[languages[0]]: packsInput.split(",").reduce((packs, pack) => {
|
[languages[0]]: packsInput.split(",").reduce((packs, pack) => {
|
||||||
packs.push(validatePacksSpecification(pack, ""));
|
packs.push(validatePackSpecification(pack));
|
||||||
return packs;
|
return packs;
|
||||||
}, []),
|
}, []),
|
||||||
};
|
};
|
||||||
|
|
@ -700,7 +695,7 @@ function parsePacksFromInput(packsInput, languages) {
|
||||||
* @param packStr the package specification to verify.
|
* @param packStr the package specification to verify.
|
||||||
* @param configFile Config file to use for error reporting
|
* @param configFile Config file to use for error reporting
|
||||||
*/
|
*/
|
||||||
function validatePacksSpecification(packStr, configFile) {
|
function parsePacksSpecification(packStr, configFile) {
|
||||||
if (typeof packStr !== "string") {
|
if (typeof packStr !== "string") {
|
||||||
throw new Error(getPacksStrInvalid(packStr, configFile));
|
throw new Error(getPacksStrInvalid(packStr, configFile));
|
||||||
}
|
}
|
||||||
|
|
@ -748,9 +743,21 @@ function validatePacksSpecification(packStr, configFile) {
|
||||||
// 0 length path
|
// 0 length path
|
||||||
throw new Error(getPacksStrInvalid(packStr, configFile));
|
throw new Error(getPacksStrInvalid(packStr, configFile));
|
||||||
}
|
}
|
||||||
return (packName + (version ? `@${version}` : "") + (packPath ? `:${packPath}` : ""));
|
return {
|
||||||
|
name: packName,
|
||||||
|
version,
|
||||||
|
path: packPath,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
exports.validatePacksSpecification = validatePacksSpecification;
|
exports.parsePacksSpecification = parsePacksSpecification;
|
||||||
|
function prettyPrintPack(pack) {
|
||||||
|
return `${pack.name}${pack.version ? `@${pack.version}` : ""}${pack.path ? `:${pack.path}` : ""}`;
|
||||||
|
}
|
||||||
|
exports.prettyPrintPack = prettyPrintPack;
|
||||||
|
function validatePackSpecification(pack, configFile) {
|
||||||
|
return prettyPrintPack(parsePacksSpecification(pack, configFile));
|
||||||
|
}
|
||||||
|
exports.validatePackSpecification = validatePackSpecification;
|
||||||
// exported for testing
|
// exported for testing
|
||||||
function parsePacks(rawPacksFromConfig, rawPacksInput, languages, configFile, logger) {
|
function parsePacks(rawPacksFromConfig, rawPacksInput, languages, configFile, logger) {
|
||||||
const packsFromInput = parsePacksFromInput(rawPacksInput, languages);
|
const packsFromInput = parsePacksFromInput(rawPacksInput, languages);
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
41
lib/config-utils.test.js
generated
41
lib/config-utils.test.js
generated
|
|
@ -40,6 +40,7 @@ const sampleApiDetails = {
|
||||||
auth: "token",
|
auth: "token",
|
||||||
externalRepoAuth: "token",
|
externalRepoAuth: "token",
|
||||||
url: "https://github.example.com",
|
url: "https://github.example.com",
|
||||||
|
apiURL: undefined,
|
||||||
};
|
};
|
||||||
const gitHubVersion = { type: util.GitHubVariant.DOTCOM };
|
const gitHubVersion = { type: util.GitHubVariant.DOTCOM };
|
||||||
// Returns the filepath of the newly-created file
|
// Returns the filepath of the newly-created file
|
||||||
|
|
@ -833,6 +834,46 @@ const invalidPackNameMacro = ava_1.default.macro({
|
||||||
(0, ava_1.default)(invalidPackNameMacro, "c/d@../a");
|
(0, ava_1.default)(invalidPackNameMacro, "c/d@../a");
|
||||||
(0, ava_1.default)(invalidPackNameMacro, "c/d@b/../a");
|
(0, ava_1.default)(invalidPackNameMacro, "c/d@b/../a");
|
||||||
(0, ava_1.default)(invalidPackNameMacro, "c/d:z@1");
|
(0, ava_1.default)(invalidPackNameMacro, "c/d:z@1");
|
||||||
|
/**
|
||||||
|
* Test macro for pretty printing pack specs
|
||||||
|
*/
|
||||||
|
const packSpecPrettyPrintingMacro = ava_1.default.macro({
|
||||||
|
exec: (t, packStr, packObj) => {
|
||||||
|
const parsed = configUtils.parsePacksSpecification(packStr);
|
||||||
|
t.deepEqual(parsed, packObj, "parsed pack spec is correct");
|
||||||
|
const stringified = configUtils.prettyPrintPack(packObj);
|
||||||
|
t.deepEqual(stringified, packStr.trim(), "pretty-printed pack spec is correct");
|
||||||
|
t.deepEqual(configUtils.validatePackSpecification(packStr), packStr.trim(), "pack spec is valid");
|
||||||
|
},
|
||||||
|
title: (_providedTitle, packStr,
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
_packObj) => `Prettyprint pack spec: '${packStr}'`,
|
||||||
|
});
|
||||||
|
(0, ava_1.default)(packSpecPrettyPrintingMacro, "a/b", {
|
||||||
|
name: "a/b",
|
||||||
|
version: undefined,
|
||||||
|
path: undefined,
|
||||||
|
});
|
||||||
|
(0, ava_1.default)(packSpecPrettyPrintingMacro, "a/b@~1.2.3", {
|
||||||
|
name: "a/b",
|
||||||
|
version: "~1.2.3",
|
||||||
|
path: undefined,
|
||||||
|
});
|
||||||
|
(0, ava_1.default)(packSpecPrettyPrintingMacro, "a/b@~1.2.3:abc/def", {
|
||||||
|
name: "a/b",
|
||||||
|
version: "~1.2.3",
|
||||||
|
path: "abc/def",
|
||||||
|
});
|
||||||
|
(0, ava_1.default)(packSpecPrettyPrintingMacro, "a/b:abc/def", {
|
||||||
|
name: "a/b",
|
||||||
|
version: undefined,
|
||||||
|
path: "abc/def",
|
||||||
|
});
|
||||||
|
(0, ava_1.default)(packSpecPrettyPrintingMacro, " a/b:abc/def ", {
|
||||||
|
name: "a/b",
|
||||||
|
version: undefined,
|
||||||
|
path: "abc/def",
|
||||||
|
});
|
||||||
/**
|
/**
|
||||||
* Test macro for testing the packs block and the packs input
|
* Test macro for testing the packs block and the packs input
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
1
lib/database-upload.test.js
generated
1
lib/database-upload.test.js
generated
|
|
@ -41,6 +41,7 @@ const testRepoName = { owner: "github", repo: "example" };
|
||||||
const testApiDetails = {
|
const testApiDetails = {
|
||||||
auth: "1234",
|
auth: "1234",
|
||||||
url: "https://github.com",
|
url: "https://github.com",
|
||||||
|
apiURL: undefined,
|
||||||
};
|
};
|
||||||
function getTestConfig(tmpDir) {
|
function getTestConfig(tmpDir) {
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
16
lib/external-queries.test.js
generated
16
lib/external-queries.test.js
generated
|
|
@ -93,14 +93,22 @@ const util = __importStar(require("./util"));
|
||||||
const commit2Sha = await runGit(["rev-parse", "HEAD"]);
|
const commit2Sha = await runGit(["rev-parse", "HEAD"]);
|
||||||
// Checkout the first commit, which should contain 'a' and 'b'
|
// Checkout the first commit, which should contain 'a' and 'b'
|
||||||
t.false(fs.existsSync(path.join(tmpDir, repoName)));
|
t.false(fs.existsSync(path.join(tmpDir, repoName)));
|
||||||
await externalQueries.checkoutExternalRepository(repoName, commit1Sha, { url: `file://${testRepoBaseDir}`, externalRepoAuth: "" }, tmpDir, (0, logging_1.getRunnerLogger)(true));
|
await externalQueries.checkoutExternalRepository(repoName, commit1Sha, {
|
||||||
|
url: `file://${testRepoBaseDir}`,
|
||||||
|
externalRepoAuth: "",
|
||||||
|
apiURL: undefined,
|
||||||
|
}, tmpDir, (0, logging_1.getRunnerLogger)(true));
|
||||||
t.true(fs.existsSync(path.join(tmpDir, repoName)));
|
t.true(fs.existsSync(path.join(tmpDir, repoName)));
|
||||||
t.true(fs.existsSync(path.join(tmpDir, repoName, commit1Sha)));
|
t.true(fs.existsSync(path.join(tmpDir, repoName, commit1Sha)));
|
||||||
t.true(fs.existsSync(path.join(tmpDir, repoName, commit1Sha, "a")));
|
t.true(fs.existsSync(path.join(tmpDir, repoName, commit1Sha, "a")));
|
||||||
t.true(fs.existsSync(path.join(tmpDir, repoName, commit1Sha, "b")));
|
t.true(fs.existsSync(path.join(tmpDir, repoName, commit1Sha, "b")));
|
||||||
// Checkout the second commit as well, which should only contain 'a'
|
// Checkout the second commit as well, which should only contain 'a'
|
||||||
t.false(fs.existsSync(path.join(tmpDir, repoName, commit2Sha)));
|
t.false(fs.existsSync(path.join(tmpDir, repoName, commit2Sha)));
|
||||||
await externalQueries.checkoutExternalRepository(repoName, commit2Sha, { url: `file://${testRepoBaseDir}`, externalRepoAuth: "" }, tmpDir, (0, logging_1.getRunnerLogger)(true));
|
await externalQueries.checkoutExternalRepository(repoName, commit2Sha, {
|
||||||
|
url: `file://${testRepoBaseDir}`,
|
||||||
|
externalRepoAuth: "",
|
||||||
|
apiURL: undefined,
|
||||||
|
}, tmpDir, (0, logging_1.getRunnerLogger)(true));
|
||||||
t.true(fs.existsSync(path.join(tmpDir, repoName, commit2Sha)));
|
t.true(fs.existsSync(path.join(tmpDir, repoName, commit2Sha)));
|
||||||
t.true(fs.existsSync(path.join(tmpDir, repoName, commit2Sha, "a")));
|
t.true(fs.existsSync(path.join(tmpDir, repoName, commit2Sha, "a")));
|
||||||
t.false(fs.existsSync(path.join(tmpDir, repoName, commit2Sha, "b")));
|
t.false(fs.existsSync(path.join(tmpDir, repoName, commit2Sha, "b")));
|
||||||
|
|
@ -110,18 +118,22 @@ const util = __importStar(require("./util"));
|
||||||
t.deepEqual(externalQueries.buildCheckoutURL("foo/bar", {
|
t.deepEqual(externalQueries.buildCheckoutURL("foo/bar", {
|
||||||
url: "https://github.com",
|
url: "https://github.com",
|
||||||
externalRepoAuth: undefined,
|
externalRepoAuth: undefined,
|
||||||
|
apiURL: undefined,
|
||||||
}), "https://github.com/foo/bar");
|
}), "https://github.com/foo/bar");
|
||||||
t.deepEqual(externalQueries.buildCheckoutURL("foo/bar", {
|
t.deepEqual(externalQueries.buildCheckoutURL("foo/bar", {
|
||||||
url: "https://github.example.com/",
|
url: "https://github.example.com/",
|
||||||
externalRepoAuth: undefined,
|
externalRepoAuth: undefined,
|
||||||
|
apiURL: undefined,
|
||||||
}), "https://github.example.com/foo/bar");
|
}), "https://github.example.com/foo/bar");
|
||||||
t.deepEqual(externalQueries.buildCheckoutURL("foo/bar", {
|
t.deepEqual(externalQueries.buildCheckoutURL("foo/bar", {
|
||||||
url: "https://github.com",
|
url: "https://github.com",
|
||||||
externalRepoAuth: "abc",
|
externalRepoAuth: "abc",
|
||||||
|
apiURL: undefined,
|
||||||
}), "https://x-access-token:abc@github.com/foo/bar");
|
}), "https://x-access-token:abc@github.com/foo/bar");
|
||||||
t.deepEqual(externalQueries.buildCheckoutURL("foo/bar", {
|
t.deepEqual(externalQueries.buildCheckoutURL("foo/bar", {
|
||||||
url: "https://github.example.com/",
|
url: "https://github.example.com/",
|
||||||
externalRepoAuth: "abc",
|
externalRepoAuth: "abc",
|
||||||
|
apiURL: undefined,
|
||||||
}), "https://x-access-token:abc@github.example.com/foo/bar");
|
}), "https://x-access-token:abc@github.example.com/foo/bar");
|
||||||
});
|
});
|
||||||
//# sourceMappingURL=external-queries.test.js.map
|
//# sourceMappingURL=external-queries.test.js.map
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"external-queries.test.js","sourceRoot":"","sources":["../src/external-queries.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAE7B,yEAA2D;AAC3D,kEAAoD;AACpD,8CAAuB;AAEvB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,7 @@ ava_1.default.beforeEach(() => {
|
||||||
const testApiDetails = {
|
const testApiDetails = {
|
||||||
auth: "1234",
|
auth: "1234",
|
||||||
url: "https://github.com",
|
url: "https://github.com",
|
||||||
|
apiURL: undefined,
|
||||||
};
|
};
|
||||||
const testRepositoryNwo = (0, repository_1.parseRepositoryNwo)("github/example");
|
const testRepositoryNwo = (0, repository_1.parseRepositoryNwo)("github/example");
|
||||||
const ALL_FEATURE_FLAGS_DISABLED_VARIANTS = [
|
const ALL_FEATURE_FLAGS_DISABLED_VARIANTS = [
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"feature-flags.test.js","sourceRoot":"","sources":["../src/feature-flags.test.ts"],"names":[],"mappings":";;;;;AAAA,8CAAuB;AAGvB,mDAAkE;AAClE,uCAA4C;AAC5C,6CAAkD;AAClD,mDAMyB;AAEzB,iCAAgF;AAEhF,IAAA,0BAAU,EAAC,aAAI,CAAC,CAAC;AAEjB,aAAI,CAAC,UAAU,CAAC,GAAG,EAAE;IACnB,IAAA,4BAAqB,EAAC,WAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAC/C,CAAC,CAAC,CAAC;AAEH,MAAM,cAAc,GAAqB;IACvC,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,oBAAoB;CAC1B,CAAC;AAEF,MAAM,iBAAiB,GAAG,IAAA,+BAAkB,EAAC,gBAAgB,CAAC,CAAC;AAE/D,MAAM,mCAAmC,GAGpC;IACH;QACE,WAAW,EAAE,MAAM;QACnB,aAAa,EAAE,EAAE,IAAI,EAAE,oBAAa,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE;KAC9D;IACD,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,EAAE,IAAI,EAAE,oBAAa,CAAC,IAAI,EAAE,EAAE;CACrE,CAAC;AAEF,KAAK,MAAM,OAAO,IAAI,mCAAmC,EAAE;IACzD,IAAA,aAAI,EAAC,qDAAqD,OAAO,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,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;QAC1F,MAAM,IAAA,iBAAU,EAAC,KAAK,EAAE,MAAM,EAAE,EAAE;YAChC,IAAA,gCAAgB,EAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YAEjC,MAAM,YAAY,GAAG,IAAI,kCAAkB,CACzC,EAAE,IAAI,EAAE,oBAAa,CAAC,MAAM,EAAE,EAC9B,cAAc,EACd,iBAAiB,EACjB,IAAA,yBAAe,EAAC,IAAI,CAAC,CACtB,CAAC;YAEF,MAAM,oBAAoB,GAAgC,EAAE,CAAC;YAC7D,KAAK,MAAM,CAAC,IAAI,aAAa,EAAE;gBAC7B,oBAAoB,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;aACjC;YACD,oBAAoB,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC;YACzC,IAAA,0CAA0B,EAAC,GAAG,EAAE,oBAAoB,CAAC,CAAC;YAEtD,MAAM,kBAAkB,GAAgC;gBACtD,0BAA0B,EAAE,MAAM,YAAY,CAAC,QAAQ,CACrD,2BAAW,CAAC,uBAAuB,CACpC;gBACD,yBAAyB,EAAE,MAAM,YAAY,CAAC,QAAQ,CACpD,2BAAW,CAAC,sBAAsB,CACnC;aACF,CAAC;YAEF,CAAC,CAAC,SAAS,CAAC,kBAAkB,EAAE,oBAAoB,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;CACJ"}
|
||||||
1
lib/init-action.js
generated
1
lib/init-action.js
generated
|
|
@ -79,6 +79,7 @@ async function run() {
|
||||||
auth: (0, actions_util_1.getRequiredInput)("token"),
|
auth: (0, actions_util_1.getRequiredInput)("token"),
|
||||||
externalRepoAuth: (0, actions_util_1.getOptionalInput)("external-repository-token"),
|
externalRepoAuth: (0, actions_util_1.getOptionalInput)("external-repository-token"),
|
||||||
url: (0, util_1.getRequiredEnvParam)("GITHUB_SERVER_URL"),
|
url: (0, util_1.getRequiredEnvParam)("GITHUB_SERVER_URL"),
|
||||||
|
apiURL: (0, util_1.getRequiredEnvParam)("GITHUB_API_URL"),
|
||||||
};
|
};
|
||||||
const gitHubVersion = await (0, api_client_1.getGitHubVersionActionsOnly)();
|
const gitHubVersion = await (0, api_client_1.getGitHubVersionActionsOnly)();
|
||||||
(0, util_1.checkGitHubVersionInRange)(gitHubVersion, logger, util_1.Mode.actions);
|
(0, util_1.checkGitHubVersionInRange)(gitHubVersion, logger, util_1.Mode.actions);
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
3
lib/runner.js
generated
3
lib/runner.js
generated
|
|
@ -136,6 +136,7 @@ program
|
||||||
auth,
|
auth,
|
||||||
externalRepoAuth: auth,
|
externalRepoAuth: auth,
|
||||||
url: (0, util_1.parseGitHubUrl)(cmd.githubUrl),
|
url: (0, util_1.parseGitHubUrl)(cmd.githubUrl),
|
||||||
|
apiURL: undefined,
|
||||||
};
|
};
|
||||||
const gitHubVersion = await (0, util_1.getGitHubVersion)(apiDetails);
|
const gitHubVersion = await (0, util_1.getGitHubVersion)(apiDetails);
|
||||||
(0, util_1.checkGitHubVersionInRange)(gitHubVersion, logger, util_1.Mode.runner);
|
(0, util_1.checkGitHubVersionInRange)(gitHubVersion, logger, util_1.Mode.runner);
|
||||||
|
|
@ -277,6 +278,7 @@ program
|
||||||
const apiDetails = {
|
const apiDetails = {
|
||||||
auth,
|
auth,
|
||||||
url: (0, util_1.parseGitHubUrl)(cmd.githubUrl),
|
url: (0, util_1.parseGitHubUrl)(cmd.githubUrl),
|
||||||
|
apiURL: undefined,
|
||||||
};
|
};
|
||||||
const outputDir = cmd.outputDir || path.join(config.tempDir, "codeql-sarif");
|
const outputDir = cmd.outputDir || path.join(config.tempDir, "codeql-sarif");
|
||||||
let initEnv = {};
|
let initEnv = {};
|
||||||
|
|
@ -322,6 +324,7 @@ program
|
||||||
const apiDetails = {
|
const apiDetails = {
|
||||||
auth,
|
auth,
|
||||||
url: (0, util_1.parseGitHubUrl)(cmd.githubUrl),
|
url: (0, util_1.parseGitHubUrl)(cmd.githubUrl),
|
||||||
|
apiURL: undefined,
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
const gitHubVersion = await (0, util_1.getGitHubVersion)(apiDetails);
|
const gitHubVersion = await (0, util_1.getGitHubVersion)(apiDetails);
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
1
lib/upload-sarif-action.js
generated
1
lib/upload-sarif-action.js
generated
|
|
@ -47,6 +47,7 @@ async function run() {
|
||||||
const apiDetails = {
|
const apiDetails = {
|
||||||
auth: actionsUtil.getRequiredInput("token"),
|
auth: actionsUtil.getRequiredInput("token"),
|
||||||
url: (0, util_1.getRequiredEnvParam)("GITHUB_SERVER_URL"),
|
url: (0, util_1.getRequiredEnvParam)("GITHUB_SERVER_URL"),
|
||||||
|
apiURL: (0, util_1.getRequiredEnvParam)("GITHUB_API_URL"),
|
||||||
};
|
};
|
||||||
const gitHubVersion = await (0, api_client_1.getGitHubVersionActionsOnly)();
|
const gitHubVersion = await (0, api_client_1.getGitHubVersionActionsOnly)();
|
||||||
const uploadResult = await upload_lib.uploadFromActions(actionsUtil.getRequiredInput("sarif_file"), gitHubVersion, apiDetails, (0, logging_1.getActionsLogger)());
|
const uploadResult = await upload_lib.uploadFromActions(actionsUtil.getRequiredInput("sarif_file"), gitHubVersion, apiDetails, (0, logging_1.getActionsLogger)());
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"upload-sarif-action.js","sourceRoot":"","sources":["../src/upload-sarif-action.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AAEtC,4DAA8C;AAC9C,6CAA2D;AAC3D,uCAA6C;AAC7C,6CAAkD;AAClD,yDAA2C;AAC3C,iCAMgB;AAEhB,8CAA8C;AAC9C,MAAM,GAAG,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAMvC,KAAK,UAAU,uBAAuB,CACpC,SAAe,EACf,WAA0C;IAE1C,MAAM,gBAA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KACpB;AACH,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}
|
||||||
13
lib/util.js
generated
13
lib/util.js
generated
|
|
@ -33,6 +33,7 @@ const api = __importStar(require("./api-client"));
|
||||||
const api_client_1 = require("./api-client");
|
const api_client_1 = require("./api-client");
|
||||||
const apiCompatibility = __importStar(require("./api-compatibility.json"));
|
const apiCompatibility = __importStar(require("./api-compatibility.json"));
|
||||||
const codeql_1 = require("./codeql");
|
const codeql_1 = require("./codeql");
|
||||||
|
const config_utils_1 = require("./config-utils");
|
||||||
/**
|
/**
|
||||||
* Specifies bundle versions that are known to be broken
|
* Specifies bundle versions that are known to be broken
|
||||||
* and will not be used if found in the toolcache.
|
* and will not be used if found in the toolcache.
|
||||||
|
|
@ -558,7 +559,10 @@ async function getMlPoweredJsQueriesPack(codeQL) {
|
||||||
else {
|
else {
|
||||||
version = `~0.1.0`;
|
version = `~0.1.0`;
|
||||||
}
|
}
|
||||||
return `${exports.ML_POWERED_JS_QUERIES_PACK_NAME}@${version}`;
|
return (0, config_utils_1.prettyPrintPack)({
|
||||||
|
name: exports.ML_POWERED_JS_QUERIES_PACK_NAME,
|
||||||
|
version,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
exports.getMlPoweredJsQueriesPack = getMlPoweredJsQueriesPack;
|
exports.getMlPoweredJsQueriesPack = getMlPoweredJsQueriesPack;
|
||||||
/**
|
/**
|
||||||
|
|
@ -584,9 +588,8 @@ exports.getMlPoweredJsQueriesPack = getMlPoweredJsQueriesPack;
|
||||||
*/
|
*/
|
||||||
function getMlPoweredJsQueriesStatus(config) {
|
function getMlPoweredJsQueriesStatus(config) {
|
||||||
const mlPoweredJsQueryPacks = (config.packs.javascript || [])
|
const mlPoweredJsQueryPacks = (config.packs.javascript || [])
|
||||||
.map((pack) => pack.split("@"))
|
.map((p) => (0, config_utils_1.parsePacksSpecification)(p))
|
||||||
.filter((packNameVersion) => packNameVersion[0] === "codeql/javascript-experimental-atm-queries" &&
|
.filter((pack) => pack.name === "codeql/javascript-experimental-atm-queries" && !pack.path);
|
||||||
packNameVersion.length <= 2);
|
|
||||||
switch (mlPoweredJsQueryPacks.length) {
|
switch (mlPoweredJsQueryPacks.length) {
|
||||||
case 1:
|
case 1:
|
||||||
// We should always specify an explicit version string in `getMlPoweredJsQueriesPack`,
|
// We should always specify an explicit version string in `getMlPoweredJsQueriesPack`,
|
||||||
|
|
@ -594,7 +597,7 @@ function getMlPoweredJsQueriesStatus(config) {
|
||||||
// with each version of the CodeQL Action. Therefore in practice we should only hit the
|
// with each version of the CodeQL Action. Therefore in practice we should only hit the
|
||||||
// `latest` case here when customers have explicitly added the ML-powered query pack to their
|
// `latest` case here when customers have explicitly added the ML-powered query pack to their
|
||||||
// CodeQL config.
|
// CodeQL config.
|
||||||
return mlPoweredJsQueryPacks[0][1] || "latest";
|
return mlPoweredJsQueryPacks[0].version || "latest";
|
||||||
case 0:
|
case 0:
|
||||||
return "false";
|
return "false";
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
10
lib/util.test.js
generated
10
lib/util.test.js
generated
|
|
@ -155,24 +155,28 @@ function mockGetMetaVersionHeader(versionHeader) {
|
||||||
const v = await util.getGitHubVersion({
|
const v = await util.getGitHubVersion({
|
||||||
auth: "",
|
auth: "",
|
||||||
url: "https://github.com",
|
url: "https://github.com",
|
||||||
|
apiURL: undefined,
|
||||||
});
|
});
|
||||||
t.deepEqual(util.GitHubVariant.DOTCOM, v.type);
|
t.deepEqual(util.GitHubVariant.DOTCOM, v.type);
|
||||||
mockGetMetaVersionHeader("2.0");
|
mockGetMetaVersionHeader("2.0");
|
||||||
const v2 = await util.getGitHubVersion({
|
const v2 = await util.getGitHubVersion({
|
||||||
auth: "",
|
auth: "",
|
||||||
url: "https://ghe.example.com",
|
url: "https://ghe.example.com",
|
||||||
|
apiURL: undefined,
|
||||||
});
|
});
|
||||||
t.deepEqual({ type: util.GitHubVariant.GHES, version: "2.0" }, v2);
|
t.deepEqual({ type: util.GitHubVariant.GHES, version: "2.0" }, v2);
|
||||||
mockGetMetaVersionHeader("GitHub AE");
|
mockGetMetaVersionHeader("GitHub AE");
|
||||||
const ghae = await util.getGitHubVersion({
|
const ghae = await util.getGitHubVersion({
|
||||||
auth: "",
|
auth: "",
|
||||||
url: "https://example.githubenterprise.com",
|
url: "https://example.githubenterprise.com",
|
||||||
|
apiURL: undefined,
|
||||||
});
|
});
|
||||||
t.deepEqual({ type: util.GitHubVariant.GHAE }, ghae);
|
t.deepEqual({ type: util.GitHubVariant.GHAE }, ghae);
|
||||||
mockGetMetaVersionHeader(undefined);
|
mockGetMetaVersionHeader(undefined);
|
||||||
const v3 = await util.getGitHubVersion({
|
const v3 = await util.getGitHubVersion({
|
||||||
auth: "",
|
auth: "",
|
||||||
url: "https://ghe.example.com",
|
url: "https://ghe.example.com",
|
||||||
|
apiURL: undefined,
|
||||||
});
|
});
|
||||||
t.deepEqual({ type: util.GitHubVariant.DOTCOM }, v3);
|
t.deepEqual({ type: util.GitHubVariant.DOTCOM }, v3);
|
||||||
});
|
});
|
||||||
|
|
@ -210,13 +214,13 @@ const ML_POWERED_JS_STATUS_TESTS = [
|
||||||
// If no packs are loaded, status is false.
|
// If no packs are loaded, status is false.
|
||||||
[[], "false"],
|
[[], "false"],
|
||||||
// If another pack is loaded but not the ML-powered query pack, status is false.
|
// If another pack is loaded but not the ML-powered query pack, status is false.
|
||||||
[["someOtherPack"], "false"],
|
[["some-other/pack"], "false"],
|
||||||
// If the ML-powered query pack is loaded with a specific version, status is that version.
|
// If the ML-powered query pack is loaded with a specific version, status is that version.
|
||||||
[[`${util.ML_POWERED_JS_QUERIES_PACK_NAME}@~0.1.0`], "~0.1.0"],
|
[[`${util.ML_POWERED_JS_QUERIES_PACK_NAME}@~0.1.0`], "~0.1.0"],
|
||||||
// If the ML-powered query pack is loaded with a specific version and another pack is loaded, the
|
// If the ML-powered query pack is loaded with a specific version and another pack is loaded, the
|
||||||
// status is the version of the ML-powered query pack.
|
// status is the version of the ML-powered query pack.
|
||||||
[
|
[
|
||||||
["someOtherPack", `${util.ML_POWERED_JS_QUERIES_PACK_NAME}@~0.1.0`],
|
["some-other/pack", `${util.ML_POWERED_JS_QUERIES_PACK_NAME}@~0.1.0`],
|
||||||
"~0.1.0",
|
"~0.1.0",
|
||||||
],
|
],
|
||||||
// If the ML-powered query pack is loaded without a version, the status is "latest".
|
// If the ML-powered query pack is loaded without a version, the status is "latest".
|
||||||
|
|
@ -231,7 +235,7 @@ const ML_POWERED_JS_STATUS_TESTS = [
|
||||||
],
|
],
|
||||||
// If the ML-powered query pack is loaded with no specific version, and another pack is loaded,
|
// If the ML-powered query pack is loaded with no specific version, and another pack is loaded,
|
||||||
// the status is "latest".
|
// the status is "latest".
|
||||||
[["someOtherPack", util.ML_POWERED_JS_QUERIES_PACK_NAME], "latest"],
|
[["some-other/pack", util.ML_POWERED_JS_QUERIES_PACK_NAME], "latest"],
|
||||||
];
|
];
|
||||||
for (const [packs, expectedStatus] of ML_POWERED_JS_STATUS_TESTS) {
|
for (const [packs, expectedStatus] of ML_POWERED_JS_STATUS_TESTS) {
|
||||||
const packDescriptions = `[${packs
|
const packDescriptions = `[${packs
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -24,6 +24,7 @@ test("analyze action with RAM & threads from environment variables", async (t) =
|
||||||
await util.withTmpDir(async (tmpDir) => {
|
await util.withTmpDir(async (tmpDir) => {
|
||||||
process.env["GITHUB_SERVER_URL"] = util.GITHUB_DOTCOM_URL;
|
process.env["GITHUB_SERVER_URL"] = util.GITHUB_DOTCOM_URL;
|
||||||
process.env["GITHUB_REPOSITORY"] = "github/codeql-action-fake-repository";
|
process.env["GITHUB_REPOSITORY"] = "github/codeql-action-fake-repository";
|
||||||
|
process.env["GITHUB_API_URL"] = "https://api.github.com";
|
||||||
sinon
|
sinon
|
||||||
.stub(actionsUtil, "createStatusReportBase")
|
.stub(actionsUtil, "createStatusReportBase")
|
||||||
.resolves({} as actionsUtil.StatusReportBase);
|
.resolves({} as actionsUtil.StatusReportBase);
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ test("analyze action with RAM & threads from action inputs", async (t) => {
|
||||||
await util.withTmpDir(async (tmpDir) => {
|
await util.withTmpDir(async (tmpDir) => {
|
||||||
process.env["GITHUB_SERVER_URL"] = util.GITHUB_DOTCOM_URL;
|
process.env["GITHUB_SERVER_URL"] = util.GITHUB_DOTCOM_URL;
|
||||||
process.env["GITHUB_REPOSITORY"] = "github/codeql-action-fake-repository";
|
process.env["GITHUB_REPOSITORY"] = "github/codeql-action-fake-repository";
|
||||||
|
process.env["GITHUB_API_URL"] = "https://api.github.com";
|
||||||
sinon
|
sinon
|
||||||
.stub(actionsUtil, "createStatusReportBase")
|
.stub(actionsUtil, "createStatusReportBase")
|
||||||
.resolves({} as actionsUtil.StatusReportBase);
|
.resolves({} as actionsUtil.StatusReportBase);
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,7 @@ async function run() {
|
||||||
const apiDetails = {
|
const apiDetails = {
|
||||||
auth: actionsUtil.getRequiredInput("token"),
|
auth: actionsUtil.getRequiredInput("token"),
|
||||||
url: util.getRequiredEnvParam("GITHUB_SERVER_URL"),
|
url: util.getRequiredEnvParam("GITHUB_SERVER_URL"),
|
||||||
|
apiURL: util.getRequiredEnvParam("GITHUB_API_URL"),
|
||||||
};
|
};
|
||||||
const outputDir = actionsUtil.getRequiredInput("output");
|
const outputDir = actionsUtil.getRequiredInput("output");
|
||||||
const threads = util.getThreadsFlag(
|
const threads = util.getThreadsFlag(
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,17 @@
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import * as path from "path";
|
import * as path from "path";
|
||||||
|
|
||||||
import test from "ava";
|
import test, { ExecutionContext } from "ava";
|
||||||
import * as yaml from "js-yaml";
|
import * as yaml from "js-yaml";
|
||||||
import * as sinon from "sinon";
|
import * as sinon from "sinon";
|
||||||
|
|
||||||
import { runQueries, createdDBForScannedLanguages } from "./analyze";
|
import {
|
||||||
|
convertPackToQuerySuiteEntry,
|
||||||
|
createdDBForScannedLanguages,
|
||||||
|
createQuerySuiteContents,
|
||||||
|
runQueries,
|
||||||
|
validateQueryFilters,
|
||||||
|
} from "./analyze";
|
||||||
import { setCodeQL, getCodeQLForTesting } from "./codeql";
|
import { setCodeQL, getCodeQLForTesting } from "./codeql";
|
||||||
import { stubToolRunnerConstructor } from "./codeql.test";
|
import { stubToolRunnerConstructor } from "./codeql.test";
|
||||||
import { Config } from "./config-utils";
|
import { Config } from "./config-utils";
|
||||||
|
|
@ -252,6 +258,164 @@ test("status report fields and search path setting", async (t) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("validateQueryFilters", (t) => {
|
||||||
|
t.notThrows(() => validateQueryFilters([]));
|
||||||
|
t.notThrows(() => validateQueryFilters(undefined));
|
||||||
|
t.notThrows(() => {
|
||||||
|
return validateQueryFilters([
|
||||||
|
{
|
||||||
|
exclude: {
|
||||||
|
"problem.severity": "recommendation",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
exclude: {
|
||||||
|
"tags contain": ["foo", "bar"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
include: {
|
||||||
|
"problem.severity": "something-to-think-about",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
include: {
|
||||||
|
"tags contain": ["baz", "bop"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
t.throws(
|
||||||
|
() => {
|
||||||
|
return validateQueryFilters([
|
||||||
|
{
|
||||||
|
exclude: {
|
||||||
|
"tags contain": ["foo", "bar"],
|
||||||
|
},
|
||||||
|
include: {
|
||||||
|
"tags contain": ["baz", "bop"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
},
|
||||||
|
{ message: /Query filter must have exactly one key/ }
|
||||||
|
);
|
||||||
|
|
||||||
|
t.throws(
|
||||||
|
() => {
|
||||||
|
return validateQueryFilters([{ xxx: "foo" } as any]);
|
||||||
|
},
|
||||||
|
{ message: /Only "include" or "exclude" filters are allowed/ }
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
const convertPackToQuerySuiteEntryMacro = test.macro({
|
||||||
|
exec: (t: ExecutionContext<unknown>, packSpec: string, suiteEntry: any) =>
|
||||||
|
t.deepEqual(convertPackToQuerySuiteEntry(packSpec), suiteEntry),
|
||||||
|
|
||||||
|
title: (_providedTitle, packSpec: string) => `Query Suite Entry: ${packSpec}`,
|
||||||
|
});
|
||||||
|
|
||||||
|
test(convertPackToQuerySuiteEntryMacro, "a/b", {
|
||||||
|
qlpack: "a/b",
|
||||||
|
from: undefined,
|
||||||
|
version: undefined,
|
||||||
|
query: undefined,
|
||||||
|
queries: undefined,
|
||||||
|
apply: undefined,
|
||||||
|
});
|
||||||
|
|
||||||
|
test(convertPackToQuerySuiteEntryMacro, "a/b@~1.2.3", {
|
||||||
|
qlpack: "a/b",
|
||||||
|
from: undefined,
|
||||||
|
version: "~1.2.3",
|
||||||
|
query: undefined,
|
||||||
|
queries: undefined,
|
||||||
|
apply: undefined,
|
||||||
|
});
|
||||||
|
|
||||||
|
test(convertPackToQuerySuiteEntryMacro, "a/b:my/path", {
|
||||||
|
qlpack: undefined,
|
||||||
|
from: "a/b",
|
||||||
|
version: undefined,
|
||||||
|
query: undefined,
|
||||||
|
queries: "my/path",
|
||||||
|
apply: undefined,
|
||||||
|
});
|
||||||
|
|
||||||
|
test(convertPackToQuerySuiteEntryMacro, "a/b@~1.2.3:my/path", {
|
||||||
|
qlpack: undefined,
|
||||||
|
from: "a/b",
|
||||||
|
version: "~1.2.3",
|
||||||
|
query: undefined,
|
||||||
|
queries: "my/path",
|
||||||
|
apply: undefined,
|
||||||
|
});
|
||||||
|
|
||||||
|
test(convertPackToQuerySuiteEntryMacro, "a/b:my/path/query.ql", {
|
||||||
|
qlpack: undefined,
|
||||||
|
from: "a/b",
|
||||||
|
version: undefined,
|
||||||
|
query: "my/path/query.ql",
|
||||||
|
queries: undefined,
|
||||||
|
apply: undefined,
|
||||||
|
});
|
||||||
|
|
||||||
|
test(convertPackToQuerySuiteEntryMacro, "a/b@~1.2.3:my/path/query.ql", {
|
||||||
|
qlpack: undefined,
|
||||||
|
from: "a/b",
|
||||||
|
version: "~1.2.3",
|
||||||
|
query: "my/path/query.ql",
|
||||||
|
queries: undefined,
|
||||||
|
apply: undefined,
|
||||||
|
});
|
||||||
|
|
||||||
|
test(convertPackToQuerySuiteEntryMacro, "a/b:my/path/suite.qls", {
|
||||||
|
qlpack: undefined,
|
||||||
|
from: "a/b",
|
||||||
|
version: undefined,
|
||||||
|
query: undefined,
|
||||||
|
queries: undefined,
|
||||||
|
apply: "my/path/suite.qls",
|
||||||
|
});
|
||||||
|
|
||||||
|
test(convertPackToQuerySuiteEntryMacro, "a/b@~1.2.3:my/path/suite.qls", {
|
||||||
|
qlpack: undefined,
|
||||||
|
from: "a/b",
|
||||||
|
version: "~1.2.3",
|
||||||
|
query: undefined,
|
||||||
|
queries: undefined,
|
||||||
|
apply: "my/path/suite.qls",
|
||||||
|
});
|
||||||
|
|
||||||
|
test("convertPackToQuerySuiteEntry Failure", (t) => {
|
||||||
|
t.throws(() => convertPackToQuerySuiteEntry("this-is-not-a-pack"));
|
||||||
|
});
|
||||||
|
|
||||||
|
test("createQuerySuiteContents", (t) => {
|
||||||
|
const yamlResult = createQuerySuiteContents(
|
||||||
|
["query1.ql", "query2.ql"],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
exclude: { "problem.severity": "recommendation" },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
include: { "problem.severity": "recommendation" },
|
||||||
|
},
|
||||||
|
]
|
||||||
|
);
|
||||||
|
const expected = `- query: query1.ql
|
||||||
|
- query: query2.ql
|
||||||
|
- exclude:
|
||||||
|
problem.severity: recommendation
|
||||||
|
- include:
|
||||||
|
problem.severity: recommendation
|
||||||
|
`;
|
||||||
|
|
||||||
|
t.deepEqual(yamlResult, expected);
|
||||||
|
});
|
||||||
|
|
||||||
const stubConfig: Config = {
|
const stubConfig: Config = {
|
||||||
languages: [Language.cpp, Language.go],
|
languages: [Language.cpp, Language.go],
|
||||||
queries: {},
|
queries: {},
|
||||||
|
|
|
||||||
112
src/analyze.ts
112
src/analyze.ts
|
|
@ -223,6 +223,9 @@ export async function runQueries(
|
||||||
|
|
||||||
for (const language of config.languages) {
|
for (const language of config.languages) {
|
||||||
const queries = config.queries[language];
|
const queries = config.queries[language];
|
||||||
|
const queryFilters = validateQueryFilters(
|
||||||
|
config.originalUserInput["query-filters"]
|
||||||
|
);
|
||||||
const packsWithVersion = config.packs[language] || [];
|
const packsWithVersion = config.packs[language] || [];
|
||||||
|
|
||||||
const hasBuiltinQueries = queries?.builtin.length > 0;
|
const hasBuiltinQueries = queries?.builtin.length > 0;
|
||||||
|
|
@ -260,7 +263,7 @@ export async function runQueries(
|
||||||
await runQueryGroup(
|
await runQueryGroup(
|
||||||
language,
|
language,
|
||||||
"builtin",
|
"builtin",
|
||||||
createQuerySuiteContents(queries["builtin"]),
|
createQuerySuiteContents(queries["builtin"], queryFilters),
|
||||||
undefined
|
undefined
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
@ -275,7 +278,10 @@ export async function runQueries(
|
||||||
await runQueryGroup(
|
await runQueryGroup(
|
||||||
language,
|
language,
|
||||||
`custom-${i}`,
|
`custom-${i}`,
|
||||||
createQuerySuiteContents(queries["custom"][i].queries),
|
createQuerySuiteContents(
|
||||||
|
queries["custom"][i].queries,
|
||||||
|
queryFilters
|
||||||
|
),
|
||||||
queries["custom"][i].searchPath
|
queries["custom"][i].searchPath
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
@ -284,12 +290,7 @@ export async function runQueries(
|
||||||
}
|
}
|
||||||
if (packsWithVersion.length > 0) {
|
if (packsWithVersion.length > 0) {
|
||||||
querySuitePaths.push(
|
querySuitePaths.push(
|
||||||
...(await runQueryPacks(
|
await runQueryPacks(language, "packs", packsWithVersion, queryFilters)
|
||||||
language,
|
|
||||||
"packs",
|
|
||||||
packsWithVersion,
|
|
||||||
undefined
|
|
||||||
))
|
|
||||||
);
|
);
|
||||||
ranCustom = true;
|
ranCustom = true;
|
||||||
}
|
}
|
||||||
|
|
@ -394,32 +395,61 @@ export async function runQueries(
|
||||||
language: Language,
|
language: Language,
|
||||||
type: string,
|
type: string,
|
||||||
packs: string[],
|
packs: string[],
|
||||||
searchPath: string | undefined
|
queryFilters: configUtils.QueryFilter[]
|
||||||
): Promise<string[]> {
|
): Promise<string> {
|
||||||
const databasePath = util.getCodeQLDatabasePath(config, language);
|
const databasePath = util.getCodeQLDatabasePath(config, language);
|
||||||
// Run the queries individually instead of all at once to avoid command
|
|
||||||
// line length restrictions, particularly on windows.
|
|
||||||
|
|
||||||
for (const pack of packs) {
|
for (const pack of packs) {
|
||||||
logger.debug(`Running query pack for ${language}-${type}: ${pack}`);
|
logger.debug(`Running query pack for ${language}-${type}: ${pack}`);
|
||||||
|
|
||||||
const codeql = await getCodeQL(config.codeQLCmd);
|
|
||||||
await codeql.databaseRunQueries(
|
|
||||||
databasePath,
|
|
||||||
searchPath,
|
|
||||||
pack,
|
|
||||||
memoryFlag,
|
|
||||||
threadsFlag
|
|
||||||
);
|
|
||||||
|
|
||||||
logger.debug(`BQRS results produced for ${language} (queries: ${type})"`);
|
|
||||||
}
|
}
|
||||||
return packs;
|
|
||||||
|
// combine the list of packs into a query suite in order to run them all simultaneously.
|
||||||
|
const querySuite = (
|
||||||
|
packs.map(convertPackToQuerySuiteEntry) as configUtils.QuerySuiteEntry[]
|
||||||
|
).concat(queryFilters);
|
||||||
|
|
||||||
|
const querySuitePath = `${databasePath}-queries-${type}.qls`;
|
||||||
|
fs.writeFileSync(querySuitePath, yaml.dump(querySuite));
|
||||||
|
|
||||||
|
logger.debug(`BQRS results produced for ${language} (queries: ${type})"`);
|
||||||
|
|
||||||
|
const codeql = await getCodeQL(config.codeQLCmd);
|
||||||
|
await codeql.databaseRunQueries(
|
||||||
|
databasePath,
|
||||||
|
undefined,
|
||||||
|
querySuitePath,
|
||||||
|
memoryFlag,
|
||||||
|
threadsFlag
|
||||||
|
);
|
||||||
|
|
||||||
|
return querySuitePath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function createQuerySuiteContents(queries: string[]) {
|
export function convertPackToQuerySuiteEntry(
|
||||||
return queries.map((q: string) => `- query: ${q}`).join("\n");
|
packStr: string
|
||||||
|
): configUtils.QuerySuitePackEntry {
|
||||||
|
const pack = configUtils.parsePacksSpecification(packStr);
|
||||||
|
return {
|
||||||
|
qlpack: !pack.path ? pack.name : undefined,
|
||||||
|
from: pack.path ? pack.name : undefined,
|
||||||
|
version: pack.version,
|
||||||
|
query: pack.path?.endsWith(".ql") ? pack.path : undefined,
|
||||||
|
queries:
|
||||||
|
!pack.path?.endsWith(".ql") && !pack.path?.endsWith(".qls")
|
||||||
|
? pack.path
|
||||||
|
: undefined,
|
||||||
|
apply: pack.path?.endsWith(".qls") ? pack.path : undefined,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function createQuerySuiteContents(
|
||||||
|
queries: string[],
|
||||||
|
queryFilters: configUtils.QueryFilter[]
|
||||||
|
) {
|
||||||
|
return yaml.dump(
|
||||||
|
queries.map((q: string) => ({ query: q })).concat(queryFilters as any)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function runFinalize(
|
export async function runFinalize(
|
||||||
|
|
@ -519,3 +549,33 @@ function printLinesOfCodeSummary(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// exported for testing
|
||||||
|
export function validateQueryFilters(queryFilters?: configUtils.QueryFilter[]) {
|
||||||
|
if (!queryFilters) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
const errors: string[] = [];
|
||||||
|
for (const qf of queryFilters) {
|
||||||
|
const keys = Object.keys(qf);
|
||||||
|
if (keys.length !== 1) {
|
||||||
|
errors.push(
|
||||||
|
`Query filter must have exactly one key: ${JSON.stringify(qf)}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (!["exclude", "include"].includes(keys[0])) {
|
||||||
|
errors.push(
|
||||||
|
`Only "include" or "exclude" filters are allowed:\n${JSON.stringify(
|
||||||
|
qf
|
||||||
|
)}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (errors.length) {
|
||||||
|
throw new Error(`Invalid query filter.\n${errors.join("\n")}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return queryFilters;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -87,6 +87,23 @@ test("Get the client API with github url", async (t) => {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("Get the API with an API URL directly", async (t) => {
|
||||||
|
doTest(
|
||||||
|
t,
|
||||||
|
{
|
||||||
|
auth: "xyz",
|
||||||
|
url: "http://github.localhost",
|
||||||
|
apiURL: "http://api.github.localhost",
|
||||||
|
},
|
||||||
|
undefined,
|
||||||
|
{
|
||||||
|
auth: "token xyz",
|
||||||
|
baseUrl: "http://api.github.localhost",
|
||||||
|
userAgent: `CodeQL-Action/${pkg.version}`,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
function doTest(
|
function doTest(
|
||||||
t: ExecutionContext<unknown>,
|
t: ExecutionContext<unknown>,
|
||||||
clientArgs: any,
|
clientArgs: any,
|
||||||
|
|
|
||||||
|
|
@ -22,11 +22,13 @@ export type GitHubApiCombinedDetails = GitHubApiDetails &
|
||||||
export interface GitHubApiDetails {
|
export interface GitHubApiDetails {
|
||||||
auth: string;
|
auth: string;
|
||||||
url: string;
|
url: string;
|
||||||
|
apiURL: string | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GitHubApiExternalRepoDetails {
|
export interface GitHubApiExternalRepoDetails {
|
||||||
externalRepoAuth?: string;
|
externalRepoAuth?: string;
|
||||||
url: string;
|
url: string;
|
||||||
|
apiURL: string | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getApiClient = function (
|
export const getApiClient = function (
|
||||||
|
|
@ -36,16 +38,18 @@ export const getApiClient = function (
|
||||||
const auth =
|
const auth =
|
||||||
(allowExternal && apiDetails.externalRepoAuth) || apiDetails.auth;
|
(allowExternal && apiDetails.externalRepoAuth) || apiDetails.auth;
|
||||||
const retryingOctokit = githubUtils.GitHub.plugin(retry.retry);
|
const retryingOctokit = githubUtils.GitHub.plugin(retry.retry);
|
||||||
|
const apiURL = apiDetails.apiURL || deriveApiUrl(apiDetails.url);
|
||||||
return new retryingOctokit(
|
return new retryingOctokit(
|
||||||
githubUtils.getOctokitOptions(auth, {
|
githubUtils.getOctokitOptions(auth, {
|
||||||
baseUrl: getApiUrl(apiDetails.url),
|
baseUrl: apiURL,
|
||||||
userAgent: `CodeQL-${getMode()}/${pkg.version}`,
|
userAgent: `CodeQL-${getMode()}/${pkg.version}`,
|
||||||
log: consoleLogLevel({ level: "debug" }),
|
log: consoleLogLevel({ level: "debug" }),
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
function getApiUrl(githubUrl: string): string {
|
// Once the runner is deleted, this can also be removed since the GitHub API URL is always available in an environment variable on Actions.
|
||||||
|
function deriveApiUrl(githubUrl: string): string {
|
||||||
const url = new URL(githubUrl);
|
const url = new URL(githubUrl);
|
||||||
|
|
||||||
// If we detect this is trying to connect to github.com
|
// If we detect this is trying to connect to github.com
|
||||||
|
|
@ -63,6 +67,7 @@ function getApiDetails() {
|
||||||
return {
|
return {
|
||||||
auth: getRequiredInput("token"),
|
auth: getRequiredInput("token"),
|
||||||
url: getRequiredEnvParam("GITHUB_SERVER_URL"),
|
url: getRequiredEnvParam("GITHUB_SERVER_URL"),
|
||||||
|
apiURL: getRequiredEnvParam("GITHUB_API_URL"),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,11 +21,13 @@ setupTests(test);
|
||||||
const sampleApiDetails = {
|
const sampleApiDetails = {
|
||||||
auth: "token",
|
auth: "token",
|
||||||
url: "https://github.com",
|
url: "https://github.com",
|
||||||
|
apiURL: undefined,
|
||||||
};
|
};
|
||||||
|
|
||||||
const sampleGHAEApiDetails = {
|
const sampleGHAEApiDetails = {
|
||||||
auth: "token",
|
auth: "token",
|
||||||
url: "https://example.githubenterprise.com",
|
url: "https://example.githubenterprise.com",
|
||||||
|
apiURL: undefined,
|
||||||
};
|
};
|
||||||
|
|
||||||
test.beforeEach(() => {
|
test.beforeEach(() => {
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ const sampleApiDetails = {
|
||||||
auth: "token",
|
auth: "token",
|
||||||
externalRepoAuth: "token",
|
externalRepoAuth: "token",
|
||||||
url: "https://github.example.com",
|
url: "https://github.example.com",
|
||||||
|
apiURL: undefined,
|
||||||
};
|
};
|
||||||
|
|
||||||
const gitHubVersion = { type: util.GitHubVariant.DOTCOM } as util.GitHubVersion;
|
const gitHubVersion = { type: util.GitHubVariant.DOTCOM } as util.GitHubVersion;
|
||||||
|
|
@ -1607,6 +1608,60 @@ test(invalidPackNameMacro, "c/d@../a");
|
||||||
test(invalidPackNameMacro, "c/d@b/../a");
|
test(invalidPackNameMacro, "c/d@b/../a");
|
||||||
test(invalidPackNameMacro, "c/d:z@1");
|
test(invalidPackNameMacro, "c/d:z@1");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test macro for pretty printing pack specs
|
||||||
|
*/
|
||||||
|
const packSpecPrettyPrintingMacro = test.macro({
|
||||||
|
exec: (t: ExecutionContext, packStr: string, packObj: configUtils.Pack) => {
|
||||||
|
const parsed = configUtils.parsePacksSpecification(packStr);
|
||||||
|
t.deepEqual(parsed, packObj, "parsed pack spec is correct");
|
||||||
|
const stringified = configUtils.prettyPrintPack(packObj);
|
||||||
|
t.deepEqual(
|
||||||
|
stringified,
|
||||||
|
packStr.trim(),
|
||||||
|
"pretty-printed pack spec is correct"
|
||||||
|
);
|
||||||
|
|
||||||
|
t.deepEqual(
|
||||||
|
configUtils.validatePackSpecification(packStr),
|
||||||
|
packStr.trim(),
|
||||||
|
"pack spec is valid"
|
||||||
|
);
|
||||||
|
},
|
||||||
|
title: (
|
||||||
|
_providedTitle: string | undefined,
|
||||||
|
packStr: string,
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
_packObj: configUtils.Pack
|
||||||
|
) => `Prettyprint pack spec: '${packStr}'`,
|
||||||
|
});
|
||||||
|
|
||||||
|
test(packSpecPrettyPrintingMacro, "a/b", {
|
||||||
|
name: "a/b",
|
||||||
|
version: undefined,
|
||||||
|
path: undefined,
|
||||||
|
});
|
||||||
|
test(packSpecPrettyPrintingMacro, "a/b@~1.2.3", {
|
||||||
|
name: "a/b",
|
||||||
|
version: "~1.2.3",
|
||||||
|
path: undefined,
|
||||||
|
});
|
||||||
|
test(packSpecPrettyPrintingMacro, "a/b@~1.2.3:abc/def", {
|
||||||
|
name: "a/b",
|
||||||
|
version: "~1.2.3",
|
||||||
|
path: "abc/def",
|
||||||
|
});
|
||||||
|
test(packSpecPrettyPrintingMacro, "a/b:abc/def", {
|
||||||
|
name: "a/b",
|
||||||
|
version: undefined,
|
||||||
|
path: "abc/def",
|
||||||
|
});
|
||||||
|
test(packSpecPrettyPrintingMacro, " a/b:abc/def ", {
|
||||||
|
name: "a/b",
|
||||||
|
version: undefined,
|
||||||
|
path: "abc/def",
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test macro for testing the packs block and the packs input
|
* Test macro for testing the packs block and the packs input
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -50,8 +50,38 @@ export interface UserConfig {
|
||||||
// language. If this is a single language analysis, then no split by
|
// language. If this is a single language analysis, then no split by
|
||||||
// language is necessary.
|
// language is necessary.
|
||||||
packs?: Record<string, string[]> | string[];
|
packs?: Record<string, string[]> | string[];
|
||||||
|
|
||||||
|
// Set of query filters to include and exclude extra queries based on
|
||||||
|
// codeql query suite `include` and `exclude` properties
|
||||||
|
"query-filters"?: QueryFilter[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type QueryFilter = ExcludeQueryFilter | IncludeQueryFilter;
|
||||||
|
|
||||||
|
interface ExcludeQueryFilter {
|
||||||
|
exclude: Record<string, string[] | string>;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IncludeQueryFilter {
|
||||||
|
include: Record<string, string[] | string>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type QuerySuitePackEntry = {
|
||||||
|
version?: string;
|
||||||
|
} & (
|
||||||
|
| {
|
||||||
|
qlpack: string;
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
from?: string;
|
||||||
|
query?: string;
|
||||||
|
queries?: string;
|
||||||
|
apply?: string;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
export type QuerySuiteEntry = QuerySuitePackEntry | QueryFilter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lists of query files for each language.
|
* Lists of query files for each language.
|
||||||
* Will only contain .ql files and not other kinds of files,
|
* Will only contain .ql files and not other kinds of files,
|
||||||
|
|
@ -158,6 +188,12 @@ export interface Config {
|
||||||
|
|
||||||
export type Packs = Partial<Record<Language, string[]>>;
|
export type Packs = Partial<Record<Language, string[]>>;
|
||||||
|
|
||||||
|
export interface Pack {
|
||||||
|
name: string;
|
||||||
|
version?: string;
|
||||||
|
path?: string;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A list of queries from https://github.com/github/codeql that
|
* A list of queries from https://github.com/github/codeql that
|
||||||
* we don't want to run. Disabling them here is a quicker alternative to
|
* we don't want to run. Disabling them here is a quicker alternative to
|
||||||
|
|
@ -320,11 +356,7 @@ async function addBuiltinSuiteQueries(
|
||||||
}
|
}
|
||||||
|
|
||||||
function isMlPoweredJsQueriesPack(pack: string) {
|
function isMlPoweredJsQueriesPack(pack: string) {
|
||||||
return (
|
return parsePacksSpecification(pack).name === ML_POWERED_JS_QUERIES_PACK_NAME;
|
||||||
pack === ML_POWERED_JS_QUERIES_PACK_NAME ||
|
|
||||||
pack.startsWith(`${ML_POWERED_JS_QUERIES_PACK_NAME}@`) ||
|
|
||||||
pack.startsWith(`${ML_POWERED_JS_QUERIES_PACK_NAME}:`)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -1183,10 +1215,10 @@ export function parsePacksFromConfig(
|
||||||
throw new Error(getPacksRequireLanguage(configFile, lang));
|
throw new Error(getPacksRequireLanguage(configFile, lang));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
packs[lang] = [];
|
|
||||||
for (const packStr of packsArr) {
|
packs[lang] = packsArr.map((packStr) =>
|
||||||
packs[lang].push(validatePacksSpecification(packStr, configFile));
|
validatePackSpecification(packStr, configFile)
|
||||||
}
|
);
|
||||||
}
|
}
|
||||||
return packs;
|
return packs;
|
||||||
}
|
}
|
||||||
|
|
@ -1219,7 +1251,7 @@ function parsePacksFromInput(
|
||||||
|
|
||||||
return {
|
return {
|
||||||
[languages[0]]: packsInput.split(",").reduce((packs, pack) => {
|
[languages[0]]: packsInput.split(",").reduce((packs, pack) => {
|
||||||
packs.push(validatePacksSpecification(pack, ""));
|
packs.push(validatePackSpecification(pack));
|
||||||
return packs;
|
return packs;
|
||||||
}, [] as string[]),
|
}, [] as string[]),
|
||||||
};
|
};
|
||||||
|
|
@ -1243,10 +1275,10 @@ function parsePacksFromInput(
|
||||||
* @param packStr the package specification to verify.
|
* @param packStr the package specification to verify.
|
||||||
* @param configFile Config file to use for error reporting
|
* @param configFile Config file to use for error reporting
|
||||||
*/
|
*/
|
||||||
export function validatePacksSpecification(
|
export function parsePacksSpecification(
|
||||||
packStr: string,
|
packStr: string,
|
||||||
configFile?: string
|
configFile?: string
|
||||||
): string {
|
): Pack {
|
||||||
if (typeof packStr !== "string") {
|
if (typeof packStr !== "string") {
|
||||||
throw new Error(getPacksStrInvalid(packStr, configFile));
|
throw new Error(getPacksStrInvalid(packStr, configFile));
|
||||||
}
|
}
|
||||||
|
|
@ -1305,9 +1337,21 @@ export function validatePacksSpecification(
|
||||||
throw new Error(getPacksStrInvalid(packStr, configFile));
|
throw new Error(getPacksStrInvalid(packStr, configFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return {
|
||||||
packName + (version ? `@${version}` : "") + (packPath ? `:${packPath}` : "")
|
name: packName,
|
||||||
);
|
version,
|
||||||
|
path: packPath,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function prettyPrintPack(pack: Pack) {
|
||||||
|
return `${pack.name}${pack.version ? `@${pack.version}` : ""}${
|
||||||
|
pack.path ? `:${pack.path}` : ""
|
||||||
|
}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function validatePackSpecification(pack: string, configFile?: string) {
|
||||||
|
return prettyPrintPack(parsePacksSpecification(pack, configFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
// exported for testing
|
// exported for testing
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ const testRepoName: RepositoryNwo = { owner: "github", repo: "example" };
|
||||||
const testApiDetails: GitHubApiDetails = {
|
const testApiDetails: GitHubApiDetails = {
|
||||||
auth: "1234",
|
auth: "1234",
|
||||||
url: "https://github.com",
|
url: "https://github.com",
|
||||||
|
apiURL: undefined,
|
||||||
};
|
};
|
||||||
|
|
||||||
function getTestConfig(tmpDir: string): Config {
|
function getTestConfig(tmpDir: string): Config {
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,11 @@ test("checkoutExternalQueries", async (t) => {
|
||||||
await externalQueries.checkoutExternalRepository(
|
await externalQueries.checkoutExternalRepository(
|
||||||
repoName,
|
repoName,
|
||||||
commit1Sha,
|
commit1Sha,
|
||||||
{ url: `file://${testRepoBaseDir}`, externalRepoAuth: "" },
|
{
|
||||||
|
url: `file://${testRepoBaseDir}`,
|
||||||
|
externalRepoAuth: "",
|
||||||
|
apiURL: undefined,
|
||||||
|
},
|
||||||
tmpDir,
|
tmpDir,
|
||||||
getRunnerLogger(true)
|
getRunnerLogger(true)
|
||||||
);
|
);
|
||||||
|
|
@ -99,7 +103,11 @@ test("checkoutExternalQueries", async (t) => {
|
||||||
await externalQueries.checkoutExternalRepository(
|
await externalQueries.checkoutExternalRepository(
|
||||||
repoName,
|
repoName,
|
||||||
commit2Sha,
|
commit2Sha,
|
||||||
{ url: `file://${testRepoBaseDir}`, externalRepoAuth: "" },
|
{
|
||||||
|
url: `file://${testRepoBaseDir}`,
|
||||||
|
externalRepoAuth: "",
|
||||||
|
apiURL: undefined,
|
||||||
|
},
|
||||||
tmpDir,
|
tmpDir,
|
||||||
getRunnerLogger(true)
|
getRunnerLogger(true)
|
||||||
);
|
);
|
||||||
|
|
@ -114,6 +122,7 @@ test("buildCheckoutURL", (t) => {
|
||||||
externalQueries.buildCheckoutURL("foo/bar", {
|
externalQueries.buildCheckoutURL("foo/bar", {
|
||||||
url: "https://github.com",
|
url: "https://github.com",
|
||||||
externalRepoAuth: undefined,
|
externalRepoAuth: undefined,
|
||||||
|
apiURL: undefined,
|
||||||
}),
|
}),
|
||||||
"https://github.com/foo/bar"
|
"https://github.com/foo/bar"
|
||||||
);
|
);
|
||||||
|
|
@ -121,6 +130,7 @@ test("buildCheckoutURL", (t) => {
|
||||||
externalQueries.buildCheckoutURL("foo/bar", {
|
externalQueries.buildCheckoutURL("foo/bar", {
|
||||||
url: "https://github.example.com/",
|
url: "https://github.example.com/",
|
||||||
externalRepoAuth: undefined,
|
externalRepoAuth: undefined,
|
||||||
|
apiURL: undefined,
|
||||||
}),
|
}),
|
||||||
"https://github.example.com/foo/bar"
|
"https://github.example.com/foo/bar"
|
||||||
);
|
);
|
||||||
|
|
@ -129,6 +139,7 @@ test("buildCheckoutURL", (t) => {
|
||||||
externalQueries.buildCheckoutURL("foo/bar", {
|
externalQueries.buildCheckoutURL("foo/bar", {
|
||||||
url: "https://github.com",
|
url: "https://github.com",
|
||||||
externalRepoAuth: "abc",
|
externalRepoAuth: "abc",
|
||||||
|
apiURL: undefined,
|
||||||
}),
|
}),
|
||||||
"https://x-access-token:abc@github.com/foo/bar"
|
"https://x-access-token:abc@github.com/foo/bar"
|
||||||
);
|
);
|
||||||
|
|
@ -136,6 +147,7 @@ test("buildCheckoutURL", (t) => {
|
||||||
externalQueries.buildCheckoutURL("foo/bar", {
|
externalQueries.buildCheckoutURL("foo/bar", {
|
||||||
url: "https://github.example.com/",
|
url: "https://github.example.com/",
|
||||||
externalRepoAuth: "abc",
|
externalRepoAuth: "abc",
|
||||||
|
apiURL: undefined,
|
||||||
}),
|
}),
|
||||||
"https://x-access-token:abc@github.example.com/foo/bar"
|
"https://x-access-token:abc@github.example.com/foo/bar"
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ test.beforeEach(() => {
|
||||||
const testApiDetails: GitHubApiDetails = {
|
const testApiDetails: GitHubApiDetails = {
|
||||||
auth: "1234",
|
auth: "1234",
|
||||||
url: "https://github.com",
|
url: "https://github.com",
|
||||||
|
apiURL: undefined,
|
||||||
};
|
};
|
||||||
|
|
||||||
const testRepositoryNwo = parseRepositoryNwo("github/example");
|
const testRepositoryNwo = parseRepositoryNwo("github/example");
|
||||||
|
|
|
||||||
|
|
@ -134,6 +134,7 @@ async function run() {
|
||||||
auth: getRequiredInput("token"),
|
auth: getRequiredInput("token"),
|
||||||
externalRepoAuth: getOptionalInput("external-repository-token"),
|
externalRepoAuth: getOptionalInput("external-repository-token"),
|
||||||
url: getRequiredEnvParam("GITHUB_SERVER_URL"),
|
url: getRequiredEnvParam("GITHUB_SERVER_URL"),
|
||||||
|
apiURL: getRequiredEnvParam("GITHUB_API_URL"),
|
||||||
};
|
};
|
||||||
|
|
||||||
const gitHubVersion = await getGitHubVersionActionsOnly();
|
const gitHubVersion = await getGitHubVersionActionsOnly();
|
||||||
|
|
|
||||||
|
|
@ -202,6 +202,7 @@ program
|
||||||
auth,
|
auth,
|
||||||
externalRepoAuth: auth,
|
externalRepoAuth: auth,
|
||||||
url: parseGitHubUrl(cmd.githubUrl),
|
url: parseGitHubUrl(cmd.githubUrl),
|
||||||
|
apiURL: undefined,
|
||||||
};
|
};
|
||||||
|
|
||||||
const gitHubVersion = await getGitHubVersion(apiDetails);
|
const gitHubVersion = await getGitHubVersion(apiDetails);
|
||||||
|
|
@ -475,6 +476,7 @@ program
|
||||||
const apiDetails = {
|
const apiDetails = {
|
||||||
auth,
|
auth,
|
||||||
url: parseGitHubUrl(cmd.githubUrl),
|
url: parseGitHubUrl(cmd.githubUrl),
|
||||||
|
apiURL: undefined,
|
||||||
};
|
};
|
||||||
|
|
||||||
const outputDir =
|
const outputDir =
|
||||||
|
|
@ -587,6 +589,7 @@ program
|
||||||
const apiDetails = {
|
const apiDetails = {
|
||||||
auth,
|
auth,
|
||||||
url: parseGitHubUrl(cmd.githubUrl),
|
url: parseGitHubUrl(cmd.githubUrl),
|
||||||
|
apiURL: undefined,
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
const gitHubVersion = await getGitHubVersion(apiDetails);
|
const gitHubVersion = await getGitHubVersion(apiDetails);
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,7 @@ async function run() {
|
||||||
const apiDetails = {
|
const apiDetails = {
|
||||||
auth: actionsUtil.getRequiredInput("token"),
|
auth: actionsUtil.getRequiredInput("token"),
|
||||||
url: getRequiredEnvParam("GITHUB_SERVER_URL"),
|
url: getRequiredEnvParam("GITHUB_SERVER_URL"),
|
||||||
|
apiURL: getRequiredEnvParam("GITHUB_API_URL"),
|
||||||
};
|
};
|
||||||
|
|
||||||
const gitHubVersion = await getGitHubVersionActionsOnly();
|
const gitHubVersion = await getGitHubVersionActionsOnly();
|
||||||
|
|
|
||||||
|
|
@ -208,6 +208,7 @@ test("getGitHubVersion", async (t) => {
|
||||||
const v = await util.getGitHubVersion({
|
const v = await util.getGitHubVersion({
|
||||||
auth: "",
|
auth: "",
|
||||||
url: "https://github.com",
|
url: "https://github.com",
|
||||||
|
apiURL: undefined,
|
||||||
});
|
});
|
||||||
t.deepEqual(util.GitHubVariant.DOTCOM, v.type);
|
t.deepEqual(util.GitHubVariant.DOTCOM, v.type);
|
||||||
|
|
||||||
|
|
@ -215,6 +216,7 @@ test("getGitHubVersion", async (t) => {
|
||||||
const v2 = await util.getGitHubVersion({
|
const v2 = await util.getGitHubVersion({
|
||||||
auth: "",
|
auth: "",
|
||||||
url: "https://ghe.example.com",
|
url: "https://ghe.example.com",
|
||||||
|
apiURL: undefined,
|
||||||
});
|
});
|
||||||
t.deepEqual(
|
t.deepEqual(
|
||||||
{ type: util.GitHubVariant.GHES, version: "2.0" } as util.GitHubVersion,
|
{ type: util.GitHubVariant.GHES, version: "2.0" } as util.GitHubVersion,
|
||||||
|
|
@ -225,6 +227,7 @@ test("getGitHubVersion", async (t) => {
|
||||||
const ghae = await util.getGitHubVersion({
|
const ghae = await util.getGitHubVersion({
|
||||||
auth: "",
|
auth: "",
|
||||||
url: "https://example.githubenterprise.com",
|
url: "https://example.githubenterprise.com",
|
||||||
|
apiURL: undefined,
|
||||||
});
|
});
|
||||||
t.deepEqual({ type: util.GitHubVariant.GHAE }, ghae);
|
t.deepEqual({ type: util.GitHubVariant.GHAE }, ghae);
|
||||||
|
|
||||||
|
|
@ -232,6 +235,7 @@ test("getGitHubVersion", async (t) => {
|
||||||
const v3 = await util.getGitHubVersion({
|
const v3 = await util.getGitHubVersion({
|
||||||
auth: "",
|
auth: "",
|
||||||
url: "https://ghe.example.com",
|
url: "https://ghe.example.com",
|
||||||
|
apiURL: undefined,
|
||||||
});
|
});
|
||||||
t.deepEqual({ type: util.GitHubVariant.DOTCOM }, v3);
|
t.deepEqual({ type: util.GitHubVariant.DOTCOM }, v3);
|
||||||
});
|
});
|
||||||
|
|
@ -299,13 +303,13 @@ const ML_POWERED_JS_STATUS_TESTS: Array<[string[], string]> = [
|
||||||
// If no packs are loaded, status is false.
|
// If no packs are loaded, status is false.
|
||||||
[[], "false"],
|
[[], "false"],
|
||||||
// If another pack is loaded but not the ML-powered query pack, status is false.
|
// If another pack is loaded but not the ML-powered query pack, status is false.
|
||||||
[["someOtherPack"], "false"],
|
[["some-other/pack"], "false"],
|
||||||
// If the ML-powered query pack is loaded with a specific version, status is that version.
|
// If the ML-powered query pack is loaded with a specific version, status is that version.
|
||||||
[[`${util.ML_POWERED_JS_QUERIES_PACK_NAME}@~0.1.0`], "~0.1.0"],
|
[[`${util.ML_POWERED_JS_QUERIES_PACK_NAME}@~0.1.0`], "~0.1.0"],
|
||||||
// If the ML-powered query pack is loaded with a specific version and another pack is loaded, the
|
// If the ML-powered query pack is loaded with a specific version and another pack is loaded, the
|
||||||
// status is the version of the ML-powered query pack.
|
// status is the version of the ML-powered query pack.
|
||||||
[
|
[
|
||||||
["someOtherPack", `${util.ML_POWERED_JS_QUERIES_PACK_NAME}@~0.1.0`],
|
["some-other/pack", `${util.ML_POWERED_JS_QUERIES_PACK_NAME}@~0.1.0`],
|
||||||
"~0.1.0",
|
"~0.1.0",
|
||||||
],
|
],
|
||||||
// If the ML-powered query pack is loaded without a version, the status is "latest".
|
// If the ML-powered query pack is loaded without a version, the status is "latest".
|
||||||
|
|
@ -320,7 +324,7 @@ const ML_POWERED_JS_STATUS_TESTS: Array<[string[], string]> = [
|
||||||
],
|
],
|
||||||
// If the ML-powered query pack is loaded with no specific version, and another pack is loaded,
|
// If the ML-powered query pack is loaded with no specific version, and another pack is loaded,
|
||||||
// the status is "latest".
|
// the status is "latest".
|
||||||
[["someOtherPack", util.ML_POWERED_JS_QUERIES_PACK_NAME], "latest"],
|
[["some-other/pack", util.ML_POWERED_JS_QUERIES_PACK_NAME], "latest"],
|
||||||
];
|
];
|
||||||
|
|
||||||
for (const [packs, expectedStatus] of ML_POWERED_JS_STATUS_TESTS) {
|
for (const [packs, expectedStatus] of ML_POWERED_JS_STATUS_TESTS) {
|
||||||
|
|
|
||||||
20
src/util.ts
20
src/util.ts
|
|
@ -11,7 +11,11 @@ import * as api from "./api-client";
|
||||||
import { getApiClient, GitHubApiDetails } from "./api-client";
|
import { getApiClient, GitHubApiDetails } from "./api-client";
|
||||||
import * as apiCompatibility from "./api-compatibility.json";
|
import * as apiCompatibility from "./api-compatibility.json";
|
||||||
import { CodeQL, CODEQL_VERSION_NEW_TRACING } from "./codeql";
|
import { CodeQL, CODEQL_VERSION_NEW_TRACING } from "./codeql";
|
||||||
import { Config } from "./config-utils";
|
import {
|
||||||
|
Config,
|
||||||
|
parsePacksSpecification,
|
||||||
|
prettyPrintPack,
|
||||||
|
} from "./config-utils";
|
||||||
import { Language } from "./languages";
|
import { Language } from "./languages";
|
||||||
import { Logger } from "./logging";
|
import { Logger } from "./logging";
|
||||||
|
|
||||||
|
|
@ -668,7 +672,10 @@ export async function getMlPoweredJsQueriesPack(
|
||||||
} else {
|
} else {
|
||||||
version = `~0.1.0`;
|
version = `~0.1.0`;
|
||||||
}
|
}
|
||||||
return `${ML_POWERED_JS_QUERIES_PACK_NAME}@${version}`;
|
return prettyPrintPack({
|
||||||
|
name: ML_POWERED_JS_QUERIES_PACK_NAME,
|
||||||
|
version,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -694,11 +701,10 @@ export async function getMlPoweredJsQueriesPack(
|
||||||
*/
|
*/
|
||||||
export function getMlPoweredJsQueriesStatus(config: Config): string {
|
export function getMlPoweredJsQueriesStatus(config: Config): string {
|
||||||
const mlPoweredJsQueryPacks = (config.packs.javascript || [])
|
const mlPoweredJsQueryPacks = (config.packs.javascript || [])
|
||||||
.map((pack) => pack.split("@"))
|
.map((p) => parsePacksSpecification(p))
|
||||||
.filter(
|
.filter(
|
||||||
(packNameVersion) =>
|
(pack) =>
|
||||||
packNameVersion[0] === "codeql/javascript-experimental-atm-queries" &&
|
pack.name === "codeql/javascript-experimental-atm-queries" && !pack.path
|
||||||
packNameVersion.length <= 2
|
|
||||||
);
|
);
|
||||||
switch (mlPoweredJsQueryPacks.length) {
|
switch (mlPoweredJsQueryPacks.length) {
|
||||||
case 1:
|
case 1:
|
||||||
|
|
@ -707,7 +713,7 @@ export function getMlPoweredJsQueriesStatus(config: Config): string {
|
||||||
// with each version of the CodeQL Action. Therefore in practice we should only hit the
|
// with each version of the CodeQL Action. Therefore in practice we should only hit the
|
||||||
// `latest` case here when customers have explicitly added the ML-powered query pack to their
|
// `latest` case here when customers have explicitly added the ML-powered query pack to their
|
||||||
// CodeQL config.
|
// CodeQL config.
|
||||||
return mlPoweredJsQueryPacks[0][1] || "latest";
|
return mlPoweredJsQueryPacks[0].version || "latest";
|
||||||
case 0:
|
case 0:
|
||||||
return "false";
|
return "false";
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
10
tests/multi-language-repo/.github/codeql/codeql-config-query-filters1.yml
vendored
Normal file
10
tests/multi-language-repo/.github/codeql/codeql-config-query-filters1.yml
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
name: "Check SARIF for default queries with Single include, Single exclude"
|
||||||
|
|
||||||
|
query-filters:
|
||||||
|
# This should run js/path-injection and js/zipslip
|
||||||
|
- include:
|
||||||
|
tags contain: external/cwe/cwe-022
|
||||||
|
|
||||||
|
# Removes js/path-injection
|
||||||
|
- exclude:
|
||||||
|
id: js/path-injection
|
||||||
21
tests/multi-language-repo/.github/codeql/codeql-config-query-filters2.yml
vendored
Normal file
21
tests/multi-language-repo/.github/codeql/codeql-config-query-filters2.yml
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
name: "Check SARIF for query packs with Single include, Single exclude"
|
||||||
|
|
||||||
|
disable-default-queries: true
|
||||||
|
|
||||||
|
packs:
|
||||||
|
javascript:
|
||||||
|
- codeql/javascript-queries
|
||||||
|
- dsp-testing/codeql-pack1@1.0.0
|
||||||
|
|
||||||
|
query-filters:
|
||||||
|
# This should run js/path-injection and js/zipslip
|
||||||
|
- include:
|
||||||
|
tags contain: external/cwe/cwe-022
|
||||||
|
|
||||||
|
# Removes js/path-injection
|
||||||
|
- exclude:
|
||||||
|
id: js/path-injection
|
||||||
|
|
||||||
|
# Query from extra pack
|
||||||
|
- include:
|
||||||
|
id: javascript/example/empty-or-one-block
|
||||||
35
tests/multi-language-repo/.github/codeql/codeql-config-query-filters3.yml
vendored
Normal file
35
tests/multi-language-repo/.github/codeql/codeql-config-query-filters3.yml
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
name: "Check SARIF for query packs and local queries with Single include, Single exclude"
|
||||||
|
|
||||||
|
disable-default-queries: true
|
||||||
|
|
||||||
|
queries:
|
||||||
|
# Local query
|
||||||
|
- name: Run an extra local query
|
||||||
|
uses: ./codeql-qlpacks/javascript-qlpack/show_ifs.ql
|
||||||
|
|
||||||
|
# These queries are ignored
|
||||||
|
- name: Ignored queries
|
||||||
|
uses: ./codeql-qlpacks/complex-python-qlpack/rootAndBar.qls
|
||||||
|
|
||||||
|
|
||||||
|
packs:
|
||||||
|
javascript:
|
||||||
|
- codeql/javascript-queries
|
||||||
|
- dsp-testing/codeql-pack1@1.0.0
|
||||||
|
|
||||||
|
query-filters:
|
||||||
|
# This should run js/path-injection and js/zipslip
|
||||||
|
- include:
|
||||||
|
tags contain: external/cwe/cwe-022
|
||||||
|
|
||||||
|
# Removes js/path-injection
|
||||||
|
- exclude:
|
||||||
|
id: js/path-injection
|
||||||
|
|
||||||
|
# Query from extra pack
|
||||||
|
- include:
|
||||||
|
id: javascript/example/empty-or-one-block
|
||||||
|
|
||||||
|
# Local query
|
||||||
|
- include:
|
||||||
|
id: inrepo-javascript-querypack/show-ifs
|
||||||
Loading…
Add table
Add a link
Reference in a new issue