8000 Support `security-experimental` as a well-known suite · github/codeql-action@5039ea0 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5039ea0

Browse files
committed
Support security-experimental as a well-known suite
1 parent b95df0b commit 5039ea0

File tree

9 files changed

+70
-11
lines changed

9 files changed

+70
-11
lines changed

lib/codeql.js

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/codeql.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/config-utils.js

Lines changed: 12 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/config-utils.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/config-utils.test.js

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/config-utils.test.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/codeql.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,11 @@ export const CODEQL_VERSION_ML_POWERED_QUERIES_WINDOWS = "2.9.0";
278278
*/
279279
export const CODEQL_VERSION_BETTER_RESOLVE_LANGUAGES = "2.10.3";
280280

281+
/**
282+
* Versions 2.11.1+ of the CodeQL CLI introduces `security-experimental` query suites for all languages.
283+
*/
284+
export const CODEQL_VERSION_SECURITY_EXPERIMENTAL_SUITE = "2.12.1";
285+
281286
/**
282287
* Set up CodeQL CLI access.
283288
*

src/config-utils.test.ts

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1993,7 +1993,7 @@ test(
19931993
process.platform === "win32" ? undefined : "~0.1.0"
19941994
);
19951995
// Test that ML-powered queries aren't run when the user hasn't specified that we should run the
1996-
// `security-extended` or `security-and-quality` query suite.
1996+
// `security-experimental`, `security-extended`, or `security-and-quality` query suite.
19971997
test(mlPoweredQueriesMacro, "2.7.5", true, undefined, undefined, undefined);
19981998
// Test that ML-powered queries are run on non-Windows platforms running `security-extended` on
19991999
// versions of the CodeQL CLI prior to 2.9.0.
@@ -2074,7 +2074,6 @@ test(
20742074
"security-extended",
20752075
"~0.4.0"
20762076
);
2077-
20782077
// Test that ML-powered queries are run on all platforms running `security-and-quality` on CodeQL
20792078
// CLI 2.11.3+.
20802079
test(
@@ -2085,6 +2084,26 @@ test(
20852084
"security-and-quality",
20862085
"~0.4.0"
20872086
);
2087+
// Test that ML-powered queries aren't run on all platforms running `security-experimental` on CodeQL
2088+
// CLI version prior to 2.12.1, because this suite is unsupported.
2089+
test(
2090+
mlPoweredQueriesMacro,
2091+
"2.12.0",
2092+
true,
2093+
undefined,
2094+
"security-experimental",
2095+
"~0.4.0"
2096+
);
2097+
// Test that ML-powered queries are run on all platforms running `security-experimental` on CodeQL
2098+
// CLI 2.12.1+.
2099+
test(
2100+
mlPoweredQueriesMacro,
2101+
"2.12.1",
2102+
true,
2103+
undefined,
2104+
"security-experimental",
2105+
"~0.4.0"
2106+
);
20882107

20892108
const calculateAugmentationMacro = test.macro({
20902109
exec: async (

src/config-utils.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
CodeQL,
1111
CODEQL_VERSION_GHES_PACK_DOWNLOAD,
1212
CODEQL_VERSION_ML_POWERED_QUERIES_WINDOWS,
13+
CODEQL_VERSION_SECURITY_EXPERIMENTAL_SUITE,
1314
ResolveQueriesOutput,
1415
} from "./codeql";
1516
import * as externalQueries from "./external-queries";
@@ -380,7 +381,11 @@ async function addDefaultQueries(
380381
}
381382

382383
// The set of acceptable values for built-in suites from the codeql bundle
383-
const builtinSuites = ["security-extended", "security-and-quality"] as const;
384+
const builtinSuites = [
385+
"security-experimental",
386+
"security-extended",
387+
"security-and-quality",
388+
] as const;
384389

385390
/**
386391
* Determine the set of queries associated with suiteName's suites and add them to resultMap.
@@ -401,6 +406,17 @@ async function addBuiltinSuiteQueries(
401406
if (!found) {
402407
throw new Error(getQueryUsesInvalid(configFile, suiteName));
403408
}
409+
if (
410+
suiteName === "security-experimental" &&
411+
!(await codeQlVersionAbove(
412+
codeQL,
413+
CODEQL_VERSION_SECURITY_EXPERIMENTAL_SUITE
414+
))
415+
) {
416+
throw new Error(
417+
`'security-experimental' suite is not supported on CodeQL versions less than ${CODEQL_VERSION_SECURITY_EXPERIMENTAL_SUITE}.`
418+
);
419+
}
404420

405421
// If we're running the JavaScript security-extended analysis (or a superset of it), the repo is
406422
// opted into the ML-powered queries beta, and a user hasn't already added the ML-powered query
@@ -413,7 +429,9 @@ async function addBuiltinSuiteQueries(
413429
CODEQL_VERSION_ML_POWERED_QUERIES_WINDOWS
414430
))) &&
415431
languages.includes("javascript") &&
416-
(found === "security-extended" || found === "security-and-quality") &&
432+
(found === "security-experimental" ||
433+
found === "security-extended" ||
434+
found === "security-and-quality") &&
417435
!packs.javascript?.some(isMlPoweredJsQueriesPack) &&
418436
(await featureEnablement.getValue(Feature.MlPoweredQueriesEnabled, codeQL))
419437
) {

0 commit comments

Comments
 (0)
0