Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
8a64627
python-setup: Check if `pip` is already installed for Python2
RasmusWL Apr 22, 2022
d9e30cb
Run ML-powered queries on Windows with CodeQL CLI 2.9.0+
henrymercer Apr 28, 2022
193cfa5
Update PR checks for Windows and CodeQL CLI 2.9.0+
henrymercer Apr 28, 2022
ed0abc6
Log the expected outcome of the tests for clarity
henrymercer Apr 28, 2022
395afb1
Fix unit test assertion on Windows
henrymercer Apr 29, 2022
b651a67
Merge branch 'main' into rasmuswl/pip-python2-fix
RasmusWL May 10, 2022
878b64e
Merge branch 'main' into rasmuswl/pip-python2-fix
henrymercer May 10, 2022
7c55012
Merge pull request #1039 from github/rasmuswl/pip-python2-fix
RasmusWL May 10, 2022
d468c94
Update contributing.md
aeisenberg May 10, 2022
ef73e3b
Update changelog and version after v2.1.10
invalid-email-address May 10, 2022
8dbd965
Merge pull request #1063 from github/aeisenberg/contrib
aeisenberg May 10, 2022
ca6773e
Update checked-in dependencies
invalid-email-address May 10, 2022
a82d691
Merge branch 'main' into mergeback/v2.1.10-to-main-75b4f1c4
henrymercer May 10, 2022
38fc5eb
Merge pull request #1064 from github/mergeback/v2.1.10-to-main-75b4f1c4
May 10, 2022
daf6560
Update changelog and version after v2.1.10
invalid-email-address May 11, 2022
4f87830
Merge branch 'main' into mergeback/v2.1.10-to-main-03e2e3c4
henrymercer May 11, 2022
c4fdf5f
Merge pull request #1067 from github/mergeback/v2.1.10-to-main-03e2e3c4
henrymercer May 11, 2022
f8c88ab
Update changelog and version after v2.1.10
invalid-email-address May 11, 2022
97847a4
Merge branch 'main' into mergeback/v2.1.10-to-main-2f58583a
henrymercer May 11, 2022
ace076b
Merge pull request #1070 from github/mergeback/v2.1.10-to-main-2f58583a
henrymercer May 11, 2022
533ce91
Merge remote-tracking branch 'origin/main' into henrymercer/run-atm-o…
henrymercer May 11, 2022
1fae5bf
Merge pull request #1051 from github/henrymercer/run-atm-on-windows
henrymercer May 11, 2022
54b4854
Bump @actions/tool-cache to 2.0.0
henrymercer May 13, 2022
0658e4b
Merge pull request #1075 from github/henrymercer/update-actions-tool-…
henrymercer May 13, 2022
c38e41c
Fix a typo in the CHANGELOG
henrymercer May 13, 2022
e655565
Merge pull request #1076 from github/henrymercer/fix-changelog-typo
henrymercer May 13, 2022
1725087
Update default CodeQL to 2.9.2
edoardopirovano May 12, 2022
657c2f3
Merge pull request #1074 from github/edoardo/2.9.2-update
edoardopirovano May 16, 2022
657581e
Update changelog for v2.1.11
invalid-email-address May 17, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Run ML-powered queries on Windows with CodeQL CLI 2.9.0+
  • Loading branch information
henrymercer committed Apr 28, 2022
commit d9e30cb001c16328cc13846f7ed5906bc5caef06
8 changes: 7 additions & 1 deletion lib/codeql.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/codeql.js.map

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions lib/config-utils.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/config-utils.js.map

Large diffs are not rendered by default.

22 changes: 15 additions & 7 deletions lib/config-utils.test.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/config-utils.test.js.map

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions src/codeql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,13 @@ export const CODEQL_VERSION_ML_POWERED_QUERIES = "2.7.5";
*/
export const CODEQL_VERSION_NEW_TRACING = "2.7.0";

/**
* Versions 2.9.0+ of the CodeQL CLI run machine learning models from a temporary directory, which
* resolves an issue on Windows where TensorFlow models are not correctly loaded due to the path of
* some of their files being greater than MAX_PATH (260 characters).
*/
export const CODEQL_VERSION_ML_POWERED_QUERIES_WINDOWS = "2.9.0";

function getCodeQLBundleName(): string {
let platform: string;
if (process.platform === "win32") {
Expand Down
52 changes: 37 additions & 15 deletions src/config-utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1807,42 +1807,64 @@ test(
"security-extended",
undefined
);
// Test that the ~0.1.0 version of ML-powered queries is run on v2.8.3 of the CLI.
test(
mlPoweredQueriesMacro,
"2.8.3",
true,
undefined,
"security-extended",
process.platform === "win32" ? undefined : "~0.1.0"
);
// Test that ML-powered queries aren't run when the user hasn't specified that we should run the
// `security-extended` or `security-and-quality` query suite.
test(mlPoweredQueriesMacro, "2.7.5", true, undefined, undefined, undefined);
// Test that ML-powered queries are run on non-Windows platforms running `security-extended`.
// Test that ML-powered queries are run on non-Windows platforms running `security-extended` on
// versions of the CodeQL CLI prior to 2.9.0.
test(
mlPoweredQueriesMacro,
"2.7.5",
"2.8.5",
true,
undefined,
"security-extended",
process.platform === "win32" ? undefined : "~0.1.0"
process.platform === "win32" ? undefined : "~0.2.0"
);
// Test that ML-powered queries are run on non-Windows platforms running `security-and-quality`.
// Test that ML-powered queries are run on non-Windows platforms running `security-and-quality` on
// versions of the CodeQL CLI prior to 2.9.0.
test(
mlPoweredQueriesMacro,
"2.7.5",
"2.8.5",
true,
undefined,
"security-and-quality",
process.platform === "win32" ? undefined : "~0.1.0"
process.platform === "win32" ? undefined : "~0.2.0"
);
// Test that we don't inject an ML-powered query pack if the user has already specified one.
// Test that ML-powered queries are run on all platforms running `security-extended` on CodeQL CLI
// 2.9.0+.
test(
mlPoweredQueriesMacro,
"2.7.5",
"2.9.0",
true,
"codeql/[email protected]",
"security-and-quality",
process.platform === "win32" ? undefined : "0.0.1"
undefined,
"security-extended",
"~0.2.0"
);
// Test that the ~0.2.0 version of ML-powered queries is run on v2.8.4 of the CLI.
// Test that ML-powered queries are run on all platforms running `security-and-quality` on CodeQL
// CLI 2.9.0+.
test(
mlPoweredQueriesMacro,
"2.8.4",
"2.9.0",
true,
undefined,
"security-extended",
process.platform === "win32" ? undefined : "~0.2.0"
"security-and-quality",
"~0.2.0"
);
// Test that we don't inject an ML-powered query pack if the user has already specified one.
test(
mlPoweredQueriesMacro,
"2.9.0",
true,
"codeql/[email protected]",
"security-and-quality",
process.platform === "win32" ? undefined : "0.0.1"
);
9 changes: 7 additions & 2 deletions src/config-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import * as api from "./api-client";
import {
CodeQL,
CODEQL_VERSION_ML_POWERED_QUERIES,
CODEQL_VERSION_ML_POWERED_QUERIES_WINDOWS,
ResolveQueriesOutput,
} from "./codeql";
import * as externalQueries from "./external-queries";
Expand Down Expand Up @@ -300,8 +301,12 @@ async function addBuiltinSuiteQueries(
// opted into the ML-powered queries beta, and a user hasn't already added the ML-powered query
// pack, then add the ML-powered query pack so that we run ML-powered queries.
if (
// Disable ML-powered queries on Windows
process.platform !== "win32" &&
// Only run ML-powered queries on Windows if we have a CLI that supports it.
(process.platform !== "win32" ||
(await codeQlVersionAbove(
codeQL,
CODEQL_VERSION_ML_POWERED_QUERIES_WINDOWS
))) &&
languages.includes("javascript") &&
(found === "security-extended" || found === "security-and-quality") &&
!packs.javascript?.some(
Expand Down