mirror of
https://github.com/github/codeql-action.git
synced 2025-12-09 01:08:10 +08:00
Compare commits
417 Commits
codeql-bun
...
v2.22.3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0116bc2df5 | ||
|
|
f5a984b113 | ||
|
|
82ba90b1d9 | ||
|
|
34f97d7a16 | ||
|
|
74442e0a95 | ||
|
|
bd32fab74f | ||
|
|
b584cf8321 | ||
|
|
761255a4a3 | ||
|
|
346d5c4b07 | ||
|
|
5950d13564 | ||
|
|
c1a0ad9a04 | ||
|
|
76a9f5c431 | ||
|
|
d90b8d79de | ||
|
|
175f696a4d | ||
|
|
8a2cbabd43 | ||
|
|
a5cf70c3f1 | ||
|
|
a67b110795 | ||
|
|
0eb279015c | ||
|
|
275f994944 | ||
|
|
d5d445b7af | ||
|
|
2a7218bdef | ||
|
|
78bfd29301 | ||
|
|
dfb913f660 | ||
|
|
e62d946796 | ||
|
|
026e833827 | ||
|
|
5d6442e87d | ||
|
|
4ab92370dd | ||
|
|
83d1db3366 | ||
|
|
2125352e3e | ||
|
|
d52a751f8f | ||
|
|
947b43a6b6 | ||
|
|
788783aba5 | ||
|
|
fdcae64e14 | ||
|
|
8554648f41 | ||
|
|
18e6c398ce | ||
|
|
5e34d08d9e | ||
|
|
faf91ca6bd | ||
|
|
8193a92e41 | ||
|
|
ffaea6c837 | ||
|
|
0a0988c4b2 | ||
|
|
0d5c2e0228 | ||
|
|
94b6970619 | ||
|
|
669c61022c | ||
|
|
028bacb8e9 | ||
|
|
d0916526cd | ||
|
|
102a12bba4 | ||
|
|
8295705640 | ||
|
|
4eccc6dac4 | ||
|
|
aed2e7f47f | ||
|
|
a2dc5ffaff | ||
|
|
b6ea09e3e4 | ||
|
|
fd3d78671c | ||
|
|
2cb752a87e | ||
|
|
e50f53baa1 | ||
|
|
0a65c007f6 | ||
|
|
3f7850a179 | ||
|
|
27235304e0 | ||
|
|
8f0e8b0890 | ||
|
|
f243294ab7 | ||
|
|
075eb6aaea | ||
|
|
1ea6a10947 | ||
|
|
e26ed57a22 | ||
|
|
0ac7669167 | ||
|
|
235bdca565 | ||
|
|
94f3e9b563 | ||
|
|
3b2fee487e | ||
|
|
a144bf5d7f | ||
|
|
4154eb799b | ||
|
|
7f4a9481a7 | ||
|
|
faf7528b44 | ||
|
|
2b193c5ab5 | ||
|
|
eb71a60380 | ||
|
|
36777d2236 | ||
|
|
1727de39fe | ||
|
|
c8dd2bc90f | ||
|
|
db9f2c5968 | ||
|
|
738030674f | ||
|
|
68d0b65ee5 | ||
|
|
517782a2a0 | ||
|
|
bb70bab648 | ||
|
|
41a13ec084 | ||
|
|
9a5a628613 | ||
|
|
8ac187720c | ||
|
|
f6d9b6bcfa | ||
|
|
7b0b42afec | ||
|
|
abb71f14cf | ||
|
|
604448043e | ||
|
|
4cee553ea6 | ||
|
|
df098abd11 | ||
|
|
4611ff9b23 | ||
|
|
2bd75f528c | ||
|
|
3c15d2383b | ||
|
|
c08086a26a | ||
|
|
d718153f0a | ||
|
|
3fb6719bea | ||
|
|
bcbb900532 | ||
|
|
49b94f1a2d | ||
|
|
bb67eddd77 | ||
|
|
e827ad5b71 | ||
|
|
a402be8739 | ||
|
|
74b46628c3 | ||
|
|
3dd4ad872b | ||
|
|
b686e07c2b | ||
|
|
7de46310d9 | ||
|
|
896a68d162 | ||
|
|
5f88bb1ffa | ||
|
|
90f8ed12cc | ||
|
|
ed2a90b161 | ||
|
|
7b16c0dad0 | ||
|
|
37a2d1fe3c | ||
|
|
5dac60ecef | ||
|
|
ebbadee09e | ||
|
|
a370ce344f | ||
|
|
66572c69b0 | ||
|
|
e0103eab17 | ||
|
|
e7a6fa9589 | ||
|
|
f59bf3c458 | ||
|
|
6e3f5b0184 | ||
|
|
1d70a98580 | ||
|
|
e4ef094279 | ||
|
|
2cc1651ead | ||
|
|
a6484fa0f6 | ||
|
|
9ef3267030 | ||
|
|
219066c343 | ||
|
|
a9a0f3b4c0 | ||
|
|
467bfa1cff | ||
|
|
1d5eed8d40 | ||
|
|
96fa24c6ba | ||
|
|
f1752b0b55 | ||
|
|
7efe1c9625 | ||
|
|
0dd2eafff0 | ||
|
|
ddccb87388 | ||
|
|
d8cb5a2a0f | ||
|
|
378bbcd274 | ||
|
|
27cb1e1de5 | ||
|
|
4818fdd8ec | ||
|
|
e548601be3 | ||
|
|
cc6542087a | ||
|
|
c95737bb43 | ||
|
|
41d2ffad87 | ||
|
|
650a85ef6d | ||
|
|
0de36d4594 | ||
|
|
0dfaf4ef65 | ||
|
|
d1a917f445 | ||
|
|
431174f620 | ||
|
|
3078f51bf0 | ||
|
|
d0c18ba23e | ||
|
|
724d64319a | ||
|
|
49aaa9a420 | ||
|
|
c21e1dd0da | ||
|
|
53bed11e0b | ||
|
|
ab8159054c | ||
|
|
765807bee7 | ||
|
|
bf2187592f | ||
|
|
c4c06786f2 | ||
|
|
59aaff8718 | ||
|
|
5897cf73c4 | ||
|
|
d467036438 | ||
|
|
8e0b1c74b1 | ||
|
|
01b8760f90 | ||
|
|
74e25cdac8 | ||
|
|
eac8f8cd93 | ||
|
|
6a28655e3d | ||
|
|
2ca983a793 | ||
|
|
dd1128f4f1 | ||
|
|
f3a128e0fe | ||
|
|
6846be007d | ||
|
|
0e74cd1660 | ||
|
|
379f89dc53 | ||
|
|
253d9cf358 | ||
|
|
4254f3a4c1 | ||
|
|
9bfb9ba527 | ||
|
|
d4c26876d3 | ||
|
|
d6f9faae0d | ||
|
|
c459726691 | ||
|
|
a087b01cdd | ||
|
|
f3051ed54e | ||
|
|
860e98cc4a | ||
|
|
3ffd6c071a | ||
|
|
2d646a3990 | ||
|
|
a9313c9016 | ||
|
|
5f18c9ab80 | ||
|
|
2c22b37a68 | ||
|
|
c07fd68e12 | ||
|
|
c33f0b4fc7 | ||
|
|
04daf014b5 | ||
|
|
bb3bc25861 | ||
|
|
ac4145f467 | ||
|
|
87a64c9c4c | ||
|
|
897ddf2662 | ||
|
|
74714a34ca | ||
|
|
e982de4fb4 | ||
|
|
19c02a4d16 | ||
|
|
71c7e82837 | ||
|
|
8b733e71a6 | ||
|
|
c6c77c8c2d | ||
|
|
8efd40b126 | ||
|
|
77a54b68d4 | ||
|
|
f664957aa4 | ||
|
|
70c4c0fc21 | ||
|
|
701f152f28 | ||
|
|
1b6299040a | ||
|
|
5462f69153 | ||
|
|
6a6a824702 | ||
|
|
88c7a5c4cc | ||
|
|
da65035498 | ||
|
|
43750fe4fc | ||
|
|
a7c12a5225 | ||
|
|
7218de5369 | ||
|
|
4764dce02f | ||
|
|
077672fa88 | ||
|
|
583a1019cc | ||
|
|
45d66afb31 | ||
|
|
f4683e88f3 | ||
|
|
798e74c57d | ||
|
|
37d8d03606 | ||
|
|
7bffcb42ec | ||
|
|
94293438d4 | ||
|
|
e6cb4feff9 | ||
|
|
85cd5ad8b4 | ||
|
|
d5d81f40c6 | ||
|
|
bec071acb9 | ||
|
|
5150b5c6ab | ||
|
|
270788d6fd | ||
|
|
10389f671b | ||
|
|
574dbbc517 | ||
|
|
466ed42568 | ||
|
|
321d3e057d | ||
|
|
3115e0f9c4 | ||
|
|
7aafc67ccf | ||
|
|
07d42ec34e | ||
|
|
c5acfe3b0d | ||
|
|
469786860d | ||
|
|
e603106d1a | ||
|
|
09940b4bb9 | ||
|
|
8ecc33d259 | ||
|
|
d721f69753 | ||
|
|
b88b5503aa | ||
|
|
f644ffe4b2 | ||
|
|
7cd044345e | ||
|
|
00e563ead9 | ||
|
|
7323c2ac6b | ||
|
|
100912429f | ||
|
|
a2d14d32b8 | ||
|
|
ff9cb435df | ||
|
|
2f913c1249 | ||
|
|
7dab60079b | ||
|
|
862b2cf102 | ||
|
|
070dd05edd | ||
|
|
ff95d147d6 | ||
|
|
30fe0c4907 | ||
|
|
e5813484cd | ||
|
|
9a53fd0577 | ||
|
|
dfb560cac1 | ||
|
|
5c8be669de | ||
|
|
14877a1345 | ||
|
|
bc08098689 | ||
|
|
02c45745e3 | ||
|
|
67f7ac2add | ||
|
|
fbb8195699 | ||
|
|
66572f0900 | ||
|
|
e755a052f0 | ||
|
|
37628e79a4 | ||
|
|
e4262713b5 | ||
|
|
ddf2bd2495 | ||
|
|
c34b59d32f | ||
|
|
b557ee7090 | ||
|
|
d5b5e18245 | ||
|
|
e683046da1 | ||
|
|
af18655ef9 | ||
|
|
314b271ce0 | ||
|
|
4db827f313 | ||
|
|
6a54608e14 | ||
|
|
3f55ff1327 | ||
|
|
3ecf990cd2 | ||
|
|
96f00f2adf | ||
|
|
2760c3e6c4 | ||
|
|
a09933a12a | ||
|
|
37116fb629 | ||
|
|
c613917766 | ||
|
|
492a68c323 | ||
|
|
ac49314877 | ||
|
|
ac35d7a02d | ||
|
|
d03c744ad6 | ||
|
|
a0407a8c60 | ||
|
|
8a7b2e9c9b | ||
|
|
9a510d9b07 | ||
|
|
2160dd3b55 | ||
|
|
1e14fd9e7a | ||
|
|
2ec74e3c0e | ||
|
|
25a42462f9 | ||
|
|
f5920c85ab | ||
|
|
6ed1ccdc9a | ||
|
|
ceb4b69c73 | ||
|
|
76584bd0a0 | ||
|
|
fba32955a0 | ||
|
|
f4eba74c80 | ||
|
|
9e4932e291 | ||
|
|
bd20e2b607 | ||
|
|
c93877b070 | ||
|
|
4e9f8a2be4 | ||
|
|
a07ea2da0c | ||
|
|
9a202d29ad | ||
|
|
5b6282e01c | ||
|
|
f0f7a35b85 | ||
|
|
dda4ed3db4 | ||
|
|
f9a7c6738f | ||
|
|
31b9dd18d4 | ||
|
|
7e2f56aae3 | ||
|
|
834f08becb | ||
|
|
878ae4a749 | ||
|
|
63602c0f72 | ||
|
|
66dc883276 | ||
|
|
97ce1b094a | ||
|
|
ba5812e64f | ||
|
|
2203178090 | ||
|
|
3b25789080 | ||
|
|
7dcb3e5276 | ||
|
|
09ce3dbf90 | ||
|
|
c6d284324b | ||
|
|
c55207f0a2 | ||
|
|
45e889b4b3 | ||
|
|
131cb1abb1 | ||
|
|
0ff6cfb53c | ||
|
|
f128379387 | ||
|
|
1f63aba653 | ||
|
|
a98b9bd46b | ||
|
|
49e0fc2ba1 | ||
|
|
2192e3432b | ||
|
|
1b6e91df31 | ||
|
|
c32aadf8fd | ||
|
|
7d646d3301 | ||
|
|
7b79062de0 | ||
|
|
61cdd2503b | ||
|
|
92c848eb82 | ||
|
|
f93fb8df6e | ||
|
|
ea47b2ae40 | ||
|
|
38adb40e7a | ||
|
|
e7e35baaf0 | ||
|
|
a6b0ced86b | ||
|
|
6a17359b95 | ||
|
|
245422d4c0 | ||
|
|
c7b7456c9e | ||
|
|
cf445f7cf3 | ||
|
|
2f8540dd31 | ||
|
|
bc068d74aa | ||
|
|
bcfe48982e | ||
|
|
79690d4663 | ||
|
|
5691205077 | ||
|
|
d9d3212c79 | ||
|
|
81ae676e79 | ||
|
|
c8b21b59d1 | ||
|
|
7c2bd355f3 | ||
|
|
868eec5e6d | ||
|
|
0ba4244466 | ||
|
|
eea148f0e6 | ||
|
|
34090feb56 | ||
|
|
a9a416c8f4 | ||
|
|
10c6bfee12 | ||
|
|
67e62e7b01 | ||
|
|
feea86eed3 | ||
|
|
2e6f8c08c1 | ||
|
|
8342844ea7 | ||
|
|
679aac1b20 | ||
|
|
de6681ceb7 | ||
|
|
f6fe5c5c70 | ||
|
|
976ada262f | ||
|
|
c946707707 | ||
|
|
4f6104c444 | ||
|
|
a27d3e9355 | ||
|
|
cae6b78afc | ||
|
|
097823f389 | ||
|
|
62762170e1 | ||
|
|
e4ccfbd189 | ||
|
|
eaa61762f4 | ||
|
|
6ca1aa8c19 | ||
|
|
84a55d4e11 | ||
|
|
055b396ea2 | ||
|
|
98d57a1337 | ||
|
|
1ba3eaa7d3 | ||
|
|
233b9834e6 | ||
|
|
9cbfcfde24 | ||
|
|
7a8ccc55bf | ||
|
|
ac0d76444a | ||
|
|
500b1fac79 | ||
|
|
d89d3764f8 | ||
|
|
654518ea06 | ||
|
|
1a480074ee | ||
|
|
8ab72a0f47 | ||
|
|
658a20c06e | ||
|
|
818b10d9bb | ||
|
|
126f9c6282 | ||
|
|
cfd7e3df84 | ||
|
|
c974f40fee | ||
|
|
d34eb386d4 | ||
|
|
c57b27e4b7 | ||
|
|
d1d5f4de97 | ||
|
|
badeebcb1a | ||
|
|
b16296be30 | ||
|
|
eff6331393 | ||
|
|
601c5ba56e | ||
|
|
57a11be8e4 | ||
|
|
7197f58bbf | ||
|
|
3007c1e340 | ||
|
|
4a2e8975cd | ||
|
|
47952bf4c2 | ||
|
|
5bbe7a2b8c | ||
|
|
9fc0c931c7 | ||
|
|
fdedc91de2 | ||
|
|
2eb34f2fb9 | ||
|
|
a3ef0b984b | ||
|
|
65a297b952 | ||
|
|
0f871fa80d | ||
|
|
c84418936e | ||
|
|
e94e15d8dd | ||
|
|
21c926745f | ||
|
|
76b2afaa4a |
3
.git-blame-ignore-revs
Normal file
3
.git-blame-ignore-revs
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# .git-blame-ignore-revs
|
||||||
|
# Added trailing commas to adhere to new eslint rules
|
||||||
|
b16296be30e150034524d6dd0b0418fc6b184267
|
||||||
34
.github/actions/prepare-test/action.yml
vendored
34
.github/actions/prepare-test/action.yml
vendored
@@ -2,8 +2,12 @@ name: "Prepare test"
|
|||||||
description: Performs some preparation to run tests
|
description: Performs some preparation to run tests
|
||||||
inputs:
|
inputs:
|
||||||
version:
|
version:
|
||||||
description: "The version of the CodeQL CLI to use. Can be 'latest', 'cached', 'nightly-latest', 'nightly-YYYY-MM-DD', or 'stable-YYYY-MM-DD'."
|
description: "The version of the CodeQL CLI to use. Can be 'latest', 'default', 'nightly-latest', 'nightly-YYYY-MM-DD', or 'stable-YYYY-MM-DD'."
|
||||||
required: true
|
required: true
|
||||||
|
use-all-platform-bundle:
|
||||||
|
description: "If true, we output a tools URL with codeql-bundle.tar.gz file rather than platform-specific URL"
|
||||||
|
default: 'false'
|
||||||
|
required: false
|
||||||
outputs:
|
outputs:
|
||||||
tools-url:
|
tools-url:
|
||||||
description: "The value that should be passed as the 'tools' input of the 'init' step."
|
description: "The value that should be passed as the 'tools' input of the 'init' step."
|
||||||
@@ -23,18 +27,32 @@ runs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
set -e # Fail this Action if `gh release list` fails.
|
set -e # Fail this Action if `gh release list` fails.
|
||||||
|
|
||||||
|
if [[ ${{ inputs.use-all-platform-bundle }} == "true" ]]; then
|
||||||
|
artifact_name="codeql-bundle.tar.gz"
|
||||||
|
elif [[ "$RUNNER_OS" == "Linux" ]]; then
|
||||||
|
artifact_name="codeql-bundle-linux64.tar.gz"
|
||||||
|
elif [[ "$RUNNER_OS" == "macOS" ]]; then
|
||||||
|
artifact_name="codeql-bundle-osx64.tar.gz"
|
||||||
|
elif [[ "$RUNNER_OS" == "Windows" ]]; then
|
||||||
|
artifact_name="codeql-bundle-win64.tar.gz"
|
||||||
|
else
|
||||||
|
echo "::error::Unrecognized OS $RUNNER_OS"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ ${{ inputs.version }} == "nightly-latest" ]]; then
|
if [[ ${{ inputs.version }} == "nightly-latest" ]]; then
|
||||||
export LATEST=`gh release list --repo dsp-testing/codeql-cli-nightlies -L 1 | cut -f 3`
|
tag=`gh release list --repo dsp-testing/codeql-cli-nightlies -L 1 | cut -f 3`
|
||||||
echo "tools-url=https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/$LATEST/codeql-bundle.tar.gz" >> $GITHUB_OUTPUT
|
echo "tools-url=https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/$tag/$artifact_name" >> $GITHUB_OUTPUT
|
||||||
elif [[ ${{ inputs.version }} == *"nightly"* ]]; then
|
elif [[ ${{ inputs.version }} == *"nightly"* ]]; then
|
||||||
export VERSION=`echo ${{ inputs.version }} | sed -e 's/^.*\-//'`
|
version=`echo ${{ inputs.version }} | sed -e 's/^.*\-//'`
|
||||||
echo "tools-url=https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/codeql-bundle-$VERSION-manual/codeql-bundle.tar.gz" >> $GITHUB_OUTPUT
|
echo "tools-url=https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/codeql-bundle-$version-manual/$artifact_name" >> $GITHUB_OUTPUT
|
||||||
elif [[ ${{ inputs.version }} == *"stable"* ]]; then
|
elif [[ ${{ inputs.version }} == *"stable"* ]]; then
|
||||||
export VERSION=`echo ${{ inputs.version }} | sed -e 's/^.*\-//'`
|
version=`echo ${{ inputs.version }} | sed -e 's/^.*\-//'`
|
||||||
echo "tools-url=https://github.com/github/codeql-action/releases/download/codeql-bundle-$VERSION/codeql-bundle.tar.gz" >> $GITHUB_OUTPUT
|
echo "tools-url=https://github.com/github/codeql-action/releases/download/codeql-bundle-$version/$artifact_name" >> $GITHUB_OUTPUT
|
||||||
elif [[ ${{ inputs.version }} == "latest" ]]; then
|
elif [[ ${{ inputs.version }} == "latest" ]]; then
|
||||||
echo "tools-url=latest" >> $GITHUB_OUTPUT
|
echo "tools-url=latest" >> $GITHUB_OUTPUT
|
||||||
elif [[ ${{ inputs.version }} == "cached" ]]; then
|
elif [[ ${{ inputs.version }} == "default" ]]; then
|
||||||
echo "tools-url=" >> $GITHUB_OUTPUT
|
echo "tools-url=" >> $GITHUB_OUTPUT
|
||||||
else
|
else
|
||||||
echo "::error::Unrecognized version specified!"
|
echo "::error::Unrecognized version specified!"
|
||||||
|
|||||||
17
.github/actions/setup-swift/action.yml
vendored
17
.github/actions/setup-swift/action.yml
vendored
@@ -1,5 +1,5 @@
|
|||||||
name: "Set up Swift"
|
name: "Set up Swift on Linux"
|
||||||
description: Sets up an appropriate Swift version if supported on this platform.
|
description: Sets up an appropriate Swift version on Linux.
|
||||||
inputs:
|
inputs:
|
||||||
codeql-path:
|
codeql-path:
|
||||||
description: Path to the CodeQL CLI executable.
|
description: Path to the CodeQL CLI executable.
|
||||||
@@ -9,21 +9,16 @@ runs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Get Swift version
|
- name: Get Swift version
|
||||||
id: get_swift_version
|
id: get_swift_version
|
||||||
if: runner.os != 'Windows'
|
if: runner.os == 'Linux'
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
CODEQL_PATH: ${{ inputs.codeql-path }}
|
CODEQL_PATH: ${{ inputs.codeql-path }}
|
||||||
run: |
|
run: |
|
||||||
if [[ $RUNNER_OS = "macOS" ]]; then
|
|
||||||
PLATFORM="osx64"
|
|
||||||
else # We do not run this step on Windows.
|
|
||||||
PLATFORM="linux64"
|
|
||||||
fi
|
|
||||||
SWIFT_EXTRACTOR_DIR="$("$CODEQL_PATH" resolve languages --format json | jq -r '.swift[0]')"
|
SWIFT_EXTRACTOR_DIR="$("$CODEQL_PATH" resolve languages --format json | jq -r '.swift[0]')"
|
||||||
if [ $SWIFT_EXTRACTOR_DIR = "null" ]; then
|
if [ $SWIFT_EXTRACTOR_DIR = "null" ]; then
|
||||||
VERSION="null"
|
VERSION="null"
|
||||||
else
|
else
|
||||||
VERSION="$("$SWIFT_EXTRACTOR_DIR/tools/$PLATFORM/extractor" --version | awk '/version/ { print $3 }')"
|
VERSION="$("$SWIFT_EXTRACTOR_DIR/tools/linux64/extractor" --version | awk '/version/ { print $3 }')"
|
||||||
# Specify 5.x.0, otherwise setup Action will default to latest minor version.
|
# Specify 5.x.0, otherwise setup Action will default to latest minor version.
|
||||||
if [ $VERSION = "5.7" ]; then
|
if [ $VERSION = "5.7" ]; then
|
||||||
VERSION="5.7.0"
|
VERSION="5.7.0"
|
||||||
@@ -36,7 +31,7 @@ runs:
|
|||||||
fi
|
fi
|
||||||
echo "version=$VERSION" | tee -a $GITHUB_OUTPUT
|
echo "version=$VERSION" | tee -a $GITHUB_OUTPUT
|
||||||
|
|
||||||
- uses: swift-actions/setup-swift@65540b95f51493d65f5e59e97dcef9629ddf11bf # Please update the corresponding SHA in the CLI's CodeQL Action Integration Test.
|
- uses: swift-actions/setup-swift@f51889efb55dccf13be0ee727e3d6c89a096fb4c # Please update the corresponding SHA in the CLI's CodeQL Action Integration Test.
|
||||||
if: runner.os != 'Windows' && steps.get_swift_version.outputs.version != 'null'
|
if: runner.os == 'Linux' && steps.get_swift_version.outputs.version != 'null'
|
||||||
with:
|
with:
|
||||||
swift-version: "${{ steps.get_swift_version.outputs.version }}"
|
swift-version: "${{ steps.get_swift_version.outputs.version }}"
|
||||||
|
|||||||
3
.github/dependabot.yml
vendored
3
.github/dependabot.yml
vendored
@@ -11,9 +11,6 @@ updates:
|
|||||||
# There is a type incompatibility issue between v0.0.9 and our other dependencies.
|
# There is a type incompatibility issue between v0.0.9 and our other dependencies.
|
||||||
- dependency-name: "@octokit/plugin-retry"
|
- dependency-name: "@octokit/plugin-retry"
|
||||||
versions: ["~6.0.0"]
|
versions: ["~6.0.0"]
|
||||||
# There is a type incompatibility issue between v0.0.9 and our other dependencies.
|
|
||||||
- dependency-name: "@schemastore/package"
|
|
||||||
versions: ["0.0.9"]
|
|
||||||
# v7 requires ESM
|
# v7 requires ESM
|
||||||
- dependency-name: "del"
|
- dependency-name: "del"
|
||||||
versions: ["^7.0.0"]
|
versions: ["^7.0.0"]
|
||||||
|
|||||||
67
.github/workflows/__all-platform-bundle.yml
generated
vendored
Normal file
67
.github/workflows/__all-platform-bundle.yml
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
# Warning: This file is generated automatically, and should not be modified.
|
||||||
|
# Instead, please modify the template in the pr-checks directory and run:
|
||||||
|
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
|
||||||
|
# to regenerate this file.
|
||||||
|
|
||||||
|
name: PR Check - All-platform bundle
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
GO111MODULE: auto
|
||||||
|
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- releases/v2
|
||||||
|
pull_request:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- synchronize
|
||||||
|
- reopened
|
||||||
|
- ready_for_review
|
||||||
|
workflow_dispatch: {}
|
||||||
|
jobs:
|
||||||
|
all-platform-bundle:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: nightly-latest
|
||||||
|
name: All-platform bundle
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
security-events: write
|
||||||
|
timeout-minutes: 45
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Check out repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Prepare test
|
||||||
|
id: prepare-test
|
||||||
|
uses: ./.github/actions/prepare-test
|
||||||
|
with:
|
||||||
|
version: ${{ matrix.version }}
|
||||||
|
use-all-platform-bundle: 'true'
|
||||||
|
- name: Set environment variable for Swift enablement
|
||||||
|
if: >-
|
||||||
|
runner.os != 'Windows' && (
|
||||||
|
matrix.version == '20220908' ||
|
||||||
|
matrix.version == '20221211'
|
||||||
|
)
|
||||||
|
shell: bash
|
||||||
|
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||||
|
- id: init
|
||||||
|
uses: ./../action/init
|
||||||
|
with:
|
||||||
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
|
- uses: ./../action/.github/actions/setup-swift
|
||||||
|
with:
|
||||||
|
codeql-path: ${{ steps.init.outputs.codeql-path }}
|
||||||
|
- name: Build code
|
||||||
|
shell: bash
|
||||||
|
run: ./build.sh
|
||||||
|
- uses: ./../action/analyze
|
||||||
|
with:
|
||||||
|
upload-database: false
|
||||||
|
env:
|
||||||
|
CODEQL_ACTION_TEST_MODE: true
|
||||||
45
.github/workflows/__analyze-ref-input.yml
generated
vendored
45
.github/workflows/__analyze-ref-input.yml
generated
vendored
@@ -26,47 +26,11 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: stable-20220615
|
version: default
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: stable-20220615
|
version: default
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
version: stable-20220615
|
version: default
|
||||||
- os: ubuntu-latest
|
|
||||||
version: stable-20220908
|
|
||||||
- os: macos-latest
|
|
||||||
version: stable-20220908
|
|
||||||
- os: windows-latest
|
|
||||||
version: stable-20220908
|
|
||||||
- os: ubuntu-latest
|
|
||||||
version: stable-20221211
|
|
||||||
- os: macos-latest
|
|
||||||
version: stable-20221211
|
|
||||||
- os: windows-latest
|
|
||||||
version: stable-20221211
|
|
||||||
- os: ubuntu-latest
|
|
||||||
version: stable-20230418
|
|
||||||
- os: macos-latest
|
|
||||||
version: stable-20230418
|
|
||||||
- os: windows-latest
|
|
||||||
version: stable-20230418
|
|
||||||
- os: ubuntu-latest
|
|
||||||
version: cached
|
|
||||||
- os: macos-latest
|
|
||||||
version: cached
|
|
||||||
- os: windows-latest
|
|
||||||
version: cached
|
|
||||||
- os: ubuntu-latest
|
|
||||||
version: latest
|
|
||||||
- os: macos-latest
|
|
||||||
version: latest
|
|
||||||
- os: windows-latest
|
|
||||||
version: latest
|
|
||||||
- os: ubuntu-latest
|
|
||||||
version: nightly-latest
|
|
||||||
- os: macos-latest
|
|
||||||
version: nightly-latest
|
|
||||||
- os: windows-latest
|
|
||||||
version: nightly-latest
|
|
||||||
name: "Analyze: 'ref' and 'sha' from inputs"
|
name: "Analyze: 'ref' and 'sha' from inputs"
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
@@ -75,12 +39,13 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/actions/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
use-all-platform-bundle: 'false'
|
||||||
- name: Set environment variable for Swift enablement
|
- name: Set environment variable for Swift enablement
|
||||||
if: >-
|
if: >-
|
||||||
runner.os != 'Windows' && (
|
runner.os != 'Windows' && (
|
||||||
|
|||||||
3
.github/workflows/__autobuild-action.yml
generated
vendored
3
.github/workflows/__autobuild-action.yml
generated
vendored
@@ -39,12 +39,13 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/actions/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
use-all-platform-bundle: 'false'
|
||||||
- name: Set environment variable for Swift enablement
|
- name: Set environment variable for Swift enablement
|
||||||
if: >-
|
if: >-
|
||||||
runner.os != 'Windows' && (
|
runner.os != 'Windows' && (
|
||||||
|
|||||||
3
.github/workflows/__config-export.yml
generated
vendored
3
.github/workflows/__config-export.yml
generated
vendored
@@ -45,12 +45,13 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/actions/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
use-all-platform-bundle: 'false'
|
||||||
- name: Set environment variable for Swift enablement
|
- name: Set environment variable for Swift enablement
|
||||||
if: >-
|
if: >-
|
||||||
runner.os != 'Windows' && (
|
runner.os != 'Windows' && (
|
||||||
|
|||||||
3
.github/workflows/__diagnostics-export.yml
generated
vendored
3
.github/workflows/__diagnostics-export.yml
generated
vendored
@@ -51,12 +51,13 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/actions/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
use-all-platform-bundle: 'false'
|
||||||
- name: Set environment variable for Swift enablement
|
- name: Set environment variable for Swift enablement
|
||||||
if: >-
|
if: >-
|
||||||
runner.os != 'Windows' && (
|
runner.os != 'Windows' && (
|
||||||
|
|||||||
14
.github/workflows/__export-file-baseline-information.yml
generated
vendored
14
.github/workflows/__export-file-baseline-information.yml
generated
vendored
@@ -39,12 +39,13 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/actions/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
use-all-platform-bundle: 'false'
|
||||||
- name: Set environment variable for Swift enablement
|
- name: Set environment variable for Swift enablement
|
||||||
if: >-
|
if: >-
|
||||||
runner.os != 'Windows' && (
|
runner.os != 'Windows' && (
|
||||||
@@ -58,19 +59,15 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
languages: javascript
|
languages: javascript
|
||||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
env:
|
|
||||||
CODEQL_FILE_BASELINE_INFORMATION: true
|
|
||||||
- uses: ./../action/.github/actions/setup-swift
|
- uses: ./../action/.github/actions/setup-swift
|
||||||
with:
|
with:
|
||||||
codeql-path: ${{steps.init.outputs.codeql-path}}
|
codeql-path: ${{ steps.init.outputs.codeql-path }}
|
||||||
- name: Build code
|
- name: Build code
|
||||||
shell: bash
|
shell: bash
|
||||||
run: ./build.sh
|
run: ./build.sh
|
||||||
- uses: ./../action/analyze
|
- uses: ./../action/analyze
|
||||||
with:
|
with:
|
||||||
output: ${{ runner.temp }}/results
|
output: ${{ runner.temp }}/results
|
||||||
env:
|
|
||||||
CODEQL_FILE_BASELINE_INFORMATION: true
|
|
||||||
- name: Upload SARIF
|
- name: Upload SARIF
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
@@ -81,13 +78,13 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
cd "$RUNNER_TEMP/results"
|
cd "$RUNNER_TEMP/results"
|
||||||
expected_baseline_languages="cpp cs go java js py rb"
|
expected_baseline_languages="c csharp go java kotlin javascript python ruby"
|
||||||
if [[ $RUNNER_OS != "Windows" ]]; then
|
if [[ $RUNNER_OS != "Windows" ]]; then
|
||||||
expected_baseline_languages+=" swift"
|
expected_baseline_languages+=" swift"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for lang in ${expected_baseline_languages}; do
|
for lang in ${expected_baseline_languages}; do
|
||||||
rule_name="${lang}/baseline/expected-extracted-files"
|
rule_name="cli/expected-extracted-files/${lang}"
|
||||||
found_notification=$(jq --arg rule_name "${rule_name}" '[.runs[0].tool.driver.notifications |
|
found_notification=$(jq --arg rule_name "${rule_name}" '[.runs[0].tool.driver.notifications |
|
||||||
select(. != null) | flatten | .[].id] | any(. == $rule_name)' javascript.sarif)
|
select(. != null) | flatten | .[].id] | any(. == $rule_name)' javascript.sarif)
|
||||||
if [[ "${found_notification}" != "true" ]]; then
|
if [[ "${found_notification}" != "true" ]]; then
|
||||||
@@ -98,4 +95,5 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
env:
|
env:
|
||||||
|
CODEQL_ACTION_SUBLANGUAGE_FILE_COVERAGE: true
|
||||||
CODEQL_ACTION_TEST_MODE: true
|
CODEQL_ACTION_TEST_MODE: true
|
||||||
|
|||||||
3
.github/workflows/__extractor-ram-threads.yml
generated
vendored
3
.github/workflows/__extractor-ram-threads.yml
generated
vendored
@@ -35,12 +35,13 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/actions/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
use-all-platform-bundle: 'false'
|
||||||
- name: Set environment variable for Swift enablement
|
- name: Set environment variable for Swift enablement
|
||||||
if: >-
|
if: >-
|
||||||
runner.os != 'Windows' && (
|
runner.os != 'Windows' && (
|
||||||
|
|||||||
27
.github/workflows/__go-custom-queries.yml
generated
vendored
27
.github/workflows/__go-custom-queries.yml
generated
vendored
@@ -25,12 +25,6 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-latest
|
|
||||||
version: stable-20220615
|
|
||||||
- os: macos-latest
|
|
||||||
version: stable-20220615
|
|
||||||
- os: windows-latest
|
|
||||||
version: stable-20220615
|
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: stable-20220908
|
version: stable-20220908
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
@@ -50,11 +44,23 @@ jobs:
|
|||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
version: stable-20230418
|
version: stable-20230418
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: cached
|
version: stable-v2.13.5
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: cached
|
version: stable-v2.13.5
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
version: cached
|
version: stable-v2.13.5
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: stable-v2.14.6
|
||||||
|
- os: macos-latest
|
||||||
|
version: stable-v2.14.6
|
||||||
|
- os: windows-latest
|
||||||
|
version: stable-v2.14.6
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: default
|
||||||
|
- os: macos-latest
|
||||||
|
version: default
|
||||||
|
- os: windows-latest
|
||||||
|
version: default
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: latest
|
version: latest
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
@@ -75,12 +81,13 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/actions/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
use-all-platform-bundle: 'false'
|
||||||
- name: Set environment variable for Swift enablement
|
- name: Set environment variable for Swift enablement
|
||||||
if: >-
|
if: >-
|
||||||
runner.os != 'Windows' && (
|
runner.os != 'Windows' && (
|
||||||
|
|||||||
96
.github/workflows/__go-indirect-tracing-workaround-diagnostic.yml
generated
vendored
Normal file
96
.github/workflows/__go-indirect-tracing-workaround-diagnostic.yml
generated
vendored
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
# Warning: This file is generated automatically, and should not be modified.
|
||||||
|
# Instead, please modify the template in the pr-checks directory and run:
|
||||||
|
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
|
||||||
|
# to regenerate this file.
|
||||||
|
|
||||||
|
name: 'PR Check - Go: diagnostic when Go is changed after init step'
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
GO111MODULE: auto
|
||||||
|
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- releases/v2
|
||||||
|
pull_request:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- synchronize
|
||||||
|
- reopened
|
||||||
|
- ready_for_review
|
||||||
|
workflow_dispatch: {}
|
||||||
|
jobs:
|
||||||
|
go-indirect-tracing-workaround-diagnostic:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: stable-v2.14.6
|
||||||
|
name: 'Go: diagnostic when Go is changed after init step'
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
security-events: write
|
||||||
|
timeout-minutes: 45
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Check out repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Prepare test
|
||||||
|
id: prepare-test
|
||||||
|
uses: ./.github/actions/prepare-test
|
||||||
|
with:
|
||||||
|
version: ${{ matrix.version }}
|
||||||
|
use-all-platform-bundle: 'false'
|
||||||
|
- name: Set environment variable for Swift enablement
|
||||||
|
if: >-
|
||||||
|
runner.os != 'Windows' && (
|
||||||
|
matrix.version == '20220908' ||
|
||||||
|
matrix.version == '20221211'
|
||||||
|
)
|
||||||
|
shell: bash
|
||||||
|
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||||
|
- uses: actions/setup-go@v4
|
||||||
|
with:
|
||||||
|
# We need a Go version that ships with statically linked binaries on Linux
|
||||||
|
go-version: '>=1.21.0'
|
||||||
|
- uses: ./../action/init
|
||||||
|
with:
|
||||||
|
languages: go
|
||||||
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
|
# Deliberately change Go after the `init` step
|
||||||
|
- uses: actions/setup-go@v4
|
||||||
|
with:
|
||||||
|
go-version: '1.20'
|
||||||
|
- name: Build code
|
||||||
|
shell: bash
|
||||||
|
run: go build main.go
|
||||||
|
- uses: ./../action/analyze
|
||||||
|
with:
|
||||||
|
output: ${{ runner.temp }}/results
|
||||||
|
upload-database: false
|
||||||
|
- name: Check diagnostic appears in SARIF
|
||||||
|
uses: actions/github-script@v6
|
||||||
|
env:
|
||||||
|
SARIF_PATH: ${{ runner.temp }}/results/go.sarif
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
|
const sarif = JSON.parse(fs.readFileSync(process.env['SARIF_PATH'], 'utf8'));
|
||||||
|
const run = sarif.runs[0];
|
||||||
|
|
||||||
|
const toolExecutionNotifications = run.invocations[0].toolExecutionNotifications;
|
||||||
|
const statusPageNotifications = toolExecutionNotifications.filter(n =>
|
||||||
|
n.descriptor.id === 'go/workflow/go-installed-after-codeql-init' && n.properties?.visibility?.statusPage
|
||||||
|
);
|
||||||
|
if (statusPageNotifications.length !== 1) {
|
||||||
|
core.setFailed(
|
||||||
|
'Expected exactly one status page reporting descriptor for this diagnostic in the ' +
|
||||||
|
`'runs[].invocations[].toolExecutionNotifications[]' SARIF property, but found ` +
|
||||||
|
`${statusPageNotifications.length}. All notification reporting descriptors: ` +
|
||||||
|
`${JSON.stringify(toolExecutionNotifications)}.`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
env:
|
||||||
|
CODEQL_ACTION_TEST_MODE: true
|
||||||
94
.github/workflows/__go-indirect-tracing-workaround.yml
generated
vendored
Normal file
94
.github/workflows/__go-indirect-tracing-workaround.yml
generated
vendored
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
# Warning: This file is generated automatically, and should not be modified.
|
||||||
|
# Instead, please modify the template in the pr-checks directory and run:
|
||||||
|
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
|
||||||
|
# to regenerate this file.
|
||||||
|
|
||||||
|
name: 'PR Check - Go: workaround for indirect tracing'
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
GO111MODULE: auto
|
||||||
|
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- releases/v2
|
||||||
|
pull_request:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- synchronize
|
||||||
|
- reopened
|
||||||
|
- ready_for_review
|
||||||
|
workflow_dispatch: {}
|
||||||
|
jobs:
|
||||||
|
go-indirect-tracing-workaround:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: stable-v2.14.6
|
||||||
|
name: 'Go: workaround for indirect tracing'
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
security-events: write
|
||||||
|
timeout-minutes: 45
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Check out repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Prepare test
|
||||||
|
id: prepare-test
|
||||||
|
uses: ./.github/actions/prepare-test
|
||||||
|
with:
|
||||||
|
version: ${{ matrix.version }}
|
||||||
|
use-all-platform-bundle: 'false'
|
||||||
|
- name: Set environment variable for Swift enablement
|
||||||
|
if: >-
|
||||||
|
runner.os != 'Windows' && (
|
||||||
|
matrix.version == '20220908' ||
|
||||||
|
matrix.version == '20221211'
|
||||||
|
)
|
||||||
|
shell: bash
|
||||||
|
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||||
|
- uses: actions/setup-go@v4
|
||||||
|
with:
|
||||||
|
# We need a Go version that ships with statically linked binaries on Linux
|
||||||
|
go-version: '>=1.21.0'
|
||||||
|
- uses: ./../action/init
|
||||||
|
with:
|
||||||
|
languages: go
|
||||||
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
|
- name: Build code
|
||||||
|
shell: bash
|
||||||
|
run: go build main.go
|
||||||
|
- uses: ./../action/analyze
|
||||||
|
with:
|
||||||
|
upload-database: false
|
||||||
|
- shell: bash
|
||||||
|
run: |
|
||||||
|
if [[ -z "${CODEQL_ACTION_GO_BINARY}" ]]; then
|
||||||
|
echo "Expected the workaround for indirect tracing of static binaries to trigger, but the" \
|
||||||
|
"CODEQL_ACTION_GO_BINARY environment variable is not set."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [[ ! -f "${CODEQL_ACTION_GO_BINARY}" ]]; then
|
||||||
|
echo "CODEQL_ACTION_GO_BINARY is set, but the corresponding script does not exist."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Once we start running Bash 4.2 in all environments, we can replace the
|
||||||
|
# `! -z` flag with the more elegant `-v` which confirms that the variable
|
||||||
|
# is actually unset and not potentially set to a blank value.
|
||||||
|
if [[ ! -z "${CODEQL_ACTION_DID_AUTOBUILD_GOLANG}" ]]; then
|
||||||
|
echo "Expected the Go autobuilder not to be run, but the" \
|
||||||
|
"CODEQL_ACTION_DID_AUTOBUILD_GOLANG environment variable was set."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
cd "$RUNNER_TEMP/codeql_databases"
|
||||||
|
if [[ ! -d go ]]; then
|
||||||
|
echo "Did not find a Go database"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
env:
|
||||||
|
CODEQL_ACTION_TEST_MODE: true
|
||||||
22
.github/workflows/__go-tracing-autobuilder.yml
generated
vendored
22
.github/workflows/__go-tracing-autobuilder.yml
generated
vendored
@@ -25,10 +25,6 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-latest
|
|
||||||
version: stable-20220615
|
|
||||||
- os: macos-latest
|
|
||||||
version: stable-20220615
|
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: stable-20220908
|
version: stable-20220908
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
@@ -42,9 +38,17 @@ jobs:
|
|||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: stable-20230418
|
version: stable-20230418
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: cached
|
version: stable-v2.13.5
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: cached
|
version: stable-v2.13.5
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: stable-v2.14.6
|
||||||
|
- os: macos-latest
|
||||||
|
version: stable-v2.14.6
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: default
|
||||||
|
- os: macos-latest
|
||||||
|
version: default
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: latest
|
version: latest
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
@@ -61,12 +65,13 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/actions/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
use-all-platform-bundle: 'false'
|
||||||
- name: Set environment variable for Swift enablement
|
- name: Set environment variable for Swift enablement
|
||||||
if: >-
|
if: >-
|
||||||
runner.os != 'Windows' && (
|
runner.os != 'Windows' && (
|
||||||
@@ -75,6 +80,9 @@ jobs:
|
|||||||
)
|
)
|
||||||
shell: bash
|
shell: bash
|
||||||
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||||
|
- uses: actions/setup-go@v4
|
||||||
|
with:
|
||||||
|
go-version: ~1.21.1
|
||||||
- uses: ./../action/init
|
- uses: ./../action/init
|
||||||
with:
|
with:
|
||||||
languages: go
|
languages: go
|
||||||
|
|||||||
22
.github/workflows/__go-tracing-custom-build-steps.yml
generated
vendored
22
.github/workflows/__go-tracing-custom-build-steps.yml
generated
vendored
@@ -25,10 +25,6 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-latest
|
|
||||||
version: stable-20220615
|
|
||||||
- os: macos-latest
|
|
||||||
version: stable-20220615
|
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: stable-20220908
|
version: stable-20220908
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
@@ -42,9 +38,17 @@ jobs:
|
|||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: stable-20230418
|
version: stable-20230418
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: cached
|
version: stable-v2.13.5
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: cached
|
version: stable-v2.13.5
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: stable-v2.14.6
|
||||||
|
- os: macos-latest
|
||||||
|
version: stable-v2.14.6
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: default
|
||||||
|
- os: macos-latest
|
||||||
|
version: default
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: latest
|
version: latest
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
@@ -61,12 +65,13 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/actions/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
use-all-platform-bundle: 'false'
|
||||||
- name: Set environment variable for Swift enablement
|
- name: Set environment variable for Swift enablement
|
||||||
if: >-
|
if: >-
|
||||||
runner.os != 'Windows' && (
|
runner.os != 'Windows' && (
|
||||||
@@ -75,6 +80,9 @@ jobs:
|
|||||||
)
|
)
|
||||||
shell: bash
|
shell: bash
|
||||||
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||||
|
- uses: actions/setup-go@v4
|
||||||
|
with:
|
||||||
|
go-version: ~1.21.1
|
||||||
- uses: ./../action/init
|
- uses: ./../action/init
|
||||||
with:
|
with:
|
||||||
languages: go
|
languages: go
|
||||||
|
|||||||
22
.github/workflows/__go-tracing-legacy-workflow.yml
generated
vendored
22
.github/workflows/__go-tracing-legacy-workflow.yml
generated
vendored
@@ -25,10 +25,6 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-latest
|
|
||||||
version: stable-20220615
|
|
||||||
- os: macos-latest
|
|
||||||
version: stable-20220615
|
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: stable-20220908
|
version: stable-20220908
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
@@ -42,9 +38,17 @@ jobs:
|
|||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: stable-20230418
|
version: stable-20230418
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: cached
|
version: stable-v2.13.5
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: cached
|
version: stable-v2.13.5
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: stable-v2.14.6
|
||||||
|
- os: macos-latest
|
||||||
|
version: stable-v2.14.6
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: default
|
||||||
|
- os: macos-latest
|
||||||
|
version: default
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: latest
|
version: latest
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
@@ -61,12 +65,13 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/actions/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
use-all-platform-bundle: 'false'
|
||||||
- name: Set environment variable for Swift enablement
|
- name: Set environment variable for Swift enablement
|
||||||
if: >-
|
if: >-
|
||||||
runner.os != 'Windows' && (
|
runner.os != 'Windows' && (
|
||||||
@@ -75,6 +80,9 @@ jobs:
|
|||||||
)
|
)
|
||||||
shell: bash
|
shell: bash
|
||||||
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||||
|
- uses: actions/setup-go@v4
|
||||||
|
with:
|
||||||
|
go-version: ~1.21.1
|
||||||
- uses: ./../action/init
|
- uses: ./../action/init
|
||||||
with:
|
with:
|
||||||
languages: go
|
languages: go
|
||||||
|
|||||||
9
.github/workflows/__init-with-registries.yml
generated
vendored
9
.github/workflows/__init-with-registries.yml
generated
vendored
@@ -26,11 +26,11 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: cached
|
version: default
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: cached
|
version: default
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
version: cached
|
version: default
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: latest
|
version: latest
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
@@ -52,12 +52,13 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/actions/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
use-all-platform-bundle: 'false'
|
||||||
- name: Set environment variable for Swift enablement
|
- name: Set environment variable for Swift enablement
|
||||||
if: >-
|
if: >-
|
||||||
runner.os != 'Windows' && (
|
runner.os != 'Windows' && (
|
||||||
|
|||||||
5
.github/workflows/__javascript-source-root.yml
generated
vendored
5
.github/workflows/__javascript-source-root.yml
generated
vendored
@@ -28,7 +28,7 @@ jobs:
|
|||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: latest
|
version: latest
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: cached
|
version: default
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: nightly-latest
|
version: nightly-latest
|
||||||
name: Custom source root
|
name: Custom source root
|
||||||
@@ -39,12 +39,13 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/actions/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
use-all-platform-bundle: 'false'
|
||||||
- name: Set environment variable for Swift enablement
|
- name: Set environment variable for Swift enablement
|
||||||
if: >-
|
if: >-
|
||||||
runner.os != 'Windows' && (
|
runner.os != 'Windows' && (
|
||||||
|
|||||||
69
.github/workflows/__language-aliases.yml
generated
vendored
Normal file
69
.github/workflows/__language-aliases.yml
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
# Warning: This file is generated automatically, and should not be modified.
|
||||||
|
# Instead, please modify the template in the pr-checks directory and run:
|
||||||
|
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
|
||||||
|
# to regenerate this file.
|
||||||
|
|
||||||
|
name: PR Check - Language aliases
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
GO111MODULE: auto
|
||||||
|
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- releases/v2
|
||||||
|
pull_request:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- synchronize
|
||||||
|
- reopened
|
||||||
|
- ready_for_review
|
||||||
|
workflow_dispatch: {}
|
||||||
|
jobs:
|
||||||
|
language-aliases:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: latest
|
||||||
|
name: Language aliases
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
security-events: write
|
||||||
|
timeout-minutes: 45
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Check out repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Prepare test
|
||||||
|
id: prepare-test
|
||||||
|
uses: ./.github/actions/prepare-test
|
||||||
|
with:
|
||||||
|
version: ${{ matrix.version }}
|
||||||
|
use-all-platform-bundle: 'false'
|
||||||
|
- name: Set environment variable for Swift enablement
|
||||||
|
if: >-
|
||||||
|
runner.os != 'Windows' && (
|
||||||
|
matrix.version == '20220908' ||
|
||||||
|
matrix.version == '20221211'
|
||||||
|
)
|
||||||
|
shell: bash
|
||||||
|
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||||
|
- uses: ./../action/init
|
||||||
|
with:
|
||||||
|
languages: C#,java-kotlin,swift,typescript
|
||||||
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
|
|
||||||
|
- name: Check languages
|
||||||
|
run: |
|
||||||
|
expected_languages="csharp,java,swift,javascript"
|
||||||
|
actual_languages=$(jq -r '.languages | join(",")' "$RUNNER_TEMP"/config)
|
||||||
|
|
||||||
|
if [ "$expected_languages" != "$actual_languages" ]; then
|
||||||
|
echo "Resolved languages did not match expected list. " \
|
||||||
|
"Expected languages: $expected_languages. Actual languages: $actual_languages."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
env:
|
||||||
|
CODEQL_ACTION_TEST_MODE: true
|
||||||
146
.github/workflows/__ml-powered-queries.yml
generated
vendored
146
.github/workflows/__ml-powered-queries.yml
generated
vendored
@@ -1,146 +0,0 @@
|
|||||||
# Warning: This file is generated automatically, and should not be modified.
|
|
||||||
# Instead, please modify the template in the pr-checks directory and run:
|
|
||||||
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
|
|
||||||
# to regenerate this file.
|
|
||||||
|
|
||||||
name: PR Check - ML-powered queries
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
GO111MODULE: auto
|
|
||||||
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- releases/v2
|
|
||||||
pull_request:
|
|
||||||
types:
|
|
||||||
- opened
|
|
||||||
- synchronize
|
|
||||||
- reopened
|
|
||||||
- ready_for_review
|
|
||||||
workflow_dispatch: {}
|
|
||||||
jobs:
|
|
||||||
ml-powered-queries:
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- os: ubuntu-latest
|
|
||||||
version: stable-20220615
|
|
||||||
- os: macos-latest
|
|
||||||
version: stable-20220615
|
|
||||||
- os: windows-latest
|
|
||||||
version: stable-20220615
|
|
||||||
- os: ubuntu-latest
|
|
||||||
version: stable-20220908
|
|
||||||
- os: macos-latest
|
|
||||||
version: stable-20220908
|
|
||||||
- os: windows-latest
|
|
||||||
version: stable-20220908
|
|
||||||
- os: ubuntu-latest
|
|
||||||
version: stable-20221211
|
|
||||||
- os: macos-latest
|
|
||||||
version: stable-20221211
|
|
||||||
- os: windows-latest
|
|
||||||
version: stable-20221211
|
|
||||||
- os: ubuntu-latest
|
|
||||||
version: stable-20230418
|
|
||||||
- os: macos-latest
|
|
||||||
version: stable-20230418
|
|
||||||
- os: windows-latest
|
|
||||||
version: stable-20230418
|
|
||||||
- os: ubuntu-latest
|
|
||||||
version: cached
|
|
||||||
- os: macos-latest
|
|
||||||
version: cached
|
|
||||||
- os: windows-latest
|
|
||||||
version: cached
|
|
||||||
- os: ubuntu-latest
|
|
||||||
version: latest
|
|
||||||
- os: macos-latest
|
|
||||||
version: latest
|
|
||||||
- os: windows-latest
|
|
||||||
version: latest
|
|
||||||
- os: ubuntu-latest
|
|
||||||
version: nightly-latest
|
|
||||||
- os: macos-latest
|
|
||||||
version: nightly-latest
|
|
||||||
- os: windows-latest
|
|
||||||
version: nightly-latest
|
|
||||||
name: ML-powered queries
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
security-events: write
|
|
||||||
timeout-minutes: 45
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- name: Check out repository
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Prepare test
|
|
||||||
id: prepare-test
|
|
||||||
uses: ./.github/actions/prepare-test
|
|
||||||
with:
|
|
||||||
version: ${{ matrix.version }}
|
|
||||||
- name: Set environment variable for Swift enablement
|
|
||||||
if: >-
|
|
||||||
runner.os != 'Windows' && (
|
|
||||||
matrix.version == '20220908' ||
|
|
||||||
matrix.version == '20221211'
|
|
||||||
)
|
|
||||||
shell: bash
|
|
||||||
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
|
||||||
- uses: ./../action/init
|
|
||||||
with:
|
|
||||||
languages: javascript
|
|
||||||
queries: security-extended
|
|
||||||
source-root: ./../action/tests/ml-powered-queries-repo
|
|
||||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
|
||||||
|
|
||||||
- uses: ./../action/analyze
|
|
||||||
with:
|
|
||||||
output: ${{ runner.temp }}/results
|
|
||||||
upload-database: false
|
|
||||||
|
|
||||||
- name: Upload SARIF
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: ml-powered-queries-${{ matrix.os }}-${{ matrix.version }}.sarif.json
|
|
||||||
path: ${{ runner.temp }}/results/javascript.sarif
|
|
||||||
retention-days: 7
|
|
||||||
|
|
||||||
- name: Check sarif
|
|
||||||
uses: ./../action/.github/actions/check-sarif
|
|
||||||
with:
|
|
||||||
sarif-file: ${{ runner.temp }}/results/javascript.sarif
|
|
||||||
queries-run:
|
|
||||||
js/ml-powered/nosql-injection,js/ml-powered/path-injection,js/ml-powered/sql-injection,js/ml-powered/xss
|
|
||||||
queries-not-run: foo,bar
|
|
||||||
|
|
||||||
- name: Check results
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
cd "$RUNNER_TEMP/results"
|
|
||||||
# We should run at least the ML-powered queries in `expected_rules`.
|
|
||||||
expected_rules="js/ml-powered/nosql-injection js/ml-powered/path-injection js/ml-powered/sql-injection js/ml-powered/xss"
|
|
||||||
|
|
||||||
for rule in ${expected_rules}; do
|
|
||||||
found_rule=$(jq --arg rule "${rule}" '[.runs[0].tool.extensions[].rules | select(. != null) |
|
|
||||||
flatten | .[].id] | any(. == $rule)' javascript.sarif)
|
|
||||||
echo "Did find rule '${rule}': ${found_rule}"
|
|
||||||
if [[ "${found_rule}" != "true" ]]; then
|
|
||||||
echo "Expected SARIF output to contain rule '${rule}', but found no such rule."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# We should have at least one alert from an ML-powered query.
|
|
||||||
num_alerts=$(jq '[.runs[0].results[] |
|
|
||||||
select(.properties.score != null and (.rule.id | startswith("js/ml-powered/")))] | length' \
|
|
||||||
javascript.sarif)
|
|
||||||
echo "Found ${num_alerts} alerts from ML-powered queries.";
|
|
||||||
if [[ "${num_alerts}" -eq 0 ]]; then
|
|
||||||
echo "Expected to find at least one alert from an ML-powered query but found ${num_alerts}."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
env:
|
|
||||||
CODEQL_ACTION_TEST_MODE: true
|
|
||||||
19
.github/workflows/__multi-language-autodetect.yml
generated
vendored
19
.github/workflows/__multi-language-autodetect.yml
generated
vendored
@@ -25,10 +25,6 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-latest
|
|
||||||
version: stable-20220615
|
|
||||||
- os: macos-latest
|
|
||||||
version: stable-20220615
|
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: stable-20220908
|
version: stable-20220908
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
@@ -42,9 +38,17 @@ jobs:
|
|||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: stable-20230418
|
version: stable-20230418
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: cached
|
version: stable-v2.13.5
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: cached
|
version: stable-v2.13.5
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: stable-v2.14.6
|
||||||
|
- os: macos-latest
|
||||||
|
version: stable-v2.14.6
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: default
|
||||||
|
- os: macos-latest
|
||||||
|
version: default
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: latest
|
version: latest
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
@@ -61,12 +65,13 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/actions/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
use-all-platform-bundle: 'false'
|
||||||
- name: Set environment variable for Swift enablement
|
- name: Set environment variable for Swift enablement
|
||||||
if: >-
|
if: >-
|
||||||
runner.os != 'Windows' && (
|
runner.os != 'Windows' && (
|
||||||
|
|||||||
9
.github/workflows/__packaging-codescanning-config-inputs-js.yml
generated
vendored
9
.github/workflows/__packaging-codescanning-config-inputs-js.yml
generated
vendored
@@ -32,11 +32,11 @@ jobs:
|
|||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
version: latest
|
version: latest
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: cached
|
version: default
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: cached
|
version: default
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
version: cached
|
version: default
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: nightly-latest
|
version: nightly-latest
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
@@ -51,12 +51,13 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/actions/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
use-all-platform-bundle: 'false'
|
||||||
- name: Set environment variable for Swift enablement
|
- name: Set environment variable for Swift enablement
|
||||||
if: >-
|
if: >-
|
||||||
runner.os != 'Windows' && (
|
runner.os != 'Windows' && (
|
||||||
|
|||||||
9
.github/workflows/__packaging-config-inputs-js.yml
generated
vendored
9
.github/workflows/__packaging-config-inputs-js.yml
generated
vendored
@@ -32,11 +32,11 @@ jobs:
|
|||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
version: latest
|
version: latest
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: cached
|
version: default
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: cached
|
version: default
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
version: cached
|
version: default
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: nightly-latest
|
version: nightly-latest
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
@@ -51,12 +51,13 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/actions/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
use-all-platform-bundle: 'false'
|
||||||
- name: Set environment variable for Swift enablement
|
- name: Set environment variable for Swift enablement
|
||||||
if: >-
|
if: >-
|
||||||
runner.os != 'Windows' && (
|
runner.os != 'Windows' && (
|
||||||
|
|||||||
9
.github/workflows/__packaging-config-js.yml
generated
vendored
9
.github/workflows/__packaging-config-js.yml
generated
vendored
@@ -32,11 +32,11 @@ jobs:
|
|||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
version: latest
|
version: latest
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: cached
|
version: default
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: cached
|
version: default
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
version: cached
|
version: default
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: nightly-latest
|
version: nightly-latest
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
@@ -51,12 +51,13 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/actions/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
use-all-platform-bundle: 'false'
|
||||||
- name: Set environment variable for Swift enablement
|
- name: Set environment variable for Swift enablement
|
||||||
if: >-
|
if: >-
|
||||||
runner.os != 'Windows' && (
|
runner.os != 'Windows' && (
|
||||||
|
|||||||
9
.github/workflows/__packaging-inputs-js.yml
generated
vendored
9
.github/workflows/__packaging-inputs-js.yml
generated
vendored
@@ -32,11 +32,11 @@ jobs:
|
|||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
version: latest
|
version: latest
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: cached
|
version: default
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: cached
|
version: default
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
version: cached
|
version: default
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: nightly-latest
|
version: nightly-latest
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
@@ -51,12 +51,13 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/actions/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
use-all-platform-bundle: 'false'
|
||||||
- name: Set environment variable for Swift enablement
|
- name: Set environment variable for Swift enablement
|
||||||
if: >-
|
if: >-
|
||||||
runner.os != 'Windows' && (
|
runner.os != 'Windows' && (
|
||||||
|
|||||||
27
.github/workflows/__remote-config.yml
generated
vendored
27
.github/workflows/__remote-config.yml
generated
vendored
@@ -25,12 +25,6 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-latest
|
|
||||||
version: stable-20220615
|
|
||||||
- os: macos-latest
|
|
||||||
version: stable-20220615
|
|
||||||
- os: windows-latest
|
|
||||||
version: stable-20220615
|
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: stable-20220908
|
version: stable-20220908
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
@@ -50,11 +44,23 @@ jobs:
|
|||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
version: stable-20230418
|
version: stable-20230418
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: cached
|
version: stable-v2.13.5
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: cached
|
version: stable-v2.13.5
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
version: cached
|
version: stable-v2.13.5
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: stable-v2.14.6
|
||||||
|
- os: macos-latest
|
||||||
|
version: stable-v2.14.6
|
||||||
|
- os: windows-latest
|
||||||
|
version: stable-v2.14.6
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: default
|
||||||
|
- os: macos-latest
|
||||||
|
version: default
|
||||||
|
- os: windows-latest
|
||||||
|
version: default
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: latest
|
version: latest
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
@@ -75,12 +81,13 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/actions/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
use-all-platform-bundle: 'false'
|
||||||
- name: Set environment variable for Swift enablement
|
- name: Set environment variable for Swift enablement
|
||||||
if: >-
|
if: >-
|
||||||
runner.os != 'Windows' && (
|
runner.os != 'Windows' && (
|
||||||
|
|||||||
45
.github/workflows/__resolve-environment-action.yml
generated
vendored
45
.github/workflows/__resolve-environment-action.yml
generated
vendored
@@ -31,6 +31,24 @@ jobs:
|
|||||||
version: stable-v2.13.4
|
version: stable-v2.13.4
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
version: stable-v2.13.4
|
version: stable-v2.13.4
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: default
|
||||||
|
- os: macos-latest
|
||||||
|
version: default
|
||||||
|
- os: windows-latest
|
||||||
|
version: default
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: latest
|
||||||
|
- os: macos-latest
|
||||||
|
version: latest
|
||||||
|
- os: windows-latest
|
||||||
|
version: latest
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: nightly-latest
|
||||||
|
- os: macos-latest
|
||||||
|
version: nightly-latest
|
||||||
|
- os: windows-latest
|
||||||
|
version: nightly-latest
|
||||||
name: Resolve environment
|
name: Resolve environment
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
@@ -39,12 +57,13 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/actions/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
use-all-platform-bundle: 'false'
|
||||||
- name: Set environment variable for Swift enablement
|
- name: Set environment variable for Swift enablement
|
||||||
if: >-
|
if: >-
|
||||||
runner.os != 'Windows' && (
|
runner.os != 'Windows' && (
|
||||||
@@ -55,16 +74,30 @@ jobs:
|
|||||||
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||||
- uses: ./../action/init
|
- uses: ./../action/init
|
||||||
with:
|
with:
|
||||||
languages: go
|
languages: ${{ matrix.version == 'stable-v2.13.4' && 'go' || 'go,javascript-typescript'
|
||||||
|
}}
|
||||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
|
|
||||||
- uses: ./../action/resolve-environment
|
- name: Resolve environment for Go
|
||||||
id: resolve-environment
|
uses: ./../action/resolve-environment
|
||||||
|
id: resolve-environment-go
|
||||||
with:
|
with:
|
||||||
language: go
|
language: go
|
||||||
|
|
||||||
- name: Fail if no Go configuration was returned
|
- name: Fail if Go configuration missing
|
||||||
if: (!fromJSON(steps.resolve-environment.outputs.environment).configuration.go)
|
if: (!fromJSON(steps.resolve-environment-go.outputs.environment).configuration.go)
|
||||||
|
run: exit 1
|
||||||
|
|
||||||
|
- name: Resolve environment for JavaScript/TypeScript
|
||||||
|
if: matrix.version != 'stable-v2.13.4'
|
||||||
|
uses: ./../action/resolve-environment
|
||||||
|
id: resolve-environment-js
|
||||||
|
with:
|
||||||
|
language: javascript-typescript
|
||||||
|
|
||||||
|
- name: Fail if JavaScript/TypeScript configuration present
|
||||||
|
if: matrix.version != 'stable-v2.13.4' &&
|
||||||
|
fromJSON(steps.resolve-environment-js.outputs.environment).configuration.javascript
|
||||||
run: exit 1
|
run: exit 1
|
||||||
env:
|
env:
|
||||||
CODEQL_ACTION_TEST_MODE: true
|
CODEQL_ACTION_TEST_MODE: true
|
||||||
|
|||||||
5
.github/workflows/__rubocop-multi-language.yml
generated
vendored
5
.github/workflows/__rubocop-multi-language.yml
generated
vendored
@@ -26,7 +26,7 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: cached
|
version: default
|
||||||
name: RuboCop multi-language
|
name: RuboCop multi-language
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
@@ -35,12 +35,13 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/actions/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
use-all-platform-bundle: 'false'
|
||||||
- name: Set environment variable for Swift enablement
|
- name: Set environment variable for Swift enablement
|
||||||
if: >-
|
if: >-
|
||||||
runner.os != 'Windows' && (
|
runner.os != 'Windows' && (
|
||||||
|
|||||||
7
.github/workflows/__ruby.yml
generated
vendored
7
.github/workflows/__ruby.yml
generated
vendored
@@ -30,9 +30,9 @@ jobs:
|
|||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: latest
|
version: latest
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: cached
|
version: default
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: cached
|
version: default
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: nightly-latest
|
version: nightly-latest
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
@@ -45,12 +45,13 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/actions/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
use-all-platform-bundle: 'false'
|
||||||
- name: Set environment variable for Swift enablement
|
- name: Set environment variable for Swift enablement
|
||||||
if: >-
|
if: >-
|
||||||
runner.os != 'Windows' && (
|
runner.os != 'Windows' && (
|
||||||
|
|||||||
19
.github/workflows/__scaling-reserved-ram.yml
generated
vendored
19
.github/workflows/__scaling-reserved-ram.yml
generated
vendored
@@ -25,10 +25,6 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-latest
|
|
||||||
version: stable-20220615
|
|
||||||
- os: macos-latest
|
|
||||||
version: stable-20220615
|
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: stable-20220908
|
version: stable-20220908
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
@@ -42,9 +38,17 @@ jobs:
|
|||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: stable-20230418
|
version: stable-20230418
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: cached
|
version: stable-v2.13.5
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: cached
|
version: stable-v2.13.5
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: stable-v2.14.6
|
||||||
|
- os: macos-latest
|
||||||
|
version: stable-v2.14.6
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: default
|
||||||
|
- os: macos-latest
|
||||||
|
version: default
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: latest
|
version: latest
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
@@ -61,12 +65,13 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/actions/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
use-all-platform-bundle: 'false'
|
||||||
- name: Set environment variable for Swift enablement
|
- name: Set environment variable for Swift enablement
|
||||||
if: >-
|
if: >-
|
||||||
runner.os != 'Windows' && (
|
runner.os != 'Windows' && (
|
||||||
|
|||||||
7
.github/workflows/__split-workflow.yml
generated
vendored
7
.github/workflows/__split-workflow.yml
generated
vendored
@@ -30,9 +30,9 @@ jobs:
|
|||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: latest
|
version: latest
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: cached
|
version: default
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: cached
|
version: default
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: nightly-latest
|
version: nightly-latest
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
@@ -45,12 +45,13 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/actions/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
use-all-platform-bundle: 'false'
|
||||||
- name: Set environment variable for Swift enablement
|
- name: Set environment variable for Swift enablement
|
||||||
if: >-
|
if: >-
|
||||||
runner.os != 'Windows' && (
|
runner.os != 'Windows' && (
|
||||||
|
|||||||
7
.github/workflows/__submit-sarif-failure.yml
generated
vendored
7
.github/workflows/__submit-sarif-failure.yml
generated
vendored
@@ -28,7 +28,7 @@ jobs:
|
|||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: latest
|
version: latest
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: cached
|
version: default
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: nightly-latest
|
version: nightly-latest
|
||||||
name: Submit SARIF after failure
|
name: Submit SARIF after failure
|
||||||
@@ -39,12 +39,13 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/actions/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
use-all-platform-bundle: 'false'
|
||||||
- name: Set environment variable for Swift enablement
|
- name: Set environment variable for Swift enablement
|
||||||
if: >-
|
if: >-
|
||||||
runner.os != 'Windows' && (
|
runner.os != 'Windows' && (
|
||||||
@@ -53,7 +54,7 @@ jobs:
|
|||||||
)
|
)
|
||||||
shell: bash
|
shell: bash
|
||||||
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: ./init
|
- uses: ./init
|
||||||
with:
|
with:
|
||||||
languages: javascript
|
languages: javascript
|
||||||
|
|||||||
7
.github/workflows/__swift-custom-build.yml
generated
vendored
7
.github/workflows/__swift-custom-build.yml
generated
vendored
@@ -30,9 +30,9 @@ jobs:
|
|||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: latest
|
version: latest
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: cached
|
version: default
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: cached
|
version: default
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: nightly-latest
|
version: nightly-latest
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
@@ -45,12 +45,13 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/actions/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
use-all-platform-bundle: 'false'
|
||||||
- name: Set environment variable for Swift enablement
|
- name: Set environment variable for Swift enablement
|
||||||
if: >-
|
if: >-
|
||||||
runner.os != 'Windows' && (
|
runner.os != 'Windows' && (
|
||||||
|
|||||||
3
.github/workflows/__test-autobuild-working-dir.yml
generated
vendored
3
.github/workflows/__test-autobuild-working-dir.yml
generated
vendored
@@ -35,12 +35,13 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/actions/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
use-all-platform-bundle: 'false'
|
||||||
- name: Set environment variable for Swift enablement
|
- name: Set environment variable for Swift enablement
|
||||||
if: >-
|
if: >-
|
||||||
runner.os != 'Windows' && (
|
runner.os != 'Windows' && (
|
||||||
|
|||||||
5
.github/workflows/__test-local-codeql.yml
generated
vendored
5
.github/workflows/__test-local-codeql.yml
generated
vendored
@@ -35,12 +35,13 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/actions/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
use-all-platform-bundle: 'false'
|
||||||
- name: Set environment variable for Swift enablement
|
- name: Set environment variable for Swift enablement
|
||||||
if: >-
|
if: >-
|
||||||
runner.os != 'Windows' && (
|
runner.os != 'Windows' && (
|
||||||
@@ -58,7 +59,7 @@ jobs:
|
|||||||
- id: init
|
- id: init
|
||||||
uses: ./../action/init
|
uses: ./../action/init
|
||||||
with:
|
with:
|
||||||
tools: ./codeql-bundle.tar.gz
|
tools: ./codeql-bundle-linux64.tar.gz
|
||||||
- uses: ./../action/.github/actions/setup-swift
|
- uses: ./../action/.github/actions/setup-swift
|
||||||
with:
|
with:
|
||||||
codeql-path: ${{ steps.init.outputs.codeql-path }}
|
codeql-path: ${{ steps.init.outputs.codeql-path }}
|
||||||
|
|||||||
3
.github/workflows/__test-proxy.yml
generated
vendored
3
.github/workflows/__test-proxy.yml
generated
vendored
@@ -35,12 +35,13 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/actions/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
use-all-platform-bundle: 'false'
|
||||||
- name: Set environment variable for Swift enablement
|
- name: Set environment variable for Swift enablement
|
||||||
if: >-
|
if: >-
|
||||||
runner.os != 'Windows' && (
|
runner.os != 'Windows' && (
|
||||||
|
|||||||
11
.github/workflows/__unset-environment.yml
generated
vendored
11
.github/workflows/__unset-environment.yml
generated
vendored
@@ -25,8 +25,6 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-latest
|
|
||||||
version: stable-20220615
|
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: stable-20220908
|
version: stable-20220908
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
@@ -34,7 +32,11 @@ jobs:
|
|||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: stable-20230418
|
version: stable-20230418
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: cached
|
version: stable-v2.13.5
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: stable-v2.14.6
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: default
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: latest
|
version: latest
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
@@ -47,12 +49,13 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/actions/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
use-all-platform-bundle: 'false'
|
||||||
- name: Set environment variable for Swift enablement
|
- name: Set environment variable for Swift enablement
|
||||||
if: >-
|
if: >-
|
||||||
runner.os != 'Windows' && (
|
runner.os != 'Windows' && (
|
||||||
|
|||||||
45
.github/workflows/__upload-ref-sha-input.yml
generated
vendored
45
.github/workflows/__upload-ref-sha-input.yml
generated
vendored
@@ -26,47 +26,11 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: stable-20220615
|
version: default
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: stable-20220615
|
version: default
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
version: stable-20220615
|
version: default
|
||||||
- os: ubuntu-latest
|
|
||||||
version: stable-20220908
|
|
||||||
- os: macos-latest
|
|
||||||
version: stable-20220908
|
|
||||||
- os: windows-latest
|
|
||||||
version: stable-20220908
|
|
||||||
- os: ubuntu-latest
|
|
||||||
version: stable-20221211
|
|
||||||
- os: macos-latest
|
|
||||||
version: stable-20221211
|
|
||||||
- os: windows-latest
|
|
||||||
version: stable-20221211
|
|
||||||
- os: ubuntu-latest
|
|
||||||
version: stable-20230418
|
|
||||||
- os: macos-latest
|
|
||||||
version: stable-20230418
|
|
||||||
- os: windows-latest
|
|
||||||
version: stable-20230418
|
|
||||||
- os: ubuntu-latest
|
|
||||||
version: cached
|
|
||||||
- os: macos-latest
|
|
||||||
version: cached
|
|
||||||
- os: windows-latest
|
|
||||||
version: cached
|
|
||||||
- os: ubuntu-latest
|
|
||||||
version: latest
|
|
||||||
- os: macos-latest
|
|
||||||
version: latest
|
|
||||||
- os: windows-latest
|
|
||||||
version: latest
|
|
||||||
- os: ubuntu-latest
|
|
||||||
version: nightly-latest
|
|
||||||
- os: macos-latest
|
|
||||||
version: nightly-latest
|
|
||||||
- os: windows-latest
|
|
||||||
version: nightly-latest
|
|
||||||
name: "Upload-sarif: 'ref' and 'sha' from inputs"
|
name: "Upload-sarif: 'ref' and 'sha' from inputs"
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
@@ -75,12 +39,13 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/actions/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
use-all-platform-bundle: 'false'
|
||||||
- name: Set environment variable for Swift enablement
|
- name: Set environment variable for Swift enablement
|
||||||
if: >-
|
if: >-
|
||||||
runner.os != 'Windows' && (
|
runner.os != 'Windows' && (
|
||||||
|
|||||||
29
.github/workflows/__with-checkout-path.yml
generated
vendored
29
.github/workflows/__with-checkout-path.yml
generated
vendored
@@ -25,12 +25,6 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-latest
|
|
||||||
version: stable-20220615
|
|
||||||
- os: macos-latest
|
|
||||||
version: stable-20220615
|
|
||||||
- os: windows-latest
|
|
||||||
version: stable-20220615
|
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: stable-20220908
|
version: stable-20220908
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
@@ -50,11 +44,23 @@ jobs:
|
|||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
version: stable-20230418
|
version: stable-20230418
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: cached
|
version: stable-v2.13.5
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: cached
|
version: stable-v2.13.5
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
version: cached
|
version: stable-v2.13.5
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: stable-v2.14.6
|
||||||
|
- os: macos-latest
|
||||||
|
version: stable-v2.14.6
|
||||||
|
- os: windows-latest
|
||||||
|
version: stable-v2.14.6
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: default
|
||||||
|
- os: macos-latest
|
||||||
|
version: default
|
||||||
|
- os: windows-latest
|
||||||
|
version: default
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: latest
|
version: latest
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
@@ -75,12 +81,13 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/actions/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
use-all-platform-bundle: 'false'
|
||||||
- name: Set environment variable for Swift enablement
|
- name: Set environment variable for Swift enablement
|
||||||
if: >-
|
if: >-
|
||||||
runner.os != 'Windows' && (
|
runner.os != 'Windows' && (
|
||||||
@@ -89,7 +96,7 @@ jobs:
|
|||||||
)
|
)
|
||||||
shell: bash
|
shell: bash
|
||||||
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
ref: 474bbf07f9247ffe1856c6a0f94aeeb10e7afee6
|
ref: 474bbf07f9247ffe1856c6a0f94aeeb10e7afee6
|
||||||
path: x/y/z/some-path
|
path: x/y/z/some-path
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout CodeQL Action
|
- name: Checkout CodeQL Action
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Check Expected Release Files
|
- name: Check Expected Release Files
|
||||||
run: |
|
run: |
|
||||||
bundle_version="$(cat "./src/defaults.json" | jq -r ".bundleVersion")"
|
bundle_version="$(cat "./src/defaults.json" | jq -r ".bundleVersion")"
|
||||||
|
|||||||
6
.github/workflows/codeql.yml
vendored
6
.github/workflows/codeql.yml
vendored
@@ -26,7 +26,7 @@ jobs:
|
|||||||
security-events: write
|
security-events: write
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Init with default CodeQL bundle from the VM image
|
- name: Init with default CodeQL bundle from the VM image
|
||||||
id: init-default
|
id: init-default
|
||||||
uses: ./init
|
uses: ./init
|
||||||
@@ -73,7 +73,7 @@ jobs:
|
|||||||
needs: [check-codeql-versions]
|
needs: [check-codeql-versions]
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest,windows-latest,macos-latest]
|
os: [ubuntu-20.04,ubuntu-22.04,windows-2019,windows-2022,macos-11,macos-12,macos-13]
|
||||||
tools: ${{ fromJson(needs.check-codeql-versions.outputs.versions) }}
|
tools: ${{ fromJson(needs.check-codeql-versions.outputs.versions) }}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: ./init
|
uses: ./init
|
||||||
id: init
|
id: init
|
||||||
|
|||||||
@@ -30,9 +30,9 @@ jobs:
|
|||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: latest
|
version: latest
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: cached
|
version: default
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: cached
|
version: default
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: nightly-latest
|
version: nightly-latest
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
@@ -44,7 +44,7 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/actions/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ jobs:
|
|||||||
- name: Dump GitHub event
|
- name: Dump GitHub event
|
||||||
run: cat "${GITHUB_EVENT_PATH}"
|
run: cat "${GITHUB_EVENT_PATH}"
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/actions/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
|
|||||||
11
.github/workflows/debug-artifacts.yml
vendored
11
.github/workflows/debug-artifacts.yml
vendored
@@ -25,11 +25,12 @@ jobs:
|
|||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
- macos-latest
|
- macos-latest
|
||||||
version:
|
version:
|
||||||
- stable-20220615
|
|
||||||
- stable-20220908
|
- stable-20220908
|
||||||
- stable-20221211
|
- stable-20221211
|
||||||
- stable-20230418
|
- stable-20230418
|
||||||
- cached
|
- stable-v2.13.5
|
||||||
|
- stable-v2.14.6
|
||||||
|
- default
|
||||||
- latest
|
- latest
|
||||||
- nightly-latest
|
- nightly-latest
|
||||||
name: Upload debug artifacts
|
name: Upload debug artifacts
|
||||||
@@ -39,7 +40,7 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/actions/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
@@ -74,11 +75,11 @@ jobs:
|
|||||||
- name: Check expected artifacts exist
|
- name: Check expected artifacts exist
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
VERSIONS="stable-20220615 stable-20220908 stable-20221211 stable-20230418 cached latest nightly-latest"
|
VERSIONS="stable-20220908 stable-20221211 stable-20230418 stable-v2.13.5 stable-v2.14.6 default latest nightly-latest"
|
||||||
LANGUAGES="cpp csharp go java javascript python"
|
LANGUAGES="cpp csharp go java javascript python"
|
||||||
for version in $VERSIONS; do
|
for version in $VERSIONS; do
|
||||||
for os in ubuntu-latest macos-latest; do
|
for os in ubuntu-latest macos-latest; do
|
||||||
pushd "./my-debug-artifacts-$os-$version"
|
pushd "./my-debug-artifacts-$os-${version//./}"
|
||||||
echo "Artifacts from version $version on $os:"
|
echo "Artifacts from version $version on $os:"
|
||||||
for language in $LANGUAGES; do
|
for language in $LANGUAGES; do
|
||||||
echo "- Checking $language"
|
echo "- Checking $language"
|
||||||
|
|||||||
2
.github/workflows/expected-queries-runs.yml
vendored
2
.github/workflows/expected-queries-runs.yml
vendored
@@ -22,7 +22,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/actions/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
|
|||||||
2
.github/workflows/post-release-mergeback.yml
vendored
2
.github/workflows/post-release-mergeback.yml
vendored
@@ -35,7 +35,7 @@ jobs:
|
|||||||
GITHUB_CONTEXT: '${{ toJson(github) }}'
|
GITHUB_CONTEXT: '${{ toJson(github) }}'
|
||||||
run: echo "${GITHUB_CONTEXT}"
|
run: echo "${GITHUB_CONTEXT}"
|
||||||
|
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v3
|
||||||
|
|
||||||
- name: Update git config
|
- name: Update git config
|
||||||
|
|||||||
8
.github/workflows/pr-checks.yml
vendored
8
.github/workflows/pr-checks.yml
vendored
@@ -17,7 +17,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Lint
|
- name: Lint
|
||||||
run: npm run-script lint
|
run: npm run-script lint
|
||||||
@@ -31,7 +31,7 @@ jobs:
|
|||||||
timeout-minutes: 45
|
timeout-minutes: 45
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Check node modules up to date
|
- name: Check node modules up to date
|
||||||
run: .github/workflows/script/check-node-modules.sh
|
run: .github/workflows/script/check-node-modules.sh
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v4
|
uses: actions/setup-python@v4
|
||||||
@@ -69,7 +69,7 @@ jobs:
|
|||||||
timeout-minutes: 45
|
timeout-minutes: 45
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: npm test
|
- name: npm test
|
||||||
run: |
|
run: |
|
||||||
# Run any commands referenced in package.json using Bash, otherwise
|
# Run any commands referenced in package.json using Bash, otherwise
|
||||||
|
|||||||
6
.github/workflows/python-deps.yml
vendored
6
.github/workflows/python-deps.yml
vendored
@@ -37,7 +37,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: ./init
|
uses: ./init
|
||||||
@@ -84,7 +84,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: ./init
|
uses: ./init
|
||||||
@@ -137,7 +137,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- uses: actions/setup-python@v4
|
- uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
|
|||||||
41
.github/workflows/python312-windows.yml
vendored
Normal file
41
.github/workflows/python312-windows.yml
vendored
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
name: Test that the workaround for python 3.12 on windows works
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main, releases/v2]
|
||||||
|
pull_request:
|
||||||
|
# Run checks on reopened draft PRs to support triggering PR checks on draft PRs that were opened
|
||||||
|
# by other workflows.
|
||||||
|
types: [opened, synchronize, reopened, ready_for_review]
|
||||||
|
schedule:
|
||||||
|
# Weekly on Monday.
|
||||||
|
- cron: '0 0 * * 1'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test-setup-python-scripts:
|
||||||
|
timeout-minutes: 45
|
||||||
|
runs-on: windows-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: 3.12
|
||||||
|
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Prepare test
|
||||||
|
uses: ./.github/actions/prepare-test
|
||||||
|
with:
|
||||||
|
version: default
|
||||||
|
|
||||||
|
- name: Initialize CodeQL
|
||||||
|
uses: ./../action/init
|
||||||
|
with:
|
||||||
|
tools: latest
|
||||||
|
languages: python
|
||||||
|
|
||||||
|
- name: Analyze
|
||||||
|
uses: ./../action/analyze
|
||||||
|
with:
|
||||||
|
upload-database: false
|
||||||
2
.github/workflows/query-filters.yml
vendored
2
.github/workflows/query-filters.yml
vendored
@@ -20,7 +20,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/actions/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
|
|||||||
56
.github/workflows/test-codeql-bundle-all.yml
vendored
Normal file
56
.github/workflows/test-codeql-bundle-all.yml
vendored
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
name: 'PR Check - CodeQL Bundle All'
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
GO111MODULE: auto
|
||||||
|
# Disable Kotlin analysis while it's incompatible with Kotlin 1.8, until we find a
|
||||||
|
# workaround for our PR checks.
|
||||||
|
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- releases/v2
|
||||||
|
pull_request:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- synchronize
|
||||||
|
- reopened
|
||||||
|
- ready_for_review
|
||||||
|
workflow_dispatch: {}
|
||||||
|
jobs:
|
||||||
|
test-codeql-bundle-all:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: nightly-latest
|
||||||
|
name: 'CodeQL Bundle All'
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
security-events: write
|
||||||
|
timeout-minutes: 45
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Check out repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Prepare test
|
||||||
|
id: prepare-test
|
||||||
|
uses: ./.github/actions/prepare-test
|
||||||
|
with:
|
||||||
|
version: ${{ matrix.version }}
|
||||||
|
use-all-platform-bundle: true
|
||||||
|
- id: init
|
||||||
|
uses: ./../action/init
|
||||||
|
with:
|
||||||
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
|
- uses: ./../action/.github/actions/setup-swift
|
||||||
|
with:
|
||||||
|
codeql-path: ${{ steps.init.outputs.codeql-path }}
|
||||||
|
- name: Build code
|
||||||
|
shell: bash
|
||||||
|
run: ./build.sh
|
||||||
|
- uses: ./../action/analyze
|
||||||
|
with:
|
||||||
|
upload-database: false
|
||||||
|
env:
|
||||||
|
CODEQL_ACTION_TEST_MODE: true
|
||||||
2
.github/workflows/update-bundle.yml
vendored
2
.github/workflows/update-bundle.yml
vendored
@@ -26,7 +26,7 @@ jobs:
|
|||||||
GITHUB_CONTEXT: '${{ toJson(github) }}'
|
GITHUB_CONTEXT: '${{ toJson(github) }}'
|
||||||
run: echo "$GITHUB_CONTEXT"
|
run: echo "$GITHUB_CONTEXT"
|
||||||
|
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Update git config
|
- name: Update git config
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
9
.github/workflows/update-dependencies.yml
vendored
9
.github/workflows/update-dependencies.yml
vendored
@@ -11,19 +11,20 @@ jobs:
|
|||||||
if: contains(github.event.pull_request.labels.*.name, 'Update dependencies') && (github.event.pull_request.head.repo.full_name == 'github/codeql-action')
|
if: contains(github.event.pull_request.labels.*.name, 'Update dependencies') && (github.event.pull_request.head.repo.full_name == 'github/codeql-action')
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Remove PR label
|
- name: Remove PR label
|
||||||
env:
|
env:
|
||||||
|
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
|
||||||
REPOSITORY: '${{ github.repository }}'
|
REPOSITORY: '${{ github.repository }}'
|
||||||
PR_NUMBER: '${{ github.event.pull_request.number }}'
|
PR_NUMBER: '${{ github.event.pull_request.number }}'
|
||||||
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
|
|
||||||
run: |
|
run: |
|
||||||
gh api "repos/$REPOSITORY/issues/$PR_NUMBER/labels/Update%20dependencies" -X DELETE
|
gh api "repos/$REPOSITORY/issues/$PR_NUMBER/labels/Update%20dependencies" -X DELETE
|
||||||
|
|
||||||
- name: Push updated dependencies
|
- name: Push updated dependencies
|
||||||
env:
|
env:
|
||||||
BRANCH: '${{ github.head_ref }}'
|
BRANCH: '${{ github.head_ref }}'
|
||||||
|
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
|
||||||
run: |
|
run: |
|
||||||
git fetch origin "$BRANCH" --depth=1
|
git fetch origin "$BRANCH" --depth=1
|
||||||
git checkout "origin/$BRANCH"
|
git checkout "origin/$BRANCH"
|
||||||
@@ -34,4 +35,8 @@ jobs:
|
|||||||
git add node_modules
|
git add node_modules
|
||||||
git commit -am "Update checked-in dependencies"
|
git commit -am "Update checked-in dependencies"
|
||||||
git push origin "HEAD:$BRANCH"
|
git push origin "HEAD:$BRANCH"
|
||||||
|
echo "Pushed a commit to update the checked-in dependencies." \
|
||||||
|
"Please mark the PR as ready for review to trigger PR checks." |
|
||||||
|
gh pr comment --body-file - --repo github/codeql-action "${{ github.event.pull_request.number }}"
|
||||||
|
gh pr ready --undo --repo github/codeql-action "${{ github.event.pull_request.number }}"
|
||||||
fi
|
fi
|
||||||
|
|||||||
2
.github/workflows/update-release-branch.yml
vendored
2
.github/workflows/update-release-branch.yml
vendored
@@ -18,7 +18,7 @@ jobs:
|
|||||||
GITHUB_CONTEXT: '${{ toJson(github) }}'
|
GITHUB_CONTEXT: '${{ toJson(github) }}'
|
||||||
run: echo "$GITHUB_CONTEXT"
|
run: echo "$GITHUB_CONTEXT"
|
||||||
|
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
# Need full history so we calculate diffs
|
# Need full history so we calculate diffs
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
python-version: "3.7"
|
python-version: "3.7"
|
||||||
- name: Checkout CodeQL Action
|
- name: Checkout CodeQL Action
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Checkout Enterprise Releases
|
- name: Checkout Enterprise Releases
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
repository: github/enterprise-releases
|
repository: github/enterprise-releases
|
||||||
ssh-key: ${{ secrets.ENTERPRISE_RELEASES_SSH_KEY }}
|
ssh-key: ${{ secrets.ENTERPRISE_RELEASES_SSH_KEY }}
|
||||||
@@ -52,5 +52,13 @@ jobs:
|
|||||||
git add .
|
git add .
|
||||||
git commit --message "Update supported GitHub Enterprise Server versions"
|
git commit --message "Update supported GitHub Enterprise Server versions"
|
||||||
git push origin update-supported-enterprise-server-versions
|
git push origin update-supported-enterprise-server-versions
|
||||||
gh pr create --fill --draft
|
|
||||||
|
body="This PR updates the list of supported GitHub Enterprise Server versions, either because a new "
|
||||||
|
body+="version is about to be feature frozen, or because an old release has been deprecated.\n\n"
|
||||||
|
body+="If an old release has been deprecated, please follow the instructions in CONTRIBUTING.md to "
|
||||||
|
body+="deprecate the corresponding version of CodeQL."
|
||||||
|
|
||||||
|
gh pr create --draft \
|
||||||
|
--title "Update supported GitHub Enterprise Server versions" \
|
||||||
|
--body "$body"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ def main():
|
|||||||
releases = json.loads(_RELEASE_FILE_PATH.read_text())
|
releases = json.loads(_RELEASE_FILE_PATH.read_text())
|
||||||
|
|
||||||
# Remove GHES version using a previous version numbering scheme.
|
# Remove GHES version using a previous version numbering scheme.
|
||||||
if "11.10.340" in releases:
|
if "11.10" in releases:
|
||||||
del releases["11.10.340"]
|
del releases["11.10"]
|
||||||
|
|
||||||
oldest_supported_release = None
|
oldest_supported_release = None
|
||||||
newest_supported_release = semver.VersionInfo.parse(api_compatibility_data["maximumVersion"] + ".0")
|
newest_supported_release = semver.VersionInfo.parse(api_compatibility_data["maximumVersion"] + ".0")
|
||||||
|
|||||||
8
.vscode/settings.json
vendored
8
.vscode/settings.json
vendored
@@ -6,5 +6,11 @@
|
|||||||
|
|
||||||
// transpiled JavaScript
|
// transpiled JavaScript
|
||||||
"lib": true,
|
"lib": true,
|
||||||
}
|
},
|
||||||
|
// Installing a new Node package often triggers VS Code's git limit warnings as there is typically
|
||||||
|
// an intermediate stage where many files are modified. This setting suppresses these warnings.
|
||||||
|
"git.ignoreLimitWarning": true,
|
||||||
|
// Use the vendored TypeScript version to have a consistent development experience across
|
||||||
|
// machines.
|
||||||
|
"typescript.tsdk": "node_modules/typescript/lib"
|
||||||
}
|
}
|
||||||
|
|||||||
74
CHANGELOG.md
74
CHANGELOG.md
@@ -2,9 +2,79 @@
|
|||||||
|
|
||||||
See the [releases page](https://github.com/github/codeql-action/releases) for the relevant changes to the CodeQL CLI and language packs.
|
See the [releases page](https://github.com/github/codeql-action/releases) for the relevant changes to the CodeQL CLI and language packs.
|
||||||
|
|
||||||
## [UNRELEASED]
|
## 2.22.3 - 13 Oct 2023
|
||||||
|
|
||||||
No user facing changes.
|
- Provide an authentication token when downloading the CodeQL Bundle from the API of a GitHub Enterprise Server instance. [#1945](https://github.com/github/codeql-action/pull/1945)
|
||||||
|
|
||||||
|
## 2.22.2 - 12 Oct 2023
|
||||||
|
|
||||||
|
- Update default CodeQL bundle version to 2.15.0. [#1938](https://github.com/github/codeql-action/pull/1938)
|
||||||
|
- Improve the log output when an error occurs in an invocation of the CodeQL CLI. [#1927](https://github.com/github/codeql-action/pull/1927)
|
||||||
|
|
||||||
|
## 2.22.1 - 09 Oct 2023
|
||||||
|
|
||||||
|
- Add a workaround for Python 3.12, which is not supported in CodeQL CLI version 2.14.6 or earlier. If you are running an analysis on Windows and using Python 3.12 or later, the CodeQL Action will switch to running Python 3.11. In this case, if Python 3.11 is not found, then the workflow will fail. [#1928](https://github.com/github/codeql-action/pull/1928)
|
||||||
|
|
||||||
|
## 2.22.0 - 06 Oct 2023
|
||||||
|
|
||||||
|
- The CodeQL Action now requires CodeQL version 2.10.5 or later. For more information, see the corresponding changelog entry for CodeQL Action version 2.21.8. [#1907](https://github.com/github/codeql-action/pull/1907)
|
||||||
|
- The CodeQL Action no longer runs ML-powered queries. For more information, including details on our investment in AI-powered security technology, see ["CodeQL code scanning deprecates ML-powered alerts."](https://github.blog/changelog/2023-09-29-codeql-code-scanning-deprecates-ml-powered-alerts/) [#1910](https://github.com/github/codeql-action/pull/1910)
|
||||||
|
- Fix a bug which prevented tracing of projects using Go 1.21 and above on Linux. [#1909](https://github.com/github/codeql-action/pull/1909)
|
||||||
|
|
||||||
|
## 2.21.9 - 27 Sep 2023
|
||||||
|
|
||||||
|
- Update default CodeQL bundle version to 2.14.6. [#1897](https://github.com/github/codeql-action/pull/1897)
|
||||||
|
- We are rolling out a feature in October 2023 that will improve the success rate of C/C++ autobuild. [#1889](https://github.com/github/codeql-action/pull/1889)
|
||||||
|
- We are rolling out a feature in October 2023 that will provide specific file coverage information for C and C++, Java and Kotlin, and JavaScript and TypeScript. Currently file coverage information for each of these pairs of languages is grouped together. [#1903](https://github.com/github/codeql-action/pull/1903)
|
||||||
|
- Add a warning to help customers avoid inadvertently analyzing the same CodeQL language in multiple matrix jobs. [#1901](https://github.com/github/codeql-action/pull/1901)
|
||||||
|
|
||||||
|
## 2.21.8 - 19 Sep 2023
|
||||||
|
|
||||||
|
- Add a deprecation warning for customers using CodeQL version 2.10.4 and earlier. These versions of CodeQL were discontinued on 12 September 2023 alongside GitHub Enterprise Server 3.6, and will be unsupported by the next minor release of the CodeQL Action. [#1884](https://github.com/github/codeql-action/pull/1884)
|
||||||
|
- If you are using one of these versions, please update to CodeQL CLI version 2.10.5 or later. For instance, if you have specified a custom version of the CLI using the 'tools' input to the 'init' Action, you can remove this input to use the default version.
|
||||||
|
- Alternatively, if you want to continue using a version of the CodeQL CLI between 2.9.5 and 2.10.4, you can replace `github/codeql-action/*@v2` by `github/codeql-action/*@v2.21.7` in your code scanning workflow to ensure you continue using this version of the CodeQL Action.
|
||||||
|
- Enable the following language aliases when using CodeQL 2.14.4 and later: `c-cpp` for C/C++ analysis, `java-kotlin` for Java/Kotlin analysis, and `javascript-typescript` for JavaScript/TypeScript analysis. [#1883](https://github.com/github/codeql-action/pull/1883)
|
||||||
|
|
||||||
|
## 2.21.7 - 14 Sep 2023
|
||||||
|
|
||||||
|
- Update default CodeQL bundle version to 2.14.5. [#1882](https://github.com/github/codeql-action/pull/1882)
|
||||||
|
|
||||||
|
## 2.21.6 - 13 Sep 2023
|
||||||
|
|
||||||
|
- Better error message when there is a failure to determine the merge base of the code to analysis. [#1860](https://github.com/github/codeql-action/pull/1860)
|
||||||
|
- Improve the calculation of default amount of RAM used for query execution on GitHub Enterprise Server. This now reduces in proportion to the runner's total memory to better account for system memory usage, helping to avoid out-of-memory failures on larger runners. This feature is already available to GitHub.com users. [#1866](https://github.com/github/codeql-action/pull/1866)
|
||||||
|
- Enable improved file coverage information for GitHub Enterprise Server users. This feature is already available to GitHub.com users. [#1867](https://github.com/github/codeql-action/pull/1867)
|
||||||
|
- Update default CodeQL bundle version to 2.14.4. [#1873](https://github.com/github/codeql-action/pull/1873)
|
||||||
|
|
||||||
|
## 2.21.5 - 28 Aug 2023
|
||||||
|
|
||||||
|
- Update default CodeQL bundle version to 2.14.3. [#1845](https://github.com/github/codeql-action/pull/1845)
|
||||||
|
- Fixed a bug in CodeQL Action 2.21.3 onwards that affected beta support for [Project Lombok](https://projectlombok.org/) when analyzing Java. The environment variable `CODEQL_EXTRACTOR_JAVA_RUN_ANNOTATION_PROCESSORS` will now be respected if it was manually configured in the workflow. [#1844](https://github.com/github/codeql-action/pull/1844)
|
||||||
|
- Enable support for Kotlin 1.9.20 when running with CodeQL CLI v2.13.4 through v2.14.3. [#1853](https://github.com/github/codeql-action/pull/1853)
|
||||||
|
|
||||||
|
## 2.21.4 - 14 Aug 2023
|
||||||
|
|
||||||
|
- Update default CodeQL bundle version to 2.14.2. [#1831](https://github.com/github/codeql-action/pull/1831)
|
||||||
|
- Log a warning if the amount of available disk space runs low during a code scanning run. [#1825](https://github.com/github/codeql-action/pull/1825)
|
||||||
|
- When downloading CodeQL bundle version 2.13.4 and later, cache these bundles in the Actions tool cache using a simpler version number. [#1832](https://github.com/github/codeql-action/pull/1832)
|
||||||
|
- Fix an issue that first appeared in CodeQL Action v2.21.2 that prevented CodeQL invocations from being logged. [#1833](https://github.com/github/codeql-action/pull/1833)
|
||||||
|
- We are rolling out a feature in August 2023 that will improve the quality of file coverage information. [#1835](https://github.com/github/codeql-action/pull/1835)
|
||||||
|
|
||||||
|
## 2.21.3 - 08 Aug 2023
|
||||||
|
|
||||||
|
- We are rolling out a feature in August 2023 that will improve multi-threaded performance on larger runners. [#1817](https://github.com/github/codeql-action/pull/1817)
|
||||||
|
- We are rolling out a feature in August 2023 that adds beta support for [Project Lombok](https://projectlombok.org/) when analyzing Java. [#1809](https://github.com/github/codeql-action/pull/1809)
|
||||||
|
- Reduce disk space usage when downloading the CodeQL bundle. [#1820](https://github.com/github/codeql-action/pull/1820)
|
||||||
|
|
||||||
|
## 2.21.2 - 28 Jul 2023
|
||||||
|
|
||||||
|
- Update default CodeQL bundle version to 2.14.1. [#1797](https://github.com/github/codeql-action/pull/1797)
|
||||||
|
- Avoid duplicating the analysis summary within the logs. [#1811](https://github.com/github/codeql-action/pull/1811)
|
||||||
|
|
||||||
|
## 2.21.1 - 26 Jul 2023
|
||||||
|
|
||||||
|
- Improve the handling of fatal errors from the CodeQL CLI. [#1795](https://github.com/github/codeql-action/pull/1795)
|
||||||
|
- Add the `sarif-output` output to the analyze action that contains the path to the directory of the generated SARIF. [#1799](https://github.com/github/codeql-action/pull/1799)
|
||||||
|
|
||||||
## 2.21.0 - 19 Jul 2023
|
## 2.21.0 - 19 Jul 2023
|
||||||
|
|
||||||
|
|||||||
@@ -78,6 +78,27 @@ Since the `codeql-action` runs most of its testing through individual Actions wo
|
|||||||
2. Run the script. If there's a reason to, you can pass in a different SHA as a CLI argument.
|
2. Run the script. If there's a reason to, you can pass in a different SHA as a CLI argument.
|
||||||
3. After running, go to the [branch protection rules settings page](https://github.com/github/codeql-action/settings/branches) and validate that the rules for `main`, `v1`, and `v2` have been updated.
|
3. After running, go to the [branch protection rules settings page](https://github.com/github/codeql-action/settings/branches) and validate that the rules for `main`, `v1`, and `v2` have been updated.
|
||||||
|
|
||||||
|
## Deprecating a CodeQL version (write access required)
|
||||||
|
|
||||||
|
We typically deprecate a version of CodeQL when the GitHub Enterprise Server (GHES) version that it first shipped in is deprecated.
|
||||||
|
|
||||||
|
1. Work out the next minimum version of CodeQL. This is the version that shipped in the version of GHES after the one that has just been deprecated.
|
||||||
|
1. Notify users using the old version of CodeQL about the deprecation.
|
||||||
|
- Update `CODEQL_NEXT_MINIMUM_VERSION`, `GHES_VERSION_MOST_RECENTLY_DEPRECATED`, and `GHES_MOST_RECENT_DEPRECATION_DATE` in `src/codeql.ts` to reflect the new minimum version of CodeQL and the GHES version that has just been deprecated.
|
||||||
|
- Add a changelog note announcing the deprecation.
|
||||||
|
- Example PR: https://github.com/github/codeql-action/pull/1884
|
||||||
|
1. Release the Action, or wait for the next scheduled release of the Action, then wait at least a week so users have time to see and act on the deprecation warning.
|
||||||
|
1. Remove support for the old version of CodeQL.
|
||||||
|
- Bump `CODEQL_MINIMUM_VERSION` in `src/codeql.ts` to the new minimum version of CodeQL.
|
||||||
|
- Remove any code that is only needed to support the old version of CodeQL. This is often behind a version guard, so look for instances of version numbers between the old minimum version and the new minimum version in the codebase. A good place to start is the list of version numbers in `src/codeql.ts`.
|
||||||
|
- Update the default set of CodeQL test versions in `pr-checks/sync.py`.
|
||||||
|
- Remove the old minimum version of CodeQL.
|
||||||
|
- Add the latest patch release for any new CodeQL minor version series that have shipped in GHES.
|
||||||
|
- Run the script to update the generated PR checks.
|
||||||
|
- Do the same for PR checks that aren't auto-generated.
|
||||||
|
- Add a changelog note announcing the new minimum version of CodeQL that is now required.
|
||||||
|
- Example PR: https://github.com/github/codeql-action/pull/1907
|
||||||
|
|
||||||
## Resources
|
## Resources
|
||||||
|
|
||||||
- [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/)
|
- [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/)
|
||||||
|
|||||||
157
README.md
157
README.md
@@ -1,6 +1,6 @@
|
|||||||
# CodeQL Action
|
# CodeQL Action
|
||||||
|
|
||||||
This action runs GitHub's industry-leading semantic code analysis engine, [CodeQL](https://codeql.github.com/), against a repository's source code to find security vulnerabilities. It then automatically uploads the results to GitHub so they can be displayed in the repository's security tab. CodeQL runs an extensible set of [queries](https://github.com/github/codeql), which have been developed by the community and the [GitHub Security Lab](https://securitylab.github.com/) to find common vulnerabilities in your code.
|
This action runs GitHub's industry-leading semantic code analysis engine, [CodeQL](https://codeql.github.com/), against a repository's source code to find security vulnerabilities. It then automatically uploads the results to GitHub so they can be displayed on pull requests and in the repository's security tab. CodeQL runs an extensible set of [queries](https://github.com/github/codeql), which have been developed by the community and the [GitHub Security Lab](https://securitylab.github.com/) to find common vulnerabilities in your code.
|
||||||
|
|
||||||
For a list of recent changes, see the CodeQL Action's [changelog](CHANGELOG.md).
|
For a list of recent changes, see the CodeQL Action's [changelog](CHANGELOG.md).
|
||||||
|
|
||||||
@@ -12,160 +12,9 @@ The underlying CodeQL CLI, used in this action, is licensed under the [GitHub Co
|
|||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
This is a short walkthrough, but for more information read [configuring code scanning](https://help.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning).
|
We recommend using default setup to configure CodeQL analysis for your repository. For more information, see "[Configuring default setup for code scanning](https://docs.github.com/en/code-security/code-scanning/enabling-code-scanning/configuring-default-setup-for-code-scanning)."
|
||||||
|
|
||||||
To get code scanning results from CodeQL analysis on your repo you can use the following workflow as a template:
|
You can also configure advanced setup for a repository to find security vulnerabilities in your code using a highly customizable code scanning configuration. For more information, see "[Configuring advanced setup for code scanning](https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/configuring-advanced-setup-for-code-scanning)" and "[Customizing your advanced setup for code scanning](https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning)."
|
||||||
|
|
||||||
```yaml
|
|
||||||
|
|
||||||
name: "Code Scanning - Action"
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [main]
|
|
||||||
pull_request:
|
|
||||||
branches: [main]
|
|
||||||
schedule:
|
|
||||||
# ┌───────────── minute (0 - 59)
|
|
||||||
# │ ┌───────────── hour (0 - 23)
|
|
||||||
# │ │ ┌───────────── day of the month (1 - 31)
|
|
||||||
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
|
|
||||||
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
|
|
||||||
# │ │ │ │ │
|
|
||||||
# │ │ │ │ │
|
|
||||||
# │ │ │ │ │
|
|
||||||
# * * * * *
|
|
||||||
- cron: '30 1 * * 0'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
CodeQL-Build:
|
|
||||||
# CodeQL runs on ubuntu-latest, windows-latest, and macos-latest
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
# required for all workflows
|
|
||||||
security-events: write
|
|
||||||
|
|
||||||
# only required for workflows in private repositories
|
|
||||||
actions: read
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
# Initializes the CodeQL tools for scanning.
|
|
||||||
- name: Initialize CodeQL
|
|
||||||
uses: github/codeql-action/init@v2
|
|
||||||
# Override language selection by uncommenting this and choosing your languages
|
|
||||||
# with:
|
|
||||||
# languages: go, javascript, csharp, python, cpp, java, ruby
|
|
||||||
|
|
||||||
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
|
|
||||||
# If this step fails, then you should remove it and run the build manually (see below).
|
|
||||||
- name: Autobuild
|
|
||||||
uses: github/codeql-action/autobuild@v2
|
|
||||||
|
|
||||||
# ℹ️ Command-line programs to run using the OS shell.
|
|
||||||
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
|
||||||
|
|
||||||
# ✏️ If the Autobuild fails above, remove it and uncomment the following
|
|
||||||
# three lines and modify them (or add more) to build your code if your
|
|
||||||
# project uses a compiled language
|
|
||||||
|
|
||||||
#- run: |
|
|
||||||
# make bootstrap
|
|
||||||
# make release
|
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
|
||||||
uses: github/codeql-action/analyze@v2
|
|
||||||
```
|
|
||||||
|
|
||||||
If you prefer to integrate this within an existing CI workflow, it should end up looking something like this:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- name: Initialize CodeQL
|
|
||||||
uses: github/codeql-action/init@v2
|
|
||||||
with:
|
|
||||||
languages: go, javascript
|
|
||||||
|
|
||||||
# Here is where you build your code
|
|
||||||
- run: |
|
|
||||||
make bootstrap
|
|
||||||
make release
|
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
|
||||||
uses: github/codeql-action/analyze@v2
|
|
||||||
```
|
|
||||||
|
|
||||||
### Configuration file
|
|
||||||
|
|
||||||
Use the `config-file` parameter of the `init` action to enable the configuration file. The value of `config-file` is the path to the configuration file you want to use. This example loads the configuration file `./.github/codeql/codeql-config.yml`.
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- uses: github/codeql-action/init@v2
|
|
||||||
with:
|
|
||||||
config-file: ./.github/codeql/codeql-config.yml
|
|
||||||
```
|
|
||||||
|
|
||||||
The configuration file can be located in a different repository. This is useful if you want to share the same configuration across multiple repositories. If the configuration file is in a private repository you can also specify an `external-repository-token` option. This should be a personal access token that has read access to any repositories containing referenced config files and queries.
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- uses: github/codeql-action/init@v2
|
|
||||||
with:
|
|
||||||
config-file: owner/repo/codeql-config.yml@branch
|
|
||||||
external-repository-token: ${{ secrets.EXTERNAL_REPOSITORY_TOKEN }}
|
|
||||||
```
|
|
||||||
|
|
||||||
For information on how to write a configuration file, see "[Using a custom configuration file](https://help.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#using-a-custom-configuration-file)."
|
|
||||||
|
|
||||||
If you only want to customise the queries used, you can specify them in your workflow instead of creating a config file, using the `queries` property of the `init` action:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- uses: github/codeql-action/init@v2
|
|
||||||
with:
|
|
||||||
queries: <local-or-remote-query>,<another-query>
|
|
||||||
```
|
|
||||||
|
|
||||||
By default, this will override any queries specified in a config file. If you wish to use both sets of queries, prefix the list of queries in the workflow with `+`:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- uses: github/codeql-action/init@v2
|
|
||||||
with:
|
|
||||||
queries: +<local-or-remote-query>,<another-query>
|
|
||||||
```
|
|
||||||
|
|
||||||
### Configuration via `config` input
|
|
||||||
|
|
||||||
You can alternatively configure CodeQL using the `config` input to the `init` Action. The value of this input must be a YAML string that follows the configuration file format documented at "[Using a custom configuration file](https://aka.ms/code-scanning-docs/config-file)."
|
|
||||||
|
|
||||||
#### Example configuration
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- uses: github/codeql-action/init@v2
|
|
||||||
with:
|
|
||||||
languages: ${{ matrix.language }}
|
|
||||||
config: |
|
|
||||||
disable-default-queries: true
|
|
||||||
queries:
|
|
||||||
- uses: security-extended
|
|
||||||
- uses: security-and-quality
|
|
||||||
query-filters:
|
|
||||||
- include:
|
|
||||||
tags: /cwe-020/
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
#### Sharing configuration across multiple repositories
|
|
||||||
|
|
||||||
You can use Actions or environment variables to share configuration across multiple repositories and to modify configuration without needing to edit the workflow file. In the following example, `vars.CODEQL_CONF` is an [Actions configuration variable](https://docs.github.com/en/actions/learn-github-actions/variables#defining-configuration-variables-for-multiple-workflows):
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- uses: github/codeql-action/init@v2
|
|
||||||
with:
|
|
||||||
languages: ${{ matrix.language }}
|
|
||||||
config: ${{ vars.CODEQL_CONF }}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
|
|
||||||
|
|||||||
@@ -79,6 +79,8 @@ inputs:
|
|||||||
outputs:
|
outputs:
|
||||||
db-locations:
|
db-locations:
|
||||||
description: A map from language to absolute path for each database created by CodeQL.
|
description: A map from language to absolute path for each database created by CodeQL.
|
||||||
|
sarif-output:
|
||||||
|
description: Absolute, local path to the directory containing the generated SARIF file.
|
||||||
sarif-id:
|
sarif-id:
|
||||||
description: The ID of the uploaded SARIF file.
|
description: The ID of the uploaded SARIF file.
|
||||||
runs:
|
runs:
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ inputs:
|
|||||||
required: false
|
required: false
|
||||||
# If not specified the Action will check in several places until it finds the CodeQL tools.
|
# If not specified the Action will check in several places until it finds the CodeQL tools.
|
||||||
languages:
|
languages:
|
||||||
description: The languages to be analysed
|
description: |
|
||||||
|
A comma-separated value of the languages to be analysed e.g. python,javascript
|
||||||
required: false
|
required: false
|
||||||
token:
|
token:
|
||||||
description: GitHub token to use for authenticating with this instance of GitHub. To download custom packs from multiple registries, use the registries input.
|
description: GitHub token to use for authenticating with this instance of GitHub. To download custom packs from multiple registries, use the registries input.
|
||||||
@@ -44,7 +45,7 @@ inputs:
|
|||||||
db-location:
|
db-location:
|
||||||
description: Path where CodeQL databases should be created. If not specified, a temporary directory will be used.
|
description: Path where CodeQL databases should be created. If not specified, a temporary directory will be used.
|
||||||
required: false
|
required: false
|
||||||
config:
|
config:
|
||||||
description: Configuration passed as a YAML string in the same format as the config-file input. This takes precedence over the config-file input.
|
description: Configuration passed as a YAML string in the same format as the config-file input. This takes precedence over the config-file input.
|
||||||
required: false
|
required: false
|
||||||
queries:
|
queries:
|
||||||
|
|||||||
77
lib/actions-util.js
generated
77
lib/actions-util.js
generated
@@ -23,7 +23,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.getWorkflowRunAttempt = exports.getWorkflowRunID = exports.getUploadValue = exports.printDebugLogs = exports.isAnalyzingDefaultBranch = exports.getRelativeScriptPath = exports.isRunningLocalAction = exports.getWorkflowEventName = exports.getActionVersion = exports.getActionsStatus = exports.getRef = exports.determineMergeBaseCommitOid = exports.getCommitOid = exports.getTemporaryDirectory = exports.getOptionalInput = exports.getRequiredInput = void 0;
|
exports.getFileType = exports.getWorkflowRunAttempt = exports.getWorkflowRunID = exports.getUploadValue = exports.printDebugLogs = exports.isAnalyzingDefaultBranch = exports.getRelativeScriptPath = exports.isRunningLocalAction = exports.getWorkflowEventName = exports.getActionVersion = exports.getRef = exports.determineMergeBaseCommitOid = exports.getCommitOid = exports.getTemporaryDirectory = exports.getOptionalInput = exports.getRequiredInput = void 0;
|
||||||
const fs = __importStar(require("fs"));
|
const fs = __importStar(require("fs"));
|
||||||
const path = __importStar(require("path"));
|
const path = __importStar(require("path"));
|
||||||
const core = __importStar(require("@actions/core"));
|
const core = __importStar(require("@actions/core"));
|
||||||
@@ -39,7 +39,11 @@ const pkg = require("../package.json");
|
|||||||
* This allows us to get stronger type checking of required/optional inputs.
|
* This allows us to get stronger type checking of required/optional inputs.
|
||||||
*/
|
*/
|
||||||
const getRequiredInput = function (name) {
|
const getRequiredInput = function (name) {
|
||||||
return core.getInput(name, { required: true });
|
const value = core.getInput(name);
|
||||||
|
if (!value) {
|
||||||
|
throw new util_1.UserError(`Input required and not supplied: ${name}`);
|
||||||
|
}
|
||||||
|
return value;
|
||||||
};
|
};
|
||||||
exports.getRequiredInput = getRequiredInput;
|
exports.getRequiredInput = getRequiredInput;
|
||||||
/**
|
/**
|
||||||
@@ -71,6 +75,7 @@ const getCommitOid = async function (checkoutPath, ref = "HEAD") {
|
|||||||
// the merge commit, which must mean that git is available.
|
// the merge commit, which must mean that git is available.
|
||||||
// Even if this does go wrong, it's not a huge problem for the alerts to
|
// Even if this does go wrong, it's not a huge problem for the alerts to
|
||||||
// reported on the merge commit.
|
// reported on the merge commit.
|
||||||
|
let stderr = "";
|
||||||
try {
|
try {
|
||||||
let commitOid = "";
|
let commitOid = "";
|
||||||
await new toolrunner.ToolRunner(await safeWhich.safeWhich("git"), ["rev-parse", ref], {
|
await new toolrunner.ToolRunner(await safeWhich.safeWhich("git"), ["rev-parse", ref], {
|
||||||
@@ -80,7 +85,7 @@ const getCommitOid = async function (checkoutPath, ref = "HEAD") {
|
|||||||
commitOid += data.toString();
|
commitOid += data.toString();
|
||||||
},
|
},
|
||||||
stderr: (data) => {
|
stderr: (data) => {
|
||||||
process.stderr.write(data);
|
stderr += data.toString();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
cwd: checkoutPath,
|
cwd: checkoutPath,
|
||||||
@@ -88,9 +93,13 @@ const getCommitOid = async function (checkoutPath, ref = "HEAD") {
|
|||||||
return commitOid.trim();
|
return commitOid.trim();
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
core.info("Could not determine current commit SHA using git. Continuing with data from user input or environment.");
|
if (stderr.includes("not a git repository")) {
|
||||||
core.debug(`Reason: ${e.message}`);
|
core.info("Could not determine current commit SHA using git. Continuing with data from user input or environment. " +
|
||||||
core.debug(e.stack || "NO STACK");
|
"The checkout path provided to the action does not appear to be a git repository.");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
core.info(`Could not determine current commit SHA using git. Continuing with data from user input or environment. ${stderr}`);
|
||||||
|
}
|
||||||
return (0, exports.getOptionalInput)("sha") || (0, util_1.getRequiredEnvParam)("GITHUB_SHA");
|
return (0, exports.getOptionalInput)("sha") || (0, util_1.getRequiredEnvParam)("GITHUB_SHA");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -99,12 +108,13 @@ exports.getCommitOid = getCommitOid;
|
|||||||
* If the action was triggered by a pull request, determine the commit sha of the merge base.
|
* If the action was triggered by a pull request, determine the commit sha of the merge base.
|
||||||
* Returns undefined if run by other triggers or the merge base cannot be determined.
|
* Returns undefined if run by other triggers or the merge base cannot be determined.
|
||||||
*/
|
*/
|
||||||
const determineMergeBaseCommitOid = async function () {
|
const determineMergeBaseCommitOid = async function (checkoutPathOverride) {
|
||||||
if (getWorkflowEventName() !== "pull_request") {
|
if (getWorkflowEventName() !== "pull_request") {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
const mergeSha = (0, util_1.getRequiredEnvParam)("GITHUB_SHA");
|
const mergeSha = (0, util_1.getRequiredEnvParam)("GITHUB_SHA");
|
||||||
const checkoutPath = (0, exports.getOptionalInput)("checkout_path");
|
const checkoutPath = checkoutPathOverride ?? (0, exports.getOptionalInput)("checkout_path");
|
||||||
|
let stderr = "";
|
||||||
try {
|
try {
|
||||||
let commitOid = "";
|
let commitOid = "";
|
||||||
let baseOid = "";
|
let baseOid = "";
|
||||||
@@ -126,7 +136,7 @@ const determineMergeBaseCommitOid = async function () {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
stderr: (data) => {
|
stderr: (data) => {
|
||||||
process.stderr.write(data);
|
stderr += data.toString();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
cwd: checkoutPath,
|
cwd: checkoutPath,
|
||||||
@@ -140,8 +150,14 @@ const determineMergeBaseCommitOid = async function () {
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
core.info(`Failed to call git to determine merge base. Continuing with data from environment: ${e}`);
|
if (stderr.includes("not a git repository")) {
|
||||||
core.info(e.stack || "NO STACK");
|
core.info("The checkout path provided to the action does not appear to be a git repository. " +
|
||||||
|
"Will calculate the merge base on the server.");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
core.info(`Failed to call git to determine merge base. Will calculate the merge base on ` +
|
||||||
|
`the server. Reason: ${stderr}`);
|
||||||
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -216,15 +232,6 @@ function getRefFromEnv() {
|
|||||||
}
|
}
|
||||||
return refEnv;
|
return refEnv;
|
||||||
}
|
}
|
||||||
function getActionsStatus(error, otherFailureCause) {
|
|
||||||
if (error || otherFailureCause) {
|
|
||||||
return error instanceof util_1.UserError ? "user-error" : "failure";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return "success";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.getActionsStatus = getActionsStatus;
|
|
||||||
function getActionVersion() {
|
function getActionVersion() {
|
||||||
return pkg.version;
|
return pkg.version;
|
||||||
}
|
}
|
||||||
@@ -373,4 +380,34 @@ function getWorkflowRunAttempt() {
|
|||||||
return workflowRunAttempt;
|
return workflowRunAttempt;
|
||||||
}
|
}
|
||||||
exports.getWorkflowRunAttempt = getWorkflowRunAttempt;
|
exports.getWorkflowRunAttempt = getWorkflowRunAttempt;
|
||||||
|
/**
|
||||||
|
* Tries to obtain the output of the `file` command for the file at the specified path.
|
||||||
|
* The output will vary depending on the type of `file`, which operating system we are running on, etc.
|
||||||
|
*/
|
||||||
|
const getFileType = async (filePath) => {
|
||||||
|
let stderr = "";
|
||||||
|
let stdout = "";
|
||||||
|
try {
|
||||||
|
// The `file` command will output information about the type of file pointed at by `filePath`.
|
||||||
|
// For binary files, this may include e.g. whether they are static of dynamic binaries.
|
||||||
|
// The `-L` switch instructs the command to follow symbolic links.
|
||||||
|
await new toolrunner.ToolRunner(await safeWhich.safeWhich("file"), ["-L", filePath], {
|
||||||
|
silent: true,
|
||||||
|
listeners: {
|
||||||
|
stdout: (data) => {
|
||||||
|
stdout += data.toString();
|
||||||
|
},
|
||||||
|
stderr: (data) => {
|
||||||
|
stderr += data.toString();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}).exec();
|
||||||
|
return stdout.trim();
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
core.info(`Could not determine type of ${filePath} from ${stdout}. ${stderr}`);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
exports.getFileType = getFileType;
|
||||||
//# sourceMappingURL=actions-util.js.map
|
//# sourceMappingURL=actions-util.js.map
|
||||||
File diff suppressed because one or more lines are too long
60
lib/actions-util.test.js
generated
60
lib/actions-util.test.js
generated
@@ -28,6 +28,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const fs = __importStar(require("fs"));
|
const fs = __importStar(require("fs"));
|
||||||
const path = __importStar(require("path"));
|
const path = __importStar(require("path"));
|
||||||
|
const core = __importStar(require("@actions/core"));
|
||||||
const ava_1 = __importDefault(require("ava"));
|
const ava_1 = __importDefault(require("ava"));
|
||||||
const sinon = __importStar(require("sinon"));
|
const sinon = __importStar(require("sinon"));
|
||||||
const actionsUtil = __importStar(require("./actions-util"));
|
const actionsUtil = __importStar(require("./actions-util"));
|
||||||
@@ -213,37 +214,32 @@ const util_1 = require("./util");
|
|||||||
getAdditionalInputStub.restore();
|
getAdditionalInputStub.restore();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
(0, ava_1.default)("createStatusReportBase", async (t) => {
|
(0, ava_1.default)("determineMergeBaseCommitOid non-pullrequest", async (t) => {
|
||||||
await (0, util_1.withTmpDir)(async (tmpDir) => {
|
const infoStub = sinon.stub(core, "info");
|
||||||
(0, testing_utils_1.setupActionsVars)(tmpDir, tmpDir);
|
process.env["GITHUB_EVENT_NAME"] = "hucairz";
|
||||||
process.env["GITHUB_REF"] = "refs/heads/main";
|
process.env["GITHUB_SHA"] = "100912429fab4cb230e66ffb11e738ac5194e73a";
|
||||||
process.env["GITHUB_SHA"] = "a".repeat(40);
|
const result = await actionsUtil.determineMergeBaseCommitOid(__dirname);
|
||||||
process.env["GITHUB_RUN_ID"] = "100";
|
t.deepEqual(result, undefined);
|
||||||
process.env["GITHUB_RUN_ATTEMPT"] = "2";
|
t.deepEqual(0, infoStub.callCount);
|
||||||
process.env["GITHUB_REPOSITORY"] = "octocat/HelloWorld";
|
infoStub.restore();
|
||||||
process.env["CODEQL_ACTION_ANALYSIS_KEY"] = "analysis-key";
|
});
|
||||||
process.env["RUNNER_OS"] = "macOS";
|
(0, ava_1.default)("determineMergeBaseCommitOid no error", async (t) => {
|
||||||
const getRequiredInput = sinon.stub(actionsUtil, "getRequiredInput");
|
const infoStub = sinon.stub(core, "info");
|
||||||
getRequiredInput.withArgs("matrix").resolves("input/matrix");
|
process.env["GITHUB_EVENT_NAME"] = "pull_request";
|
||||||
const statusReport = await (0, api_client_1.createStatusReportBase)("init", "failure", new Date("May 19, 2023 05:19:00"), "failure cause", "exception stack trace");
|
process.env["GITHUB_SHA"] = "100912429fab4cb230e66ffb11e738ac5194e73a";
|
||||||
t.assert(typeof statusReport.job_run_uuid === "string");
|
await actionsUtil.determineMergeBaseCommitOid(path.join(__dirname, "../.."));
|
||||||
t.assert(statusReport.workflow_run_id === 100);
|
t.deepEqual(1, infoStub.callCount);
|
||||||
t.assert(statusReport.workflow_run_attempt === 2);
|
t.assert(infoStub.firstCall.args[0].startsWith("The checkout path provided to the action does not appear to be a git repository."));
|
||||||
t.assert(statusReport.workflow_name === (process.env["GITHUB_WORKFLOW"] || ""));
|
infoStub.restore();
|
||||||
t.assert(statusReport.job_name === (process.env["GITHUB_JOB"] || ""));
|
});
|
||||||
t.assert(statusReport.analysis_key === "analysis-key");
|
(0, ava_1.default)("determineMergeBaseCommitOid other error", async (t) => {
|
||||||
t.assert(statusReport.commit_oid === process.env["GITHUB_SHA"]);
|
const infoStub = sinon.stub(core, "info");
|
||||||
t.assert(statusReport.ref === process.env["GITHUB_REF"]);
|
process.env["GITHUB_EVENT_NAME"] = "pull_request";
|
||||||
t.assert(statusReport.action_name === "init");
|
process.env["GITHUB_SHA"] = "100912429fab4cb230e66ffb11e738ac5194e73a";
|
||||||
t.assert(statusReport.action_oid === "unknown");
|
const result = await actionsUtil.determineMergeBaseCommitOid(path.join(__dirname, "../../i-dont-exist"));
|
||||||
t.assert(statusReport.started_at === process.env[environment_1.EnvVar.WORKFLOW_STARTED_AT]);
|
t.deepEqual(result, undefined);
|
||||||
t.assert(statusReport.action_started_at ===
|
t.deepEqual(1, infoStub.callCount);
|
||||||
new Date("May 19, 2023 05:19:00").toISOString());
|
t.assert(infoStub.firstCall.args[0].startsWith("Failed to call git to determine merge base."));
|
||||||
t.assert(statusReport.status === "failure");
|
infoStub.restore();
|
||||||
t.assert(statusReport.cause === "failure cause");
|
|
||||||
t.assert(statusReport.exception === "exception stack trace");
|
|
||||||
t.assert(statusReport.runner_os === process.env["RUNNER_OS"]);
|
|
||||||
t.assert(typeof statusReport.action_version === "string");
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
//# sourceMappingURL=actions-util.test.js.map
|
//# sourceMappingURL=actions-util.test.js.map
|
||||||
File diff suppressed because one or more lines are too long
5
lib/analyze-action-env.test.js
generated
5
lib/analyze-action-env.test.js
generated
@@ -32,6 +32,7 @@ const actionsUtil = __importStar(require("./actions-util"));
|
|||||||
const analyze = __importStar(require("./analyze"));
|
const analyze = __importStar(require("./analyze"));
|
||||||
const api = __importStar(require("./api-client"));
|
const api = __importStar(require("./api-client"));
|
||||||
const configUtils = __importStar(require("./config-utils"));
|
const configUtils = __importStar(require("./config-utils"));
|
||||||
|
const statusReport = __importStar(require("./status-report"));
|
||||||
const testing_utils_1 = require("./testing-utils");
|
const testing_utils_1 = require("./testing-utils");
|
||||||
const util = __importStar(require("./util"));
|
const util = __importStar(require("./util"));
|
||||||
(0, testing_utils_1.setupTests)(ava_1.default);
|
(0, testing_utils_1.setupTests)(ava_1.default);
|
||||||
@@ -47,9 +48,9 @@ const util = __importStar(require("./util"));
|
|||||||
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";
|
process.env["GITHUB_API_URL"] = "https://api.github.com";
|
||||||
sinon
|
sinon
|
||||||
.stub(api, "createStatusReportBase")
|
.stub(statusReport, "createStatusReportBase")
|
||||||
.resolves({});
|
.resolves({});
|
||||||
sinon.stub(api, "sendStatusReport").resolves(true);
|
sinon.stub(statusReport, "sendStatusReport").resolves(true);
|
||||||
sinon.stub(actionsUtil, "isAnalyzingDefaultBranch").resolves(true);
|
sinon.stub(actionsUtil, "isAnalyzingDefaultBranch").resolves(true);
|
||||||
const gitHubVersion = {
|
const gitHubVersion = {
|
||||||
type: util.GitHubVariant.DOTCOM,
|
type: util.GitHubVariant.DOTCOM,
|
||||||
|
|||||||
@@ -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,kDAAoC;AACpC,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;AAE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ACpE,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"}
|
||||||
5
lib/analyze-action-input.test.js
generated
5
lib/analyze-action-input.test.js
generated
@@ -32,6 +32,7 @@ const actionsUtil = __importStar(require("./actions-util"));
|
|||||||
const analyze = __importStar(require("./analyze"));
|
const analyze = __importStar(require("./analyze"));
|
||||||
const api = __importStar(require("./api-client"));
|
const api = __importStar(require("./api-client"));
|
||||||
const configUtils = __importStar(require("./config-utils"));
|
const configUtils = __importStar(require("./config-utils"));
|
||||||
|
const statusReport = __importStar(require("./status-report"));
|
||||||
const testing_utils_1 = require("./testing-utils");
|
const testing_utils_1 = require("./testing-utils");
|
||||||
const util = __importStar(require("./util"));
|
const util = __importStar(require("./util"));
|
||||||
(0, testing_utils_1.setupTests)(ava_1.default);
|
(0, testing_utils_1.setupTests)(ava_1.default);
|
||||||
@@ -47,9 +48,9 @@ const util = __importStar(require("./util"));
|
|||||||
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";
|
process.env["GITHUB_API_URL"] = "https://api.github.com";
|
||||||
sinon
|
sinon
|
||||||
.stub(api, "createStatusReportBase")
|
.stub(statusReport, "createStatusReportBase")
|
||||||
.resolves({});
|
.resolves({});
|
||||||
sinon.stub(api, "sendStatusReport").resolves(true);
|
sinon.stub(statusReport, "sendStatusReport").resolves(true);
|
||||||
const gitHubVersion = {
|
const gitHubVersion = {
|
||||||
type: util.GitHubVariant.DOTCOM,
|
type: util.GitHubVariant.DOTCOM,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -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,kDAAoC;AACpC,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,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,GAAG,wBAAwB,CAAC;QACzD,KAAK;aACF,IAAI,CAAC,GAAG,EAAE,wBAAwB,CAAC;aACnC,QAAQ,CAAC,EAAkC,CAAC,CAAC;QAChD,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,kBAAkB,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACnD,MAAM,aAAa,GAAuB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C,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"}
|
||||||
56
lib/analyze-action.js
generated
56
lib/analyze-action.js
generated
@@ -26,54 +26,51 @@ 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.runPromise = exports.sendStatusReport = void 0;
|
exports.runPromise = void 0;
|
||||||
const fs = __importStar(require("fs"));
|
const fs = __importStar(require("fs"));
|
||||||
const path_1 = __importDefault(require("path"));
|
const path_1 = __importDefault(require("path"));
|
||||||
const perf_hooks_1 = require("perf_hooks");
|
const perf_hooks_1 = require("perf_hooks");
|
||||||
const core = __importStar(require("@actions/core"));
|
const core = __importStar(require("@actions/core"));
|
||||||
|
const safe_which_1 = require("@chrisgavin/safe-which");
|
||||||
const actionsUtil = __importStar(require("./actions-util"));
|
const actionsUtil = __importStar(require("./actions-util"));
|
||||||
const analyze_1 = require("./analyze");
|
const analyze_1 = require("./analyze");
|
||||||
const api_client_1 = require("./api-client");
|
const api_client_1 = require("./api-client");
|
||||||
const api = __importStar(require("./api-client"));
|
|
||||||
const autobuild_1 = require("./autobuild");
|
const autobuild_1 = require("./autobuild");
|
||||||
const codeql_1 = require("./codeql");
|
const codeql_1 = require("./codeql");
|
||||||
const config_utils_1 = require("./config-utils");
|
const config_utils_1 = require("./config-utils");
|
||||||
const database_upload_1 = require("./database-upload");
|
const database_upload_1 = require("./database-upload");
|
||||||
|
const diagnostics_1 = require("./diagnostics");
|
||||||
const environment_1 = require("./environment");
|
const environment_1 = require("./environment");
|
||||||
const feature_flags_1 = require("./feature-flags");
|
const feature_flags_1 = require("./feature-flags");
|
||||||
const languages_1 = require("./languages");
|
const languages_1 = require("./languages");
|
||||||
const logging_1 = require("./logging");
|
const logging_1 = require("./logging");
|
||||||
const repository_1 = require("./repository");
|
const repository_1 = require("./repository");
|
||||||
|
const statusReport = __importStar(require("./status-report"));
|
||||||
|
const status_report_1 = require("./status-report");
|
||||||
const trap_caching_1 = require("./trap-caching");
|
const trap_caching_1 = require("./trap-caching");
|
||||||
const uploadLib = __importStar(require("./upload-lib"));
|
const uploadLib = __importStar(require("./upload-lib"));
|
||||||
const util = __importStar(require("./util"));
|
const util = __importStar(require("./util"));
|
||||||
const util_1 = require("./util");
|
const util_1 = require("./util");
|
||||||
async function sendStatusReport(startedAt, config, stats, error, trapCacheUploadTime, dbCreationTimings, didUploadTrapCaches, logger) {
|
async function sendStatusReport(startedAt, config, stats, error, trapCacheUploadTime, dbCreationTimings, didUploadTrapCaches, logger) {
|
||||||
const status = actionsUtil.getActionsStatus(error, stats?.analyze_failure_language);
|
const status = (0, status_report_1.getActionsStatus)(error, stats?.analyze_failure_language);
|
||||||
const statusReportBase = await api.createStatusReportBase("finish", status, startedAt, error?.message, error?.stack);
|
const statusReportBase = await (0, status_report_1.createStatusReportBase)("finish", status, startedAt, await util.checkDiskUsage(), error?.message, error?.stack);
|
||||||
const statusReport = {
|
const report = {
|
||||||
...statusReportBase,
|
...statusReportBase,
|
||||||
...(config
|
|
||||||
? {
|
|
||||||
ml_powered_javascript_queries: (0, config_utils_1.getMlPoweredJsQueriesStatus)(config),
|
|
||||||
}
|
|
||||||
: {}),
|
|
||||||
...(stats || {}),
|
...(stats || {}),
|
||||||
...(dbCreationTimings || {}),
|
...(dbCreationTimings || {}),
|
||||||
};
|
};
|
||||||
if (config && didUploadTrapCaches) {
|
if (config && didUploadTrapCaches) {
|
||||||
const trapCacheUploadStatusReport = {
|
const trapCacheUploadStatusReport = {
|
||||||
...statusReport,
|
...report,
|
||||||
trap_cache_upload_duration_ms: Math.round(trapCacheUploadTime || 0),
|
trap_cache_upload_duration_ms: Math.round(trapCacheUploadTime || 0),
|
||||||
trap_cache_upload_size_bytes: Math.round(await (0, trap_caching_1.getTotalCacheSize)(config.trapCaches, logger)),
|
trap_cache_upload_size_bytes: Math.round(await (0, trap_caching_1.getTotalCacheSize)(config.trapCaches, logger)),
|
||||||
};
|
};
|
||||||
await api.sendStatusReport(trapCacheUploadStatusReport);
|
await statusReport.sendStatusReport(trapCacheUploadStatusReport);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
await api.sendStatusReport(statusReport);
|
await statusReport.sendStatusReport(report);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.sendStatusReport = sendStatusReport;
|
|
||||||
// `expect-error` should only be set to a non-false value by the CodeQL Action PR checks.
|
// `expect-error` should only be set to a non-false value by the CodeQL Action PR checks.
|
||||||
function hasBadExpectErrorInput() {
|
function hasBadExpectErrorInput() {
|
||||||
return (actionsUtil.getOptionalInput("expect-error") !== "false" &&
|
return (actionsUtil.getOptionalInput("expect-error") !== "false" &&
|
||||||
@@ -133,6 +130,7 @@ async function runAutobuildIfLegacyGoWorkflow(config, logger) {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
logger.debug("Running Go autobuild because extraction output (TRAP files) for Go code has not been found.");
|
||||||
await (0, autobuild_1.runAutobuild)(languages_1.Language.go, config, logger);
|
await (0, autobuild_1.runAutobuild)(languages_1.Language.go, config, logger);
|
||||||
}
|
}
|
||||||
async function run() {
|
async function run() {
|
||||||
@@ -146,7 +144,7 @@ async function run() {
|
|||||||
util.initializeEnvironment(actionsUtil.getActionVersion());
|
util.initializeEnvironment(actionsUtil.getActionVersion());
|
||||||
const logger = (0, logging_1.getActionsLogger)();
|
const logger = (0, logging_1.getActionsLogger)();
|
||||||
try {
|
try {
|
||||||
if (!(await api.sendStatusReport(await api.createStatusReportBase("finish", "starting", startedAt)))) {
|
if (!(await statusReport.sendStatusReport(await (0, status_report_1.createStatusReportBase)("finish", "starting", startedAt, await util.checkDiskUsage(logger))))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
config = await (0, config_utils_1.getConfig)(actionsUtil.getTemporaryDirectory(), logger);
|
config = await (0, config_utils_1.getConfig)(actionsUtil.getTemporaryDirectory(), logger);
|
||||||
@@ -154,7 +152,7 @@ async function run() {
|
|||||||
throw new Error("Config file could not be found at expected location. Has the 'init' action been called?");
|
throw new Error("Config file could not be found at expected location. Has the 'init' action been called?");
|
||||||
}
|
}
|
||||||
if (hasBadExpectErrorInput()) {
|
if (hasBadExpectErrorInput()) {
|
||||||
throw new Error("`expect-error` input parameter is for internal use only. It should only be set by codeql-action or a fork.");
|
throw new util.UserError("`expect-error` input parameter is for internal use only. It should only be set by codeql-action or a fork.");
|
||||||
}
|
}
|
||||||
const apiDetails = (0, api_client_1.getApiDetails)();
|
const apiDetails = (0, api_client_1.getApiDetails)();
|
||||||
const outputDir = actionsUtil.getRequiredInput("output");
|
const outputDir = actionsUtil.getRequiredInput("output");
|
||||||
@@ -162,7 +160,28 @@ async function run() {
|
|||||||
const repositoryNwo = (0, repository_1.parseRepositoryNwo)(util.getRequiredEnvParam("GITHUB_REPOSITORY"));
|
const repositoryNwo = (0, repository_1.parseRepositoryNwo)(util.getRequiredEnvParam("GITHUB_REPOSITORY"));
|
||||||
const gitHubVersion = await (0, api_client_1.getGitHubVersion)();
|
const gitHubVersion = await (0, api_client_1.getGitHubVersion)();
|
||||||
const features = new feature_flags_1.Features(gitHubVersion, repositoryNwo, actionsUtil.getTemporaryDirectory(), logger);
|
const features = new feature_flags_1.Features(gitHubVersion, repositoryNwo, actionsUtil.getTemporaryDirectory(), logger);
|
||||||
const memory = util.getMemoryFlag(actionsUtil.getOptionalInput("ram") || process.env["CODEQL_RAM"], await features.getValue(feature_flags_1.Feature.ScalingReservedRamEnabled));
|
const memory = util.getMemoryFlag(actionsUtil.getOptionalInput("ram") || process.env["CODEQL_RAM"], logger);
|
||||||
|
// Check that `which go` still points at the wrapper script we installed in the `init` Action,
|
||||||
|
// if the corresponding environment variable is set. This is to ensure that there isn't a step
|
||||||
|
// in the workflow after the `init` step which installs a different version of Go and takes
|
||||||
|
// precedence in the PATH, thus potentially circumventing our workaround that allows tracing to work.
|
||||||
|
const goWrapperPath = process.env[environment_1.EnvVar.GO_BINARY_LOCATION];
|
||||||
|
if (process.env[environment_1.EnvVar.DID_AUTOBUILD_GOLANG] !== "true" &&
|
||||||
|
goWrapperPath !== undefined) {
|
||||||
|
const goBinaryPath = await (0, safe_which_1.safeWhich)("go");
|
||||||
|
if (goWrapperPath !== goBinaryPath) {
|
||||||
|
core.warning(`Expected \`which go\` to return ${goWrapperPath}, but got ${goBinaryPath}: please ensure that the correct version of Go is installed before the \`codeql-action/init\` Action is used.`);
|
||||||
|
(0, diagnostics_1.addDiagnostic)(config, languages_1.Language.go, (0, diagnostics_1.makeDiagnostic)("go/workflow/go-installed-after-codeql-init", "Go was installed after the `codeql-action/init` Action was run", {
|
||||||
|
markdownMessage: "To avoid interfering with the CodeQL analysis, perform all installation steps before calling the `github/codeql-action/init` Action.",
|
||||||
|
visibility: {
|
||||||
|
statusPage: true,
|
||||||
|
telemetry: true,
|
||||||
|
cliSummaryTable: true,
|
||||||
|
},
|
||||||
|
severity: "warning",
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
await runAutobuildIfLegacyGoWorkflow(config, logger);
|
await runAutobuildIfLegacyGoWorkflow(config, logger);
|
||||||
dbCreationTimings = await (0, analyze_1.runFinalize)(outputDir, threads, memory, config, logger, features);
|
dbCreationTimings = await (0, analyze_1.runFinalize)(outputDir, threads, memory, config, logger, features);
|
||||||
if (actionsUtil.getRequiredInput("skip-queries") !== "true") {
|
if (actionsUtil.getRequiredInput("skip-queries") !== "true") {
|
||||||
@@ -176,9 +195,10 @@ async function run() {
|
|||||||
dbLocations[language] = util.getCodeQLDatabasePath(config, language);
|
dbLocations[language] = util.getCodeQLDatabasePath(config, language);
|
||||||
}
|
}
|
||||||
core.setOutput("db-locations", dbLocations);
|
core.setOutput("db-locations", dbLocations);
|
||||||
|
core.setOutput("sarif-output", path_1.default.resolve(outputDir));
|
||||||
const uploadInput = actionsUtil.getOptionalInput("upload");
|
const uploadInput = actionsUtil.getOptionalInput("upload");
|
||||||
if (runStats && actionsUtil.getUploadValue(uploadInput) === "always") {
|
if (runStats && actionsUtil.getUploadValue(uploadInput) === "always") {
|
||||||
uploadResult = await uploadLib.uploadFromActions(outputDir, actionsUtil.getRequiredInput("checkout_path"), actionsUtil.getOptionalInput("category"), logger);
|
uploadResult = await uploadLib.uploadFromActions(outputDir, actionsUtil.getRequiredInput("checkout_path"), actionsUtil.getOptionalInput("category"), logger, { considerInvalidRequestUserError: false });
|
||||||
core.setOutput("sarif-id", uploadResult.sarifID);
|
core.setOutput("sarif-id", uploadResult.sarifID);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
14
lib/analyze.js
generated
14
lib/analyze.js
generated
@@ -232,15 +232,13 @@ async function runQueries(sarifFolder, memoryFlag, addSnippetsFlag, threadsFlag,
|
|||||||
}
|
}
|
||||||
statusReport["event_reports"].push(perQueryAlertCountEventReport);
|
statusReport["event_reports"].push(perQueryAlertCountEventReport);
|
||||||
}
|
}
|
||||||
await runPrintLinesOfCode(language);
|
if (!(await features.getValue(feature_flags_1.Feature.AnalysisSummaryV2Enabled, codeql))) {
|
||||||
|
await runPrintLinesOfCode(language);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
logger.info(String(e));
|
|
||||||
if (e instanceof Error) {
|
|
||||||
logger.info(e.stack);
|
|
||||||
}
|
|
||||||
statusReport.analyze_failure_language = language;
|
statusReport.analyze_failure_language = language;
|
||||||
throw new CodeQLAnalysisError(statusReport, `Error running analysis for ${language}: ${e}`);
|
throw new CodeQLAnalysisError(statusReport, `Error running analysis for ${language}: ${util.wrapError(e).message}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return statusReport;
|
return statusReport;
|
||||||
@@ -283,7 +281,7 @@ async function runQueries(sarifFolder, memoryFlag, addSnippetsFlag, threadsFlag,
|
|||||||
fs.writeFileSync(querySuitePath, querySuiteContents);
|
fs.writeFileSync(querySuitePath, querySuiteContents);
|
||||||
logger.debug(`Query suite file for ${language}-${type}...\n${querySuiteContents}`);
|
logger.debug(`Query suite file for ${language}-${type}...\n${querySuiteContents}`);
|
||||||
}
|
}
|
||||||
await codeql.databaseRunQueries(databasePath, searchPath, querySuitePath, queryFlags, optimizeForLastQueryRun);
|
await codeql.databaseRunQueries(databasePath, searchPath, querySuitePath, queryFlags, optimizeForLastQueryRun, features);
|
||||||
logger.debug(`BQRS results produced for ${language} (queries: ${type})"`);
|
logger.debug(`BQRS results produced for ${language} (queries: ${type})"`);
|
||||||
return querySuitePath;
|
return querySuitePath;
|
||||||
}
|
}
|
||||||
@@ -297,7 +295,7 @@ async function runQueries(sarifFolder, memoryFlag, addSnippetsFlag, threadsFlag,
|
|||||||
const querySuitePath = `${databasePath}-queries-${type}.qls`;
|
const querySuitePath = `${databasePath}-queries-${type}.qls`;
|
||||||
fs.writeFileSync(querySuitePath, yaml.dump(querySuite));
|
fs.writeFileSync(querySuitePath, yaml.dump(querySuite));
|
||||||
logger.debug(`BQRS results produced for ${language} (queries: ${type})"`);
|
logger.debug(`BQRS results produced for ${language} (queries: ${type})"`);
|
||||||
await codeql.databaseRunQueries(databasePath, undefined, querySuitePath, queryFlags, optimizeForLastQueryRun);
|
await codeql.databaseRunQueries(databasePath, undefined, querySuitePath, queryFlags, optimizeForLastQueryRun, features);
|
||||||
return querySuitePath;
|
return querySuitePath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
4
lib/analyze.test.js
generated
4
lib/analyze.test.js
generated
@@ -122,7 +122,6 @@ const util = __importStar(require("./util"));
|
|||||||
debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME,
|
debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME,
|
||||||
debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME,
|
debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME,
|
||||||
augmentationProperties: {
|
augmentationProperties: {
|
||||||
injectedMlQueries: false,
|
|
||||||
packsInputCombines: false,
|
packsInputCombines: false,
|
||||||
queriesInputCombines: false,
|
queriesInputCombines: false,
|
||||||
},
|
},
|
||||||
@@ -215,7 +214,7 @@ const util = __importStar(require("./util"));
|
|||||||
});
|
});
|
||||||
function mockCodeQL() {
|
function mockCodeQL() {
|
||||||
return {
|
return {
|
||||||
getVersion: async () => "2.12.2",
|
getVersion: async () => (0, testing_utils_1.makeVersionInfo)("1.0.0"),
|
||||||
databaseRunQueries: sinon.spy(),
|
databaseRunQueries: sinon.spy(),
|
||||||
databaseInterpretResults: async () => "",
|
databaseInterpretResults: async () => "",
|
||||||
databasePrintBaseline: async () => "",
|
databasePrintBaseline: async () => "",
|
||||||
@@ -239,7 +238,6 @@ function createBaseConfig(tmpDir) {
|
|||||||
debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME,
|
debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME,
|
||||||
debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME,
|
debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME,
|
||||||
augmentationProperties: {
|
augmentationProperties: {
|
||||||
injectedMlQueries: false,
|
|
||||||
packsInputCombines: false,
|
packsInputCombines: false,
|
||||||
queriesInputCombines: false,
|
queriesInputCombines: false,
|
||||||
},
|
},
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
157
lib/api-client.js
generated
157
lib/api-client.js
generated
@@ -26,14 +26,12 @@ 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.computeAutomationID = exports.getAutomationID = exports.getAnalysisKey = exports.getWorkflowRelativePath = exports.sendStatusReport = exports.createStatusReportBase = exports.getGitHubVersion = exports.getGitHubVersionFromApi = exports.getApiClientWithExternalAuth = exports.getApiClient = exports.getApiDetails = exports.DisallowedAPIVersionReason = void 0;
|
exports.computeAutomationID = exports.getAutomationID = exports.getAnalysisKey = exports.getWorkflowRelativePath = exports.getGitHubVersion = exports.getGitHubVersionFromApi = exports.getApiClientWithExternalAuth = exports.getApiClient = exports.getApiDetails = exports.DisallowedAPIVersionReason = void 0;
|
||||||
const os = __importStar(require("os"));
|
|
||||||
const core = __importStar(require("@actions/core"));
|
const core = __importStar(require("@actions/core"));
|
||||||
const githubUtils = __importStar(require("@actions/github/lib/utils"));
|
const githubUtils = __importStar(require("@actions/github/lib/utils"));
|
||||||
const retry = __importStar(require("@octokit/plugin-retry"));
|
const retry = __importStar(require("@octokit/plugin-retry"));
|
||||||
const console_log_level_1 = __importDefault(require("console-log-level"));
|
const console_log_level_1 = __importDefault(require("console-log-level"));
|
||||||
const actions_util_1 = require("./actions-util");
|
const actions_util_1 = require("./actions-util");
|
||||||
const environment_1 = require("./environment");
|
|
||||||
const util_1 = require("./util");
|
const util_1 = require("./util");
|
||||||
const GITHUB_ENTERPRISE_VERSION_HEADER = "x-github-enterprise-version";
|
const GITHUB_ENTERPRISE_VERSION_HEADER = "x-github-enterprise-version";
|
||||||
var DisallowedAPIVersionReason;
|
var DisallowedAPIVersionReason;
|
||||||
@@ -104,159 +102,6 @@ async function getGitHubVersion() {
|
|||||||
return cachedGitHubVersion;
|
return cachedGitHubVersion;
|
||||||
}
|
}
|
||||||
exports.getGitHubVersion = getGitHubVersion;
|
exports.getGitHubVersion = getGitHubVersion;
|
||||||
/**
|
|
||||||
* Compose a StatusReport.
|
|
||||||
*
|
|
||||||
* @param actionName The name of the action, e.g. 'init', 'finish', 'upload-sarif'
|
|
||||||
* @param status The status. Must be 'success', 'failure', or 'starting'
|
|
||||||
* @param startedAt The time this action started executing.
|
|
||||||
* @param cause Cause of failure (only supply if status is 'failure')
|
|
||||||
* @param exception Exception (only supply if status is 'failure')
|
|
||||||
*/
|
|
||||||
async function createStatusReportBase(actionName, status, actionStartedAt, cause, exception) {
|
|
||||||
const commitOid = (0, actions_util_1.getOptionalInput)("sha") || process.env["GITHUB_SHA"] || "";
|
|
||||||
const ref = await (0, actions_util_1.getRef)();
|
|
||||||
const jobRunUUID = process.env[environment_1.EnvVar.JOB_RUN_UUID] || "";
|
|
||||||
const workflowRunID = (0, actions_util_1.getWorkflowRunID)();
|
|
||||||
const workflowRunAttempt = (0, actions_util_1.getWorkflowRunAttempt)();
|
|
||||||
const workflowName = process.env["GITHUB_WORKFLOW"] || "";
|
|
||||||
const jobName = process.env["GITHUB_JOB"] || "";
|
|
||||||
const analysis_key = await getAnalysisKey();
|
|
||||||
let workflowStartedAt = process.env[environment_1.EnvVar.WORKFLOW_STARTED_AT];
|
|
||||||
if (workflowStartedAt === undefined) {
|
|
||||||
workflowStartedAt = actionStartedAt.toISOString();
|
|
||||||
core.exportVariable(environment_1.EnvVar.WORKFLOW_STARTED_AT, workflowStartedAt);
|
|
||||||
}
|
|
||||||
const runnerOs = (0, util_1.getRequiredEnvParam)("RUNNER_OS");
|
|
||||||
const codeQlCliVersion = (0, util_1.getCachedCodeQlVersion)();
|
|
||||||
const actionRef = process.env["GITHUB_ACTION_REF"];
|
|
||||||
const testingEnvironment = process.env[environment_1.EnvVar.TESTING_ENVIRONMENT] || "";
|
|
||||||
// re-export the testing environment variable so that it is available to subsequent steps,
|
|
||||||
// even if it was only set for this step
|
|
||||||
if (testingEnvironment !== "") {
|
|
||||||
core.exportVariable(environment_1.EnvVar.TESTING_ENVIRONMENT, testingEnvironment);
|
|
||||||
}
|
|
||||||
const statusReport = {
|
|
||||||
job_run_uuid: jobRunUUID,
|
|
||||||
workflow_run_id: workflowRunID,
|
|
||||||
workflow_run_attempt: workflowRunAttempt,
|
|
||||||
workflow_name: workflowName,
|
|
||||||
job_name: jobName,
|
|
||||||
analysis_key,
|
|
||||||
commit_oid: commitOid,
|
|
||||||
ref,
|
|
||||||
action_name: actionName,
|
|
||||||
action_ref: actionRef,
|
|
||||||
action_oid: "unknown",
|
|
||||||
started_at: workflowStartedAt,
|
|
||||||
action_started_at: actionStartedAt.toISOString(),
|
|
||||||
status,
|
|
||||||
testing_environment: testingEnvironment,
|
|
||||||
runner_os: runnerOs,
|
|
||||||
action_version: (0, actions_util_1.getActionVersion)(),
|
|
||||||
};
|
|
||||||
// Add optional parameters
|
|
||||||
if (cause) {
|
|
||||||
statusReport.cause = cause;
|
|
||||||
}
|
|
||||||
if (exception) {
|
|
||||||
statusReport.exception = exception;
|
|
||||||
}
|
|
||||||
if (status === "success" ||
|
|
||||||
status === "failure" ||
|
|
||||||
status === "aborted" ||
|
|
||||||
status === "user-error") {
|
|
||||||
statusReport.completed_at = new Date().toISOString();
|
|
||||||
}
|
|
||||||
const matrix = (0, actions_util_1.getRequiredInput)("matrix");
|
|
||||||
if (matrix) {
|
|
||||||
statusReport.matrix_vars = matrix;
|
|
||||||
}
|
|
||||||
if ("RUNNER_ARCH" in process.env) {
|
|
||||||
// RUNNER_ARCH is available only in GHES 3.4 and later
|
|
||||||
// Values other than X86, X64, ARM, or ARM64 are discarded server side
|
|
||||||
statusReport.runner_arch = process.env["RUNNER_ARCH"];
|
|
||||||
}
|
|
||||||
if (runnerOs === "Windows" || runnerOs === "macOS") {
|
|
||||||
statusReport.runner_os_release = os.release();
|
|
||||||
}
|
|
||||||
if (codeQlCliVersion !== undefined) {
|
|
||||||
statusReport.codeql_version = codeQlCliVersion;
|
|
||||||
}
|
|
||||||
return statusReport;
|
|
||||||
}
|
|
||||||
exports.createStatusReportBase = createStatusReportBase;
|
|
||||||
const GENERIC_403_MSG = "The repo on which this action is running is not opted-in to CodeQL code scanning.";
|
|
||||||
const GENERIC_404_MSG = "Not authorized to use the CodeQL code scanning feature on this repo.";
|
|
||||||
const OUT_OF_DATE_MSG = "CodeQL Action is out-of-date. Please upgrade to the latest version of codeql-action.";
|
|
||||||
const INCOMPATIBLE_MSG = "CodeQL Action version is incompatible with the code scanning endpoint. Please update to a compatible version of codeql-action.";
|
|
||||||
/**
|
|
||||||
* Send a status report to the code_scanning/analysis/status endpoint.
|
|
||||||
*
|
|
||||||
* Optionally checks the response from the API endpoint and sets the action
|
|
||||||
* as failed if the status report failed. This is only expected to be used
|
|
||||||
* when sending a 'starting' report.
|
|
||||||
*
|
|
||||||
* Returns whether sending the status report was successful of not.
|
|
||||||
*/
|
|
||||||
async function sendStatusReport(statusReport) {
|
|
||||||
const statusReportJSON = JSON.stringify(statusReport);
|
|
||||||
core.debug(`Sending status report: ${statusReportJSON}`);
|
|
||||||
// If in test mode we don't want to upload the results
|
|
||||||
if ((0, util_1.isInTestMode)()) {
|
|
||||||
core.debug("In test mode. Status reports are not uploaded.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
const nwo = (0, util_1.getRequiredEnvParam)("GITHUB_REPOSITORY");
|
|
||||||
const [owner, repo] = nwo.split("/");
|
|
||||||
const client = getApiClient();
|
|
||||||
try {
|
|
||||||
await client.request("PUT /repos/:owner/:repo/code-scanning/analysis/status", {
|
|
||||||
owner,
|
|
||||||
repo,
|
|
||||||
data: statusReportJSON,
|
|
||||||
});
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
console.log(e);
|
|
||||||
if ((0, util_1.isHTTPError)(e)) {
|
|
||||||
switch (e.status) {
|
|
||||||
case 403:
|
|
||||||
if ((0, actions_util_1.getWorkflowEventName)() === "push" &&
|
|
||||||
process.env["GITHUB_ACTOR"] === "dependabot[bot]") {
|
|
||||||
core.setFailed('Workflows triggered by Dependabot on the "push" event run with read-only access. ' +
|
|
||||||
"Uploading Code Scanning results requires write access. " +
|
|
||||||
'To use Code Scanning with Dependabot, please ensure you are using the "pull_request" event for this workflow and avoid triggering on the "push" event for Dependabot branches. ' +
|
|
||||||
"See https://docs.github.com/en/code-security/secure-coding/configuring-code-scanning#scanning-on-push for more information on how to configure these events.");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
core.setFailed(e.message || GENERIC_403_MSG);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
case 404:
|
|
||||||
core.setFailed(GENERIC_404_MSG);
|
|
||||||
return false;
|
|
||||||
case 422:
|
|
||||||
// schema incompatibility when reporting status
|
|
||||||
// this means that this action version is no longer compatible with the API
|
|
||||||
// we still want to continue as it is likely the analysis endpoint will work
|
|
||||||
if ((0, util_1.getRequiredEnvParam)("GITHUB_SERVER_URL") !== util_1.GITHUB_DOTCOM_URL) {
|
|
||||||
core.debug(INCOMPATIBLE_MSG);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
core.debug(OUT_OF_DATE_MSG);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// something else has gone wrong and the request/response will be logged by octokit
|
|
||||||
// it's possible this is a transient error and we should continue scanning
|
|
||||||
core.error("An unexpected error occurred when sending code scanning status report.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.sendStatusReport = sendStatusReport;
|
|
||||||
/**
|
/**
|
||||||
* Get the path of the currently executing workflow relative to the repository root.
|
* Get the path of the currently executing workflow relative to the repository root.
|
||||||
*/
|
*/
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
|||||||
{ "maximumVersion": "3.10", "minimumVersion": "3.6" }
|
{ "maximumVersion": "3.11", "minimumVersion": "3.7" }
|
||||||
|
|||||||
20
lib/autobuild-action.js
generated
20
lib/autobuild-action.js
generated
@@ -28,20 +28,19 @@ const actions_util_1 = require("./actions-util");
|
|||||||
const api_client_1 = require("./api-client");
|
const api_client_1 = require("./api-client");
|
||||||
const autobuild_1 = require("./autobuild");
|
const autobuild_1 = require("./autobuild");
|
||||||
const configUtils = __importStar(require("./config-utils"));
|
const configUtils = __importStar(require("./config-utils"));
|
||||||
const environment_1 = require("./environment");
|
|
||||||
const languages_1 = require("./languages");
|
|
||||||
const logging_1 = require("./logging");
|
const logging_1 = require("./logging");
|
||||||
|
const status_report_1 = require("./status-report");
|
||||||
const util_1 = require("./util");
|
const util_1 = require("./util");
|
||||||
async function sendCompletedStatusReport(startedAt, allLanguages, failingLanguage, cause) {
|
async function sendCompletedStatusReport(logger, startedAt, allLanguages, failingLanguage, cause) {
|
||||||
(0, util_1.initializeEnvironment)((0, actions_util_1.getActionVersion)());
|
(0, util_1.initializeEnvironment)((0, actions_util_1.getActionVersion)());
|
||||||
const status = (0, actions_util_1.getActionsStatus)(cause, failingLanguage);
|
const status = (0, status_report_1.getActionsStatus)(cause, failingLanguage);
|
||||||
const statusReportBase = await (0, api_client_1.createStatusReportBase)("autobuild", status, startedAt, cause?.message, cause?.stack);
|
const statusReportBase = await (0, status_report_1.createStatusReportBase)("autobuild", status, startedAt, await (0, util_1.checkDiskUsage)(logger), cause?.message, cause?.stack);
|
||||||
const statusReport = {
|
const statusReport = {
|
||||||
...statusReportBase,
|
...statusReportBase,
|
||||||
autobuild_languages: allLanguages.join(","),
|
autobuild_languages: allLanguages.join(","),
|
||||||
autobuild_failure: failingLanguage,
|
autobuild_failure: failingLanguage,
|
||||||
};
|
};
|
||||||
await (0, api_client_1.sendStatusReport)(statusReport);
|
await (0, status_report_1.sendStatusReport)(statusReport);
|
||||||
}
|
}
|
||||||
async function run() {
|
async function run() {
|
||||||
const startedAt = new Date();
|
const startedAt = new Date();
|
||||||
@@ -49,7 +48,7 @@ async function run() {
|
|||||||
let currentLanguage = undefined;
|
let currentLanguage = undefined;
|
||||||
let languages = undefined;
|
let languages = undefined;
|
||||||
try {
|
try {
|
||||||
if (!(await (0, api_client_1.sendStatusReport)(await (0, api_client_1.createStatusReportBase)("autobuild", "starting", startedAt)))) {
|
if (!(await (0, status_report_1.sendStatusReport)(await (0, status_report_1.createStatusReportBase)("autobuild", "starting", startedAt, await (0, util_1.checkDiskUsage)(logger))))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const gitHubVersion = await (0, api_client_1.getGitHubVersion)();
|
const gitHubVersion = await (0, api_client_1.getGitHubVersion)();
|
||||||
@@ -68,19 +67,16 @@ async function run() {
|
|||||||
for (const language of languages) {
|
for (const language of languages) {
|
||||||
currentLanguage = language;
|
currentLanguage = language;
|
||||||
await (0, autobuild_1.runAutobuild)(language, config, logger);
|
await (0, autobuild_1.runAutobuild)(language, config, logger);
|
||||||
if (language === languages_1.Language.go) {
|
|
||||||
core.exportVariable(environment_1.EnvVar.DID_AUTOBUILD_GOLANG, "true");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (unwrappedError) {
|
catch (unwrappedError) {
|
||||||
const error = (0, util_1.wrapError)(unwrappedError);
|
const error = (0, util_1.wrapError)(unwrappedError);
|
||||||
core.setFailed(`We were unable to automatically build your code. Please replace the call to the autobuild action with your custom build steps. ${error.message}`);
|
core.setFailed(`We were unable to automatically build your code. Please replace the call to the autobuild action with your custom build steps. ${error.message}`);
|
||||||
await sendCompletedStatusReport(startedAt, languages ?? [], currentLanguage, error);
|
await sendCompletedStatusReport(logger, startedAt, languages ?? [], currentLanguage, error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await sendCompletedStatusReport(startedAt, languages ?? []);
|
await sendCompletedStatusReport(logger, startedAt, languages ?? []);
|
||||||
}
|
}
|
||||||
async function runWrapper() {
|
async function runWrapper() {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"autobuild-action.js","sourceRoot":"","sources":["../src/autobuild-action.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC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,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;KACxE;AACH,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}
|
{"version":3,"file":"autobuild-action.js","sourceRoot":"","sources":["../src/autobuild-action.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AAEtC,iDAIwB;AACxB,6CAAgD;AAChD,2CAAwE;AACxE,4DAA8C;AAE9C,uCAAqD;AACrD,mDAKyB;AACzB,iCAKgB;AAShB,KAAK,UAAU,yBAAyB,CACtC,MAAc,EACd,SAAe,EACf,YAAsB,EACtB,eAAwB,EACxB,KAAa;IAEb,IAAA,4BAAqB,EAAC,IAAA,+BAAgB,GAAE,CAAC,CAAC;IAE1C,MAAM,MAAM,GAAG,IAAA,gCAAgB,EAAC,KAAK,EAAE,eAAe,CAAC,CAAC;IACxD,MAAM,gBAAgB,GAAG,MAAM,IAAA,sCAAsB,EACnD,WAAW,EACX,MAAM,EACN,SAAS,EACT,MAAM,IAAA,qBAAc,EAAC,MAAM,CAAC,EAC5B,KAAK,EAAE,OAAO,EACd,KAAK,EAAE,KAAK,CACb,CAAC;IACF,MAAM,YAAY,GAA0B;QAC1C,GAAG,gBAAgB;QACnB,mBAAmB,EAAE,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC;QAC3C,iBAAiB,EAAE,eAAe;KACnC,CAAC;IACF,MAAM,IAAA,gCAAgB,EAAC,YAAY,CAAC,CAAC;AACvC,CAAC;AAED,KAAK,UAAU,GAAG;IAChB,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;IAC7B,MAAM,MAAM,GAAG,IAAA,0BAAgB,GAAE,CAAC;IAClC,IAAI,eAAe,GAAyB,SAAS,CAAC;IACtD,IAAI,SAAS,GAA2B,SAAS,CAAC;IAClD,IAAI;QACF,IACE,CAAC,CAAC,MAAM,IAAA,gCAAgB,EACtB,MAAM,IAAA,sCAAsB,EAC1B,WAAW,EACX,UAAU,EACV,SAAS,EACT,MAAM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E,CAAC;AAED,KAAK,UAAU,UAAU;IACvB,IAAI;QACF,MAAM,GAAG,EAAE,CAAC;KACb;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,CAAC,SAAS,CAAC,4BAA4B,IAAA,gBAAS,EAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;KACxE;AACH,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}
|
||||||
62
lib/autobuild.js
generated
62
lib/autobuild.js
generated
@@ -1,8 +1,38 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||||
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||||
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||||
|
}
|
||||||
|
Object.defineProperty(o, k2, desc);
|
||||||
|
}) : (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
o[k2] = m[k];
|
||||||
|
}));
|
||||||
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||||
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||||
|
}) : function(o, v) {
|
||||||
|
o["default"] = v;
|
||||||
|
});
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
|
__setModuleDefault(result, mod);
|
||||||
|
return result;
|
||||||
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.runAutobuild = exports.determineAutobuildLanguages = void 0;
|
exports.runAutobuild = exports.determineAutobuildLanguages = void 0;
|
||||||
|
const core = __importStar(require("@actions/core"));
|
||||||
|
const actions_util_1 = require("./actions-util");
|
||||||
|
const api_client_1 = require("./api-client");
|
||||||
const codeql_1 = require("./codeql");
|
const codeql_1 = require("./codeql");
|
||||||
|
const environment_1 = require("./environment");
|
||||||
|
const feature_flags_1 = require("./feature-flags");
|
||||||
const languages_1 = require("./languages");
|
const languages_1 = require("./languages");
|
||||||
|
const repository_1 = require("./repository");
|
||||||
|
const util_1 = require("./util");
|
||||||
async function determineAutobuildLanguages(config, logger) {
|
async function determineAutobuildLanguages(config, logger) {
|
||||||
// Attempt to find a language to autobuild
|
// Attempt to find a language to autobuild
|
||||||
// We want pick the dominant language in the repo from the ones we're able to build
|
// We want pick the dominant language in the repo from the ones we're able to build
|
||||||
@@ -70,10 +100,42 @@ async function determineAutobuildLanguages(config, logger) {
|
|||||||
return languages;
|
return languages;
|
||||||
}
|
}
|
||||||
exports.determineAutobuildLanguages = determineAutobuildLanguages;
|
exports.determineAutobuildLanguages = determineAutobuildLanguages;
|
||||||
|
async function setupCppAutobuild(codeql, logger) {
|
||||||
|
const envVar = feature_flags_1.featureConfig[feature_flags_1.Feature.CppDependencyInstallation].envVar;
|
||||||
|
const featureName = "C++ automatic installation of dependencies";
|
||||||
|
const envDoc = "https://docs.github.com/en/actions/learn-github-actions/variables#defining-environment-variables-for-a-single-workflow";
|
||||||
|
const gitHubVersion = await (0, api_client_1.getGitHubVersion)();
|
||||||
|
const repositoryNwo = (0, repository_1.parseRepositoryNwo)((0, util_1.getRequiredEnvParam)("GITHUB_REPOSITORY"));
|
||||||
|
const features = new feature_flags_1.Features(gitHubVersion, repositoryNwo, (0, actions_util_1.getTemporaryDirectory)(), logger);
|
||||||
|
if (await features.getValue(feature_flags_1.Feature.CppDependencyInstallation, codeql)) {
|
||||||
|
// disable autoinstall on self-hosted runners unless explicitly requested
|
||||||
|
if (process.env["RUNNER_ENVIRONMENT"] === "self-hosted" &&
|
||||||
|
process.env[envVar] !== "true") {
|
||||||
|
logger.info(`Disabling ${featureName} as we are on a self-hosted runner.${(0, actions_util_1.getWorkflowEventName)() !== "dynamic"
|
||||||
|
? ` To override this, set the ${envVar} environment variable to 'true' in your workflow (see ${envDoc}).`
|
||||||
|
: ""}`);
|
||||||
|
core.exportVariable(envVar, "false");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
logger.info(`Enabling ${featureName}. This can be disabled by setting the ${envVar} environment variable to 'false' (see ${envDoc}).`);
|
||||||
|
core.exportVariable(envVar, "true");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
logger.info(`Disabling ${featureName}.`);
|
||||||
|
core.exportVariable(envVar, "false");
|
||||||
|
}
|
||||||
|
}
|
||||||
async function runAutobuild(language, config, logger) {
|
async function runAutobuild(language, config, logger) {
|
||||||
logger.startGroup(`Attempting to automatically build ${language} code`);
|
logger.startGroup(`Attempting to automatically build ${language} code`);
|
||||||
const codeQL = await (0, codeql_1.getCodeQL)(config.codeQLCmd);
|
const codeQL = await (0, codeql_1.getCodeQL)(config.codeQLCmd);
|
||||||
|
if (language === languages_1.Language.cpp) {
|
||||||
|
await setupCppAutobuild(codeQL, logger);
|
||||||
|
}
|
||||||
await codeQL.runAutobuild(language);
|
await codeQL.runAutobuild(language);
|
||||||
|
if (language === languages_1.Language.go) {
|
||||||
|
core.exportVariable(environment_1.EnvVar.DID_AUTOBUILD_GOLANG, "true");
|
||||||
|
}
|
||||||
logger.endGroup();
|
logger.endGroup();
|
||||||
}
|
}
|
||||||
exports.runAutobuild = runAutobuild;
|
exports.runAutobuild = runAutobuild;
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"autobuild.js","sourceRoot":"","sources":["../src/autobuild.ts"],"names":[],"mappings":";;;AAAA,qCAAqC;AAErC,2CAAyD;AAGlD,KAAK,UAAU,2BAA2B,CAC/C,MAA0B,EAC1B,MAAc;IAEd,0CAA0C;IAC1C,mFAAmF;IACnF,oFAAoF;IACpF,4EAA4E;IAC5E,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AAC,oBAAoB,EAAE,MAAM,CAAC,CAAC;KAC1D;IACD,MAAM,CAAC,QAAQ,EAAE,CAAC;AACpB,CAAC;AAfD,oCAeC"}
|
||||||
285
lib/codeql.js
generated
285
lib/codeql.js
generated
@@ -23,7 +23,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.getGeneratedCodeScanningConfigPath = exports.getTrapCachingExtractorConfigArgsForLang = exports.getTrapCachingExtractorConfigArgs = exports.getExtraOptions = exports.getCodeQLForCmd = exports.getCodeQLForTesting = exports.getCachedCodeQL = exports.setCodeQL = exports.getCodeQL = exports.setupCodeQL = exports.CODEQL_VERSION_RESOLVE_ENVIRONMENT = exports.CODEQL_VERSION_INIT_WITH_QLCONFIG = exports.CODEQL_VERSION_EXPORT_CODE_SCANNING_CONFIG = exports.CODEQL_VERSION_SECURITY_EXPERIMENTAL_SUITE = exports.CODEQL_VERSION_BETTER_RESOLVE_LANGUAGES = exports.CODEQL_VERSION_GHES_PACK_DOWNLOAD = exports.CommandInvocationError = void 0;
|
exports.getGeneratedCodeScanningConfigPath = exports.getTrapCachingExtractorConfigArgsForLang = exports.getTrapCachingExtractorConfigArgs = exports.getExtraOptions = exports.getCodeQLForCmd = exports.getCodeQLForTesting = exports.getCachedCodeQL = exports.setCodeQL = exports.getCodeQL = exports.setupCodeQL = exports.CODEQL_VERSION_LANGUAGE_ALIASING = exports.CODEQL_VERSION_LANGUAGE_BASELINE_CONFIG = exports.CODEQL_VERSION_RESOLVE_ENVIRONMENT = exports.CODEQL_VERSION_DIAGNOSTICS_EXPORT_FIXED = exports.CODEQL_VERSION_BETTER_NO_CODE_ERROR_MESSAGE = exports.CODEQL_VERSION_INIT_WITH_QLCONFIG = exports.CODEQL_VERSION_EXPORT_CODE_SCANNING_CONFIG = exports.CODEQL_VERSION_SECURITY_EXPERIMENTAL_SUITE = exports.CommandInvocationError = void 0;
|
||||||
const fs = __importStar(require("fs"));
|
const fs = __importStar(require("fs"));
|
||||||
const path = __importStar(require("path"));
|
const path = __importStar(require("path"));
|
||||||
const core = __importStar(require("@actions/core"));
|
const core = __importStar(require("@actions/core"));
|
||||||
@@ -31,19 +31,31 @@ const toolrunner = __importStar(require("@actions/exec/lib/toolrunner"));
|
|||||||
const yaml = __importStar(require("js-yaml"));
|
const yaml = __importStar(require("js-yaml"));
|
||||||
const actions_util_1 = require("./actions-util");
|
const actions_util_1 = require("./actions-util");
|
||||||
const environment_1 = require("./environment");
|
const environment_1 = require("./environment");
|
||||||
const error_matcher_1 = require("./error-matcher");
|
|
||||||
const feature_flags_1 = require("./feature-flags");
|
const feature_flags_1 = require("./feature-flags");
|
||||||
const languages_1 = require("./languages");
|
const languages_1 = require("./languages");
|
||||||
const setupCodeql = __importStar(require("./setup-codeql"));
|
const setupCodeql = __importStar(require("./setup-codeql"));
|
||||||
const toolrunner_error_catcher_1 = require("./toolrunner-error-catcher");
|
|
||||||
const util = __importStar(require("./util"));
|
const util = __importStar(require("./util"));
|
||||||
const util_1 = require("./util");
|
const util_1 = require("./util");
|
||||||
class CommandInvocationError extends Error {
|
class CommandInvocationError extends Error {
|
||||||
constructor(cmd, args, exitCode, error, output) {
|
constructor(cmd, args, exitCode, stderr, stdout) {
|
||||||
super(`Failure invoking ${cmd} with arguments ${args}.\n
|
const prettyCommand = [cmd, ...args]
|
||||||
Exit code ${exitCode} and error was:\n
|
.map((x) => (x.includes(" ") ? `'${x}'` : x))
|
||||||
${error}`);
|
.join(" ");
|
||||||
this.output = output;
|
const fatalErrors = extractFatalErrors(stderr);
|
||||||
|
const lastLine = stderr.trim().split("\n").pop()?.trim();
|
||||||
|
let error = fatalErrors
|
||||||
|
? ` and error was: ${fatalErrors.trim()}`
|
||||||
|
: lastLine
|
||||||
|
? ` and last log line was: ${lastLine}`
|
||||||
|
: "";
|
||||||
|
if (error[error.length - 1] !== ".") {
|
||||||
|
error += ".";
|
||||||
|
}
|
||||||
|
super(`Encountered a fatal error while running "${prettyCommand}". ` +
|
||||||
|
`Exit code was ${exitCode}${error} See the logs for more details.`);
|
||||||
|
this.exitCode = exitCode;
|
||||||
|
this.stderr = stderr;
|
||||||
|
this.stdout = stdout;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.CommandInvocationError = CommandInvocationError;
|
exports.CommandInvocationError = CommandInvocationError;
|
||||||
@@ -60,25 +72,25 @@ let cachedCodeQL = undefined;
|
|||||||
* The version flags below can be used to conditionally enable certain features
|
* The version flags below can be used to conditionally enable certain features
|
||||||
* on versions newer than this.
|
* on versions newer than this.
|
||||||
*/
|
*/
|
||||||
const CODEQL_MINIMUM_VERSION = "2.9.4";
|
const CODEQL_MINIMUM_VERSION = "2.10.5";
|
||||||
/**
|
/**
|
||||||
* This version will shortly become the oldest version of CodeQL that the Action will run with.
|
* This version will shortly become the oldest version of CodeQL that the Action will run with.
|
||||||
*/
|
*/
|
||||||
const CODEQL_NEXT_MINIMUM_VERSION = "2.9.4";
|
const CODEQL_NEXT_MINIMUM_VERSION = "2.10.5";
|
||||||
/**
|
/**
|
||||||
|
* This is the version of GHES that was most recently deprecated.
|
||||||
|
*/
|
||||||
|
const GHES_VERSION_MOST_RECENTLY_DEPRECATED = "3.6";
|
||||||
|
/**
|
||||||
|
* This is the deprecation date for the version of GHES that was most recently deprecated.
|
||||||
|
*/
|
||||||
|
const GHES_MOST_RECENT_DEPRECATION_DATE = "2023-09-12";
|
||||||
|
/*
|
||||||
* Versions of CodeQL that version-flag certain functionality in the Action.
|
* Versions of CodeQL that version-flag certain functionality in the Action.
|
||||||
* For convenience, please keep these in descending order. Once a version
|
* For convenience, please keep these in descending order. Once a version
|
||||||
* flag is older than the oldest supported version above, it may be removed.
|
* flag is older than the oldest supported version above, it may be removed.
|
||||||
*/
|
*/
|
||||||
const CODEQL_VERSION_LUA_TRACER_CONFIG = "2.10.0";
|
|
||||||
const CODEQL_VERSION_LUA_TRACING_GO_WINDOWS_FIXED = "2.10.4";
|
|
||||||
exports.CODEQL_VERSION_GHES_PACK_DOWNLOAD = "2.10.4";
|
|
||||||
const CODEQL_VERSION_FILE_BASELINE_INFORMATION = "2.11.3";
|
const CODEQL_VERSION_FILE_BASELINE_INFORMATION = "2.11.3";
|
||||||
/**
|
|
||||||
* Previous versions had the option already, but were missing the
|
|
||||||
* --extractor-options-verbosity that we need.
|
|
||||||
*/
|
|
||||||
exports.CODEQL_VERSION_BETTER_RESOLVE_LANGUAGES = "2.10.3";
|
|
||||||
/**
|
/**
|
||||||
* Versions 2.11.1+ of the CodeQL Bundle include a `security-experimental` built-in query suite for
|
* Versions 2.11.1+ of the CodeQL Bundle include a `security-experimental` built-in query suite for
|
||||||
* each language.
|
* each language.
|
||||||
@@ -93,10 +105,27 @@ exports.CODEQL_VERSION_EXPORT_CODE_SCANNING_CONFIG = "2.12.3";
|
|||||||
* Versions 2.12.4+ of the CodeQL CLI support the `--qlconfig-file` flag in calls to `database init`.
|
* Versions 2.12.4+ of the CodeQL CLI support the `--qlconfig-file` flag in calls to `database init`.
|
||||||
*/
|
*/
|
||||||
exports.CODEQL_VERSION_INIT_WITH_QLCONFIG = "2.12.4";
|
exports.CODEQL_VERSION_INIT_WITH_QLCONFIG = "2.12.4";
|
||||||
|
/**
|
||||||
|
* Versions 2.12.4+ of the CodeQL CLI provide a better error message when `database finalize`
|
||||||
|
* determines that no code has been found.
|
||||||
|
*/
|
||||||
|
exports.CODEQL_VERSION_BETTER_NO_CODE_ERROR_MESSAGE = "2.12.4";
|
||||||
|
/**
|
||||||
|
* Versions 2.13.1+ of the CodeQL CLI fix a bug where diagnostics export could produce invalid SARIF.
|
||||||
|
*/
|
||||||
|
exports.CODEQL_VERSION_DIAGNOSTICS_EXPORT_FIXED = "2.13.1";
|
||||||
/**
|
/**
|
||||||
* Versions 2.13.4+ of the CodeQL CLI support the `resolve build-environment` command.
|
* Versions 2.13.4+ of the CodeQL CLI support the `resolve build-environment` command.
|
||||||
*/
|
*/
|
||||||
exports.CODEQL_VERSION_RESOLVE_ENVIRONMENT = "2.13.4";
|
exports.CODEQL_VERSION_RESOLVE_ENVIRONMENT = "2.13.4";
|
||||||
|
/**
|
||||||
|
* Versions 2.14.2+ of the CodeQL CLI support language-specific baseline configuration.
|
||||||
|
*/
|
||||||
|
exports.CODEQL_VERSION_LANGUAGE_BASELINE_CONFIG = "2.14.2";
|
||||||
|
/**
|
||||||
|
* Versions 2.14.4+ of the CodeQL CLI support language aliasing.
|
||||||
|
*/
|
||||||
|
exports.CODEQL_VERSION_LANGUAGE_ALIASING = "2.14.4";
|
||||||
/**
|
/**
|
||||||
* Set up CodeQL CLI access.
|
* Set up CodeQL CLI access.
|
||||||
*
|
*
|
||||||
@@ -164,7 +193,9 @@ function resolveFunction(partialCodeql, methodName, defaultImplementation) {
|
|||||||
function setCodeQL(partialCodeql) {
|
function setCodeQL(partialCodeql) {
|
||||||
cachedCodeQL = {
|
cachedCodeQL = {
|
||||||
getPath: resolveFunction(partialCodeql, "getPath", () => "/tmp/dummy-path"),
|
getPath: resolveFunction(partialCodeql, "getPath", () => "/tmp/dummy-path"),
|
||||||
getVersion: resolveFunction(partialCodeql, "getVersion", () => new Promise((resolve) => resolve("1.0.0"))),
|
getVersion: resolveFunction(partialCodeql, "getVersion", () => new Promise((resolve) => resolve({
|
||||||
|
version: "1.0.0",
|
||||||
|
}))),
|
||||||
printVersion: resolveFunction(partialCodeql, "printVersion"),
|
printVersion: resolveFunction(partialCodeql, "printVersion"),
|
||||||
databaseInitCluster: resolveFunction(partialCodeql, "databaseInitCluster"),
|
databaseInitCluster: resolveFunction(partialCodeql, "databaseInitCluster"),
|
||||||
runAutobuild: resolveFunction(partialCodeql, "runAutobuild"),
|
runAutobuild: resolveFunction(partialCodeql, "runAutobuild"),
|
||||||
@@ -226,7 +257,13 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
|||||||
async getVersion() {
|
async getVersion() {
|
||||||
let result = util.getCachedCodeQlVersion();
|
let result = util.getCachedCodeQlVersion();
|
||||||
if (result === undefined) {
|
if (result === undefined) {
|
||||||
result = (await runTool(cmd, ["version", "--format=terse"])).trim();
|
const output = await runTool(cmd, ["version", "--format=json"]);
|
||||||
|
try {
|
||||||
|
result = JSON.parse(output);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
throw Error(`Invalid JSON output from \`version --format=json\`: ${output}`);
|
||||||
|
}
|
||||||
util.cacheCodeQlVersion(result);
|
util.cacheCodeQlVersion(result);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@@ -240,17 +277,6 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
|||||||
extraArgs.push("--begin-tracing");
|
extraArgs.push("--begin-tracing");
|
||||||
extraArgs.push(...(await getTrapCachingExtractorConfigArgs(config)));
|
extraArgs.push(...(await getTrapCachingExtractorConfigArgs(config)));
|
||||||
extraArgs.push(`--trace-process-name=${processName}`);
|
extraArgs.push(`--trace-process-name=${processName}`);
|
||||||
if (
|
|
||||||
// There's a bug in Lua tracing for Go on Windows in versions earlier than
|
|
||||||
// `CODEQL_VERSION_LUA_TRACING_GO_WINDOWS_FIXED`, so don't use Lua tracing
|
|
||||||
// when tracing Go on Windows on these CodeQL versions.
|
|
||||||
(await util.codeQlVersionAbove(this, CODEQL_VERSION_LUA_TRACER_CONFIG)) &&
|
|
||||||
config.languages.includes(languages_1.Language.go) &&
|
|
||||||
(0, languages_1.isTracedLanguage)(languages_1.Language.go) &&
|
|
||||||
process.platform === "win32" &&
|
|
||||||
!(await util.codeQlVersionAbove(this, CODEQL_VERSION_LUA_TRACING_GO_WINDOWS_FIXED))) {
|
|
||||||
extraArgs.push("--no-internal-use-lua-tracing");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// A code scanning config file is only generated if the CliConfigFileEnabled feature flag is enabled.
|
// A code scanning config file is only generated if the CliConfigFileEnabled feature flag is enabled.
|
||||||
const codeScanningConfigFile = await generateCodeScanningConfig(codeql, config, features, logger);
|
const codeScanningConfigFile = await generateCodeScanningConfig(codeql, config, features, logger);
|
||||||
@@ -267,12 +293,22 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
|||||||
(await util.codeQlVersionAbove(this, exports.CODEQL_VERSION_INIT_WITH_QLCONFIG))) {
|
(await util.codeQlVersionAbove(this, exports.CODEQL_VERSION_INIT_WITH_QLCONFIG))) {
|
||||||
extraArgs.push(`--qlconfig-file=${qlconfigFile}`);
|
extraArgs.push(`--qlconfig-file=${qlconfigFile}`);
|
||||||
}
|
}
|
||||||
|
if (await util.codeQlVersionAbove(this, exports.CODEQL_VERSION_LANGUAGE_BASELINE_CONFIG)) {
|
||||||
|
extraArgs.push("--calculate-language-specific-baseline");
|
||||||
|
}
|
||||||
|
if (await features.getValue(feature_flags_1.Feature.SublanguageFileCoverageEnabled, this)) {
|
||||||
|
extraArgs.push("--sublanguage-file-coverage");
|
||||||
|
}
|
||||||
|
else if (await util.codeQlVersionAbove(this, feature_flags_1.CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE)) {
|
||||||
|
extraArgs.push("--no-sublanguage-file-coverage");
|
||||||
|
}
|
||||||
await runTool(cmd, [
|
await runTool(cmd, [
|
||||||
"database",
|
"database",
|
||||||
"init",
|
"init",
|
||||||
"--db-cluster",
|
"--db-cluster",
|
||||||
config.dbLocation,
|
config.dbLocation,
|
||||||
`--source-root=${sourceRoot}`,
|
`--source-root=${sourceRoot}`,
|
||||||
|
...(await getLanguageAliasingArguments(this)),
|
||||||
...extraArgs,
|
...extraArgs,
|
||||||
...getExtraOptionsFromEnv(["database", "init"]),
|
...getExtraOptionsFromEnv(["database", "init"]),
|
||||||
], { stdin: externalRepositoryToken });
|
], { stdin: externalRepositoryToken });
|
||||||
@@ -311,7 +347,7 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
|||||||
const ext = process.platform === "win32" ? ".cmd" : ".sh";
|
const ext = process.platform === "win32" ? ".cmd" : ".sh";
|
||||||
const traceCommand = path.resolve(await this.resolveExtractor(language), "tools", `autobuild${ext}`);
|
const traceCommand = path.resolve(await this.resolveExtractor(language), "tools", `autobuild${ext}`);
|
||||||
// Run trace command
|
// Run trace command
|
||||||
await (0, toolrunner_error_catcher_1.toolrunnerErrorCatcher)(cmd, [
|
await runTool(cmd, [
|
||||||
"database",
|
"database",
|
||||||
"trace-command",
|
"trace-command",
|
||||||
...(await getTrapCachingExtractorConfigArgsForLang(config, language)),
|
...(await getTrapCachingExtractorConfigArgsForLang(config, language)),
|
||||||
@@ -319,7 +355,7 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
|||||||
databasePath,
|
databasePath,
|
||||||
"--",
|
"--",
|
||||||
traceCommand,
|
traceCommand,
|
||||||
], error_matcher_1.errorMatchers);
|
]);
|
||||||
},
|
},
|
||||||
async finalizeDatabase(databasePath, threadsFlag, memoryFlag) {
|
async finalizeDatabase(databasePath, threadsFlag, memoryFlag) {
|
||||||
const args = [
|
const args = [
|
||||||
@@ -331,7 +367,18 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
|||||||
...getExtraOptionsFromEnv(["database", "finalize"]),
|
...getExtraOptionsFromEnv(["database", "finalize"]),
|
||||||
databasePath,
|
databasePath,
|
||||||
];
|
];
|
||||||
await (0, toolrunner_error_catcher_1.toolrunnerErrorCatcher)(cmd, args, error_matcher_1.errorMatchers);
|
try {
|
||||||
|
await runTool(cmd, args);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
if (e instanceof CommandInvocationError &&
|
||||||
|
!(await util.codeQlVersionAbove(this, exports.CODEQL_VERSION_BETTER_NO_CODE_ERROR_MESSAGE)) &&
|
||||||
|
isNoCodeFoundError(e)) {
|
||||||
|
throw new util.UserError("No code found during the build. Please see: " +
|
||||||
|
"https://gh.io/troubleshooting-code-scanning/no-source-code-seen-during-build");
|
||||||
|
}
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
async resolveLanguages() {
|
async resolveLanguages() {
|
||||||
const codeqlArgs = [
|
const codeqlArgs = [
|
||||||
@@ -354,6 +401,7 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
|||||||
"languages",
|
"languages",
|
||||||
"--format=betterjson",
|
"--format=betterjson",
|
||||||
"--extractor-options-verbosity=4",
|
"--extractor-options-verbosity=4",
|
||||||
|
...(await getLanguageAliasingArguments(this)),
|
||||||
...getExtraOptionsFromEnv(["resolve", "languages"]),
|
...getExtraOptionsFromEnv(["resolve", "languages"]),
|
||||||
];
|
];
|
||||||
const output = await runTool(cmd, codeqlArgs);
|
const output = await runTool(cmd, codeqlArgs);
|
||||||
@@ -388,6 +436,7 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
|||||||
"resolve",
|
"resolve",
|
||||||
"build-environment",
|
"build-environment",
|
||||||
`--language=${language}`,
|
`--language=${language}`,
|
||||||
|
...(await getLanguageAliasingArguments(this)),
|
||||||
...getExtraOptionsFromEnv(["resolve", "build-environment"]),
|
...getExtraOptionsFromEnv(["resolve", "build-environment"]),
|
||||||
];
|
];
|
||||||
if (workingDir !== undefined) {
|
if (workingDir !== undefined) {
|
||||||
@@ -401,7 +450,7 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
|||||||
throw new Error(`Unexpected output from codeql resolve build-environment: ${e} in\n${output}`);
|
throw new Error(`Unexpected output from codeql resolve build-environment: ${e} in\n${output}`);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async databaseRunQueries(databasePath, extraSearchPath, querySuitePath, flags, optimizeForLastQueryRun) {
|
async databaseRunQueries(databasePath, extraSearchPath, querySuitePath, flags, optimizeForLastQueryRun, features) {
|
||||||
const codeqlArgs = [
|
const codeqlArgs = [
|
||||||
"database",
|
"database",
|
||||||
"run-queries",
|
"run-queries",
|
||||||
@@ -421,12 +470,18 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
|||||||
if (querySuitePath) {
|
if (querySuitePath) {
|
||||||
codeqlArgs.push(querySuitePath);
|
codeqlArgs.push(querySuitePath);
|
||||||
}
|
}
|
||||||
await (0, toolrunner_error_catcher_1.toolrunnerErrorCatcher)(cmd, codeqlArgs, error_matcher_1.errorMatchers);
|
if (await features.getValue(feature_flags_1.Feature.EvaluatorIntraLayerParallelismEnabled, this)) {
|
||||||
|
codeqlArgs.push("--intra-layer-parallelism");
|
||||||
|
}
|
||||||
|
else if (await util.codeQlVersionAbove(this, feature_flags_1.CODEQL_VERSION_INTRA_LAYER_PARALLELISM)) {
|
||||||
|
codeqlArgs.push("--no-intra-layer-parallelism");
|
||||||
|
}
|
||||||
|
await runTool(cmd, codeqlArgs);
|
||||||
},
|
},
|
||||||
async databaseInterpretResults(databasePath, querySuitePaths, sarifFile, addSnippetsFlag, threadsFlag, verbosityFlag, automationDetailsId, config, features, logger) {
|
async databaseInterpretResults(databasePath, querySuitePaths, sarifFile, addSnippetsFlag, threadsFlag, verbosityFlag, automationDetailsId, config, features, logger) {
|
||||||
const shouldExportDiagnostics = await features.getValue(feature_flags_1.Feature.ExportDiagnosticsEnabled, this);
|
const shouldExportDiagnostics = await features.getValue(feature_flags_1.Feature.ExportDiagnosticsEnabled, this);
|
||||||
// Update this to take into account the CodeQL version when we have a version with the fix.
|
const shouldWorkaroundInvalidNotifications = shouldExportDiagnostics &&
|
||||||
const shouldWorkaroundInvalidNotifications = shouldExportDiagnostics;
|
!(await isDiagnosticsExportInvalidSarifFixed(this));
|
||||||
const codeqlOutputFile = shouldWorkaroundInvalidNotifications
|
const codeqlOutputFile = shouldWorkaroundInvalidNotifications
|
||||||
? path.join(config.tempDir, "codeql-intermediate-results.sarif")
|
? path.join(config.tempDir, "codeql-intermediate-results.sarif")
|
||||||
: sarifFile;
|
: sarifFile;
|
||||||
@@ -451,28 +506,37 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
|||||||
if (await util.codeQlVersionAbove(this, CODEQL_VERSION_FILE_BASELINE_INFORMATION)) {
|
if (await util.codeQlVersionAbove(this, CODEQL_VERSION_FILE_BASELINE_INFORMATION)) {
|
||||||
codeqlArgs.push("--sarif-add-baseline-file-info");
|
codeqlArgs.push("--sarif-add-baseline-file-info");
|
||||||
}
|
}
|
||||||
|
if (await features.getValue(feature_flags_1.Feature.SublanguageFileCoverageEnabled, this)) {
|
||||||
|
codeqlArgs.push("--sublanguage-file-coverage");
|
||||||
|
}
|
||||||
|
else if (await util.codeQlVersionAbove(this, feature_flags_1.CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE)) {
|
||||||
|
codeqlArgs.push("--no-sublanguage-file-coverage");
|
||||||
|
}
|
||||||
if (shouldExportDiagnostics) {
|
if (shouldExportDiagnostics) {
|
||||||
codeqlArgs.push("--sarif-include-diagnostics");
|
codeqlArgs.push("--sarif-include-diagnostics");
|
||||||
}
|
}
|
||||||
else if (await util.codeQlVersionAbove(this, "2.12.4")) {
|
else if (await util.codeQlVersionAbove(this, "2.12.4")) {
|
||||||
codeqlArgs.push("--no-sarif-include-diagnostics");
|
codeqlArgs.push("--no-sarif-include-diagnostics");
|
||||||
}
|
}
|
||||||
if (await features.getValue(feature_flags_1.Feature.NewAnalysisSummaryEnabled, this)) {
|
if (await features.getValue(feature_flags_1.Feature.AnalysisSummaryV2Enabled, this)) {
|
||||||
codeqlArgs.push("--new-analysis-summary");
|
codeqlArgs.push("--new-analysis-summary");
|
||||||
}
|
}
|
||||||
else if (await util.codeQlVersionAbove(this, feature_flags_1.CODEQL_VERSION_NEW_ANALYSIS_SUMMARY)) {
|
else if (await util.codeQlVersionAbove(this, feature_flags_1.CODEQL_VERSION_ANALYSIS_SUMMARY_V2)) {
|
||||||
codeqlArgs.push("--no-new-analysis-summary");
|
codeqlArgs.push("--no-new-analysis-summary");
|
||||||
}
|
}
|
||||||
codeqlArgs.push(databasePath);
|
codeqlArgs.push(databasePath);
|
||||||
if (querySuitePaths) {
|
if (querySuitePaths) {
|
||||||
codeqlArgs.push(...querySuitePaths);
|
codeqlArgs.push(...querySuitePaths);
|
||||||
}
|
}
|
||||||
// capture stdout, which contains analysis summaries
|
// Capture the stdout, which contains the analysis summary. Don't stream it to the Actions
|
||||||
const returnState = await (0, toolrunner_error_catcher_1.toolrunnerErrorCatcher)(cmd, codeqlArgs, error_matcher_1.errorMatchers);
|
// logs to avoid printing it twice.
|
||||||
|
const analysisSummary = await runTool(cmd, codeqlArgs, {
|
||||||
|
noStreamStdout: true,
|
||||||
|
});
|
||||||
if (shouldWorkaroundInvalidNotifications) {
|
if (shouldWorkaroundInvalidNotifications) {
|
||||||
util.fixInvalidNotificationsInFile(codeqlOutputFile, sarifFile, logger);
|
util.fixInvalidNotificationsInFile(codeqlOutputFile, sarifFile, logger);
|
||||||
}
|
}
|
||||||
return returnState.stdout;
|
return analysisSummary;
|
||||||
},
|
},
|
||||||
async databasePrintBaseline(databasePath) {
|
async databasePrintBaseline(databasePath) {
|
||||||
const codeqlArgs = [
|
const codeqlArgs = [
|
||||||
@@ -549,8 +613,7 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
|||||||
await new toolrunner.ToolRunner(cmd, args).exec();
|
await new toolrunner.ToolRunner(cmd, args).exec();
|
||||||
},
|
},
|
||||||
async databaseExportDiagnostics(databasePath, sarifFile, automationDetailsId, tempDir, logger) {
|
async databaseExportDiagnostics(databasePath, sarifFile, automationDetailsId, tempDir, logger) {
|
||||||
// Update this to take into account the CodeQL version when we have a version with the fix.
|
const shouldWorkaroundInvalidNotifications = !(await isDiagnosticsExportInvalidSarifFixed(this));
|
||||||
const shouldWorkaroundInvalidNotifications = true;
|
|
||||||
const codeqlOutputFile = shouldWorkaroundInvalidNotifications
|
const codeqlOutputFile = shouldWorkaroundInvalidNotifications
|
||||||
? path.join(tempDir, "codeql-intermediate-results.sarif")
|
? path.join(tempDir, "codeql-intermediate-results.sarif")
|
||||||
: sarifFile;
|
: sarifFile;
|
||||||
@@ -597,6 +660,7 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
|||||||
"extractor",
|
"extractor",
|
||||||
"--format=json",
|
"--format=json",
|
||||||
`--language=${language}`,
|
`--language=${language}`,
|
||||||
|
...(await getLanguageAliasingArguments(this)),
|
||||||
...getExtraOptionsFromEnv(["resolve", "extractor"]),
|
...getExtraOptionsFromEnv(["resolve", "extractor"]),
|
||||||
], {
|
], {
|
||||||
silent: true,
|
silent: true,
|
||||||
@@ -622,21 +686,23 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
|||||||
// CodeQL object is created.
|
// CodeQL object is created.
|
||||||
if (checkVersion &&
|
if (checkVersion &&
|
||||||
!(await util.codeQlVersionAbove(codeql, CODEQL_MINIMUM_VERSION))) {
|
!(await util.codeQlVersionAbove(codeql, CODEQL_MINIMUM_VERSION))) {
|
||||||
throw new Error(`Expected a CodeQL CLI with version at least ${CODEQL_MINIMUM_VERSION} but got version ${await codeql.getVersion()}`);
|
throw new Error(`Expected a CodeQL CLI with version at least ${CODEQL_MINIMUM_VERSION} but got version ${(await codeql.getVersion()).version}`);
|
||||||
}
|
}
|
||||||
else if (checkVersion &&
|
else if (checkVersion &&
|
||||||
process.env[environment_1.EnvVar.SUPPRESS_DEPRECATED_SOON_WARNING] !== "true" &&
|
process.env[environment_1.EnvVar.SUPPRESS_DEPRECATED_SOON_WARNING] !== "true" &&
|
||||||
!(await util.codeQlVersionAbove(codeql, CODEQL_NEXT_MINIMUM_VERSION))) {
|
!(await util.codeQlVersionAbove(codeql, CODEQL_NEXT_MINIMUM_VERSION))) {
|
||||||
core.warning(`CodeQL CLI version ${await codeql.getVersion()} was deprecated on 2023-06-20 alongside ` +
|
const result = await codeql.getVersion();
|
||||||
"GitHub Enterprise Server 3.5 and will not be supported by the next release of the " +
|
core.warning(`CodeQL CLI version ${result.version} was discontinued on ` +
|
||||||
`CodeQL Action. Please update to CodeQL CLI version ${CODEQL_NEXT_MINIMUM_VERSION} or ` +
|
`${GHES_MOST_RECENT_DEPRECATION_DATE} alongside GitHub Enterprise Server ` +
|
||||||
"later. For instance, if you have specified a custom version of the CLI using the " +
|
`${GHES_VERSION_MOST_RECENTLY_DEPRECATED} and will not be supported by the next minor ` +
|
||||||
"'tools' input to the 'init' Action, you can remove this input to use the default " +
|
`release of the CodeQL Action. Please update to CodeQL CLI version ` +
|
||||||
"version.\n\n" +
|
`${CODEQL_NEXT_MINIMUM_VERSION} or later. For instance, if you have specified a custom ` +
|
||||||
|
"version of the CLI using the 'tools' input to the 'init' Action, you can remove this " +
|
||||||
|
"input to use the default version.\n\n" +
|
||||||
"Alternatively, if you want to continue using CodeQL CLI version " +
|
"Alternatively, if you want to continue using CodeQL CLI version " +
|
||||||
`${await codeql.getVersion()}, you can replace 'github/codeql-action/*@v2' by ` +
|
`${result.version}, you can replace 'github/codeql-action/*@v2' by ` +
|
||||||
"'github/codeql-action/*@v2.20.4' in your code scanning workflow to ensure you continue " +
|
`'github/codeql-action/*@v${(0, actions_util_1.getActionVersion)()}' in your code scanning workflow to ` +
|
||||||
"using this version of the CodeQL Action.");
|
"continue using this version of the CodeQL Action.");
|
||||||
core.exportVariable(environment_1.EnvVar.SUPPRESS_DEPRECATED_SOON_WARNING, "true");
|
core.exportVariable(environment_1.EnvVar.SUPPRESS_DEPRECATED_SOON_WARNING, "true");
|
||||||
}
|
}
|
||||||
return codeql;
|
return codeql;
|
||||||
@@ -699,10 +765,15 @@ const maxErrorSize = 20000;
|
|||||||
async function runTool(cmd, args = [], opts = {}) {
|
async function runTool(cmd, args = [], opts = {}) {
|
||||||
let output = "";
|
let output = "";
|
||||||
let error = "";
|
let error = "";
|
||||||
|
process.stdout.write(`[command]${cmd} ${args.join(" ")}\n`);
|
||||||
const exitCode = await new toolrunner.ToolRunner(cmd, args, {
|
const exitCode = await new toolrunner.ToolRunner(cmd, args, {
|
||||||
|
ignoreReturnCode: true,
|
||||||
listeners: {
|
listeners: {
|
||||||
stdout: (data) => {
|
stdout: (data) => {
|
||||||
output += data.toString("utf8");
|
output += data.toString("utf8");
|
||||||
|
if (!opts.noStreamStdout) {
|
||||||
|
process.stdout.write(data);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
stderr: (data) => {
|
stderr: (data) => {
|
||||||
let readStartIndex = 0;
|
let readStartIndex = 0;
|
||||||
@@ -712,15 +783,79 @@ async function runTool(cmd, args = [], opts = {}) {
|
|||||||
readStartIndex = data.length - maxErrorSize + 1;
|
readStartIndex = data.length - maxErrorSize + 1;
|
||||||
}
|
}
|
||||||
error += data.toString("utf8", readStartIndex);
|
error += data.toString("utf8", readStartIndex);
|
||||||
|
// Mimic the standard behavior of the toolrunner by writing stderr to stdout
|
||||||
|
process.stdout.write(data);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
ignoreReturnCode: true,
|
silent: true,
|
||||||
...(opts.stdin ? { input: Buffer.from(opts.stdin || "") } : {}),
|
...(opts.stdin ? { input: Buffer.from(opts.stdin || "") } : {}),
|
||||||
}).exec();
|
}).exec();
|
||||||
if (exitCode !== 0)
|
if (exitCode !== 0) {
|
||||||
throw new CommandInvocationError(cmd, args, exitCode, error, output);
|
throw new CommandInvocationError(cmd, args, exitCode, error, output);
|
||||||
|
}
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Provide a better error message from the stderr of a CLI invocation that failed with a fatal
|
||||||
|
* error.
|
||||||
|
*
|
||||||
|
* - If the CLI invocation failed with a fatal error, this returns that fatal error, followed by
|
||||||
|
* any fatal errors that occurred in plumbing commands.
|
||||||
|
* - If the CLI invocation did not fail with a fatal error, this returns `undefined`.
|
||||||
|
*
|
||||||
|
* ### Example
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
* Running TRAP import for CodeQL database at /home/runner/work/_temp/codeql_databases/javascript...
|
||||||
|
* A fatal error occurred: Evaluator heap must be at least 384.00 MiB
|
||||||
|
* A fatal error occurred: Dataset import for
|
||||||
|
* /home/runner/work/_temp/codeql_databases/javascript/db-javascript failed with code 2
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* becomes
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
* Encountered a fatal error while running "codeql-for-testing database finalize --finalize-dataset
|
||||||
|
* --threads=2 --ram=2048 db". Exit code was 32 and error was: A fatal error occurred: Dataset
|
||||||
|
* import for /home/runner/work/_temp/codeql_databases/javascript/db-javascript failed with code 2.
|
||||||
|
* Context: A fatal error occurred: Evaluator heap must be at least 384.00 MiB.
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Where possible, this tries to summarize the error into a single line, as this displays better in
|
||||||
|
* the Actions UI.
|
||||||
|
*/
|
||||||
|
function extractFatalErrors(error) {
|
||||||
|
const fatalErrorRegex = /.*fatal error occurred:/gi;
|
||||||
|
let fatalErrors = [];
|
||||||
|
let lastFatalErrorIndex;
|
||||||
|
let match;
|
||||||
|
while ((match = fatalErrorRegex.exec(error)) !== null) {
|
||||||
|
if (lastFatalErrorIndex !== undefined) {
|
||||||
|
fatalErrors.push(error.slice(lastFatalErrorIndex, match.index).trim());
|
||||||
|
}
|
||||||
|
lastFatalErrorIndex = match.index;
|
||||||
|
}
|
||||||
|
if (lastFatalErrorIndex !== undefined) {
|
||||||
|
const lastError = error.slice(lastFatalErrorIndex).trim();
|
||||||
|
if (fatalErrors.length === 0) {
|
||||||
|
// No other errors
|
||||||
|
return lastError;
|
||||||
|
}
|
||||||
|
const isOneLiner = !fatalErrors.some((e) => e.includes("\n"));
|
||||||
|
if (isOneLiner) {
|
||||||
|
fatalErrors = fatalErrors.map(ensureEndsInPeriod);
|
||||||
|
}
|
||||||
|
return [
|
||||||
|
ensureEndsInPeriod(lastError),
|
||||||
|
"Context:",
|
||||||
|
...fatalErrors.reverse(),
|
||||||
|
].join(isOneLiner ? " " : "\n");
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
function ensureEndsInPeriod(text) {
|
||||||
|
return text[text.length - 1] === "." ? text : `${text}.`;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* If appropriate, generates a code scanning configuration that is to be used for a scan.
|
* If appropriate, generates a code scanning configuration that is to be used for a scan.
|
||||||
* If the configuration is not to be generated, returns undefined.
|
* If the configuration is not to be generated, returns undefined.
|
||||||
@@ -772,21 +907,6 @@ async function generateCodeScanningConfig(codeql, config, features, logger) {
|
|||||||
if (Array.isArray(augmentedConfig.packs) && !augmentedConfig.packs.length) {
|
if (Array.isArray(augmentedConfig.packs) && !augmentedConfig.packs.length) {
|
||||||
delete augmentedConfig.packs;
|
delete augmentedConfig.packs;
|
||||||
}
|
}
|
||||||
if (config.augmentationProperties.injectedMlQueries) {
|
|
||||||
// We need to inject the ML queries into the original user input before
|
|
||||||
// we pass this on to the CLI, to make sure these get run.
|
|
||||||
const packString = await util.getMlPoweredJsQueriesPack(codeql);
|
|
||||||
if (augmentedConfig.packs === undefined)
|
|
||||||
augmentedConfig.packs = [];
|
|
||||||
if (Array.isArray(augmentedConfig.packs)) {
|
|
||||||
augmentedConfig.packs.push(packString);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (!augmentedConfig.packs.javascript)
|
|
||||||
augmentedConfig.packs["javascript"] = [];
|
|
||||||
augmentedConfig.packs["javascript"].push(packString);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
logger.info(`Writing augmented user configuration file to ${codeScanningConfigFile}`);
|
logger.info(`Writing augmented user configuration file to ${codeScanningConfigFile}`);
|
||||||
logger.startGroup("Augmented user configuration file contents");
|
logger.startGroup("Augmented user configuration file contents");
|
||||||
logger.info(yaml.dump(augmentedConfig));
|
logger.info(yaml.dump(augmentedConfig));
|
||||||
@@ -841,4 +961,25 @@ function getGeneratedCodeScanningConfigPath(config) {
|
|||||||
return path.resolve(config.tempDir, "user-config.yaml");
|
return path.resolve(config.tempDir, "user-config.yaml");
|
||||||
}
|
}
|
||||||
exports.getGeneratedCodeScanningConfigPath = getGeneratedCodeScanningConfigPath;
|
exports.getGeneratedCodeScanningConfigPath = getGeneratedCodeScanningConfigPath;
|
||||||
|
function isNoCodeFoundError(e) {
|
||||||
|
/**
|
||||||
|
* Earlier versions of the JavaScript extractor (pre-CodeQL 2.12.0) extract externs even if no
|
||||||
|
* source code was found. This means that we don't get the no code found error from
|
||||||
|
* `codeql database finalize`. To ensure users get a good error message, we detect this manually
|
||||||
|
* here, and upon detection override the error message.
|
||||||
|
*
|
||||||
|
* This can be removed once support for CodeQL 2.11.6 is removed.
|
||||||
|
*/
|
||||||
|
const javascriptNoCodeFoundWarning = "No JavaScript or TypeScript code found.";
|
||||||
|
return e.exitCode === 32 || e.stderr.includes(javascriptNoCodeFoundWarning);
|
||||||
|
}
|
||||||
|
async function isDiagnosticsExportInvalidSarifFixed(codeql) {
|
||||||
|
return await util.codeQlVersionAbove(codeql, exports.CODEQL_VERSION_DIAGNOSTICS_EXPORT_FIXED);
|
||||||
|
}
|
||||||
|
async function getLanguageAliasingArguments(codeql) {
|
||||||
|
if (await util.codeQlVersionAbove(codeql, exports.CODEQL_VERSION_LANGUAGE_ALIASING)) {
|
||||||
|
return ["--extractor-include-aliases"];
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
}
|
||||||
//# sourceMappingURL=codeql.js.map
|
//# sourceMappingURL=codeql.js.map
|
||||||
File diff suppressed because one or more lines are too long
186
lib/codeql.test.js
generated
186
lib/codeql.test.js
generated
@@ -73,7 +73,6 @@ ava_1.default.beforeEach(() => {
|
|||||||
debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME,
|
debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME,
|
||||||
debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME,
|
debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME,
|
||||||
augmentationProperties: {
|
augmentationProperties: {
|
||||||
injectedMlQueries: false,
|
|
||||||
packsInputCombines: false,
|
packsInputCombines: false,
|
||||||
queriesInputCombines: false,
|
queriesInputCombines: false,
|
||||||
},
|
},
|
||||||
@@ -131,6 +130,21 @@ function mockApiDetails(apiDetails) {
|
|||||||
t.is(toolcache.findAllVersions("CodeQL").length, 2);
|
t.is(toolcache.findAllVersions("CodeQL").length, 2);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
(0, ava_1.default)("caches semantically versioned bundles using their semantic version number", async (t) => {
|
||||||
|
await util.withTmpDir(async (tmpDir) => {
|
||||||
|
(0, testing_utils_1.setupActionsVars)(tmpDir, tmpDir);
|
||||||
|
const url = (0, testing_utils_1.mockBundleDownloadApi)({
|
||||||
|
tagName: `codeql-bundle-v2.14.0`,
|
||||||
|
isPinned: false,
|
||||||
|
});
|
||||||
|
const result = await codeql.setupCodeQL(url, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, util.GitHubVariant.DOTCOM, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), false);
|
||||||
|
t.is(toolcache.findAllVersions("CodeQL").length, 1);
|
||||||
|
t.assert(toolcache.find("CodeQL", `2.14.0`));
|
||||||
|
t.is(result.toolsVersion, `2.14.0`);
|
||||||
|
t.is(result.toolsSource, setup_codeql_1.ToolsSource.Download);
|
||||||
|
t.assert(Number.isInteger(result.toolsDownloadDurationMs));
|
||||||
|
});
|
||||||
|
});
|
||||||
(0, ava_1.default)("downloads an explicitly requested bundle even if a different version is cached", async (t) => {
|
(0, ava_1.default)("downloads an explicitly requested bundle even if a different version is cached", async (t) => {
|
||||||
await util.withTmpDir(async (tmpDir) => {
|
await util.withTmpDir(async (tmpDir) => {
|
||||||
(0, testing_utils_1.setupActionsVars)(tmpDir, tmpDir);
|
(0, testing_utils_1.setupActionsVars)(tmpDir, tmpDir);
|
||||||
@@ -363,14 +377,13 @@ for (const isBundleVersionInUrl of [true, false]) {
|
|||||||
await util.withTmpDir(async (tempDir) => {
|
await util.withTmpDir(async (tempDir) => {
|
||||||
const runnerConstructorStub = stubToolRunnerConstructor();
|
const runnerConstructorStub = stubToolRunnerConstructor();
|
||||||
const codeqlObject = await codeql.getCodeQLForTesting();
|
const codeqlObject = await codeql.getCodeQLForTesting();
|
||||||
sinon.stub(codeqlObject, "getVersion").resolves("2.9.4");
|
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.10.5"));
|
||||||
// safeWhich throws because of the test CodeQL object.
|
// safeWhich throws because of the test CodeQL object.
|
||||||
sinon.stub(safeWhich, "safeWhich").resolves("");
|
sinon.stub(safeWhich, "safeWhich").resolves("");
|
||||||
const thisStubConfig = {
|
const thisStubConfig = {
|
||||||
...stubConfig,
|
...stubConfig,
|
||||||
tempDir,
|
tempDir,
|
||||||
augmentationProperties: {
|
augmentationProperties: {
|
||||||
injectedMlQueries: false,
|
|
||||||
queriesInputCombines: false,
|
queriesInputCombines: false,
|
||||||
packsInputCombines: false,
|
packsInputCombines: false,
|
||||||
},
|
},
|
||||||
@@ -390,7 +403,8 @@ const injectedConfigMacro = ava_1.default.macro({
|
|||||||
const codeqlObject = await codeql.getCodeQLForTesting();
|
const codeqlObject = await codeql.getCodeQLForTesting();
|
||||||
sinon
|
sinon
|
||||||
.stub(codeqlObject, "getVersion")
|
.stub(codeqlObject, "getVersion")
|
||||||
.resolves(feature_flags_1.featureConfig[feature_flags_1.Feature.CliConfigFileEnabled].minimumVersion);
|
.resolves((0, testing_utils_1.makeVersionInfo)(feature_flags_1.featureConfig[feature_flags_1.Feature.CliConfigFileEnabled].minimumVersion ||
|
||||||
|
"1.0.0"));
|
||||||
const thisStubConfig = {
|
const thisStubConfig = {
|
||||||
...stubConfig,
|
...stubConfig,
|
||||||
...configOverride,
|
...configOverride,
|
||||||
@@ -411,49 +425,10 @@ const injectedConfigMacro = ava_1.default.macro({
|
|||||||
title: (providedTitle = "") => `databaseInitCluster() injected config: ${providedTitle}`,
|
title: (providedTitle = "") => `databaseInitCluster() injected config: ${providedTitle}`,
|
||||||
});
|
});
|
||||||
(0, ava_1.default)("basic", injectedConfigMacro, {
|
(0, ava_1.default)("basic", injectedConfigMacro, {
|
||||||
injectedMlQueries: false,
|
|
||||||
queriesInputCombines: false,
|
queriesInputCombines: false,
|
||||||
packsInputCombines: false,
|
packsInputCombines: false,
|
||||||
}, {}, {});
|
}, {}, {});
|
||||||
(0, ava_1.default)("injected ML queries", injectedConfigMacro, {
|
|
||||||
injectedMlQueries: true,
|
|
||||||
queriesInputCombines: false,
|
|
||||||
packsInputCombines: false,
|
|
||||||
}, {}, {
|
|
||||||
packs: ["codeql/javascript-experimental-atm-queries@~0.4.0"],
|
|
||||||
});
|
|
||||||
(0, ava_1.default)("injected ML queries with existing packs", injectedConfigMacro, {
|
|
||||||
injectedMlQueries: true,
|
|
||||||
queriesInputCombines: false,
|
|
||||||
packsInputCombines: false,
|
|
||||||
}, {
|
|
||||||
originalUserInput: {
|
|
||||||
packs: { javascript: ["codeql/something-else"] },
|
|
||||||
},
|
|
||||||
}, {
|
|
||||||
packs: {
|
|
||||||
javascript: [
|
|
||||||
"codeql/something-else",
|
|
||||||
"codeql/javascript-experimental-atm-queries@~0.4.0",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
});
|
|
||||||
(0, ava_1.default)("injected ML queries with existing packs of different language", injectedConfigMacro, {
|
|
||||||
injectedMlQueries: true,
|
|
||||||
queriesInputCombines: false,
|
|
||||||
packsInputCombines: false,
|
|
||||||
}, {
|
|
||||||
originalUserInput: {
|
|
||||||
packs: { cpp: ["codeql/something-else"] },
|
|
||||||
},
|
|
||||||
}, {
|
|
||||||
packs: {
|
|
||||||
cpp: ["codeql/something-else"],
|
|
||||||
javascript: ["codeql/javascript-experimental-atm-queries@~0.4.0"],
|
|
||||||
},
|
|
||||||
});
|
|
||||||
(0, ava_1.default)("injected packs from input", injectedConfigMacro, {
|
(0, ava_1.default)("injected packs from input", injectedConfigMacro, {
|
||||||
injectedMlQueries: false,
|
|
||||||
queriesInputCombines: false,
|
queriesInputCombines: false,
|
||||||
packsInputCombines: false,
|
packsInputCombines: false,
|
||||||
packsInput: ["xxx", "yyy"],
|
packsInput: ["xxx", "yyy"],
|
||||||
@@ -461,7 +436,6 @@ const injectedConfigMacro = ava_1.default.macro({
|
|||||||
packs: ["xxx", "yyy"],
|
packs: ["xxx", "yyy"],
|
||||||
});
|
});
|
||||||
(0, ava_1.default)("injected packs from input with existing packs combines", injectedConfigMacro, {
|
(0, ava_1.default)("injected packs from input with existing packs combines", injectedConfigMacro, {
|
||||||
injectedMlQueries: false,
|
|
||||||
queriesInputCombines: false,
|
queriesInputCombines: false,
|
||||||
packsInputCombines: true,
|
packsInputCombines: true,
|
||||||
packsInput: ["xxx", "yyy"],
|
packsInput: ["xxx", "yyy"],
|
||||||
@@ -477,7 +451,6 @@ const injectedConfigMacro = ava_1.default.macro({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
(0, ava_1.default)("injected packs from input with existing packs overrides", injectedConfigMacro, {
|
(0, ava_1.default)("injected packs from input with existing packs overrides", injectedConfigMacro, {
|
||||||
injectedMlQueries: false,
|
|
||||||
queriesInputCombines: false,
|
queriesInputCombines: false,
|
||||||
packsInputCombines: false,
|
packsInputCombines: false,
|
||||||
packsInput: ["xxx", "yyy"],
|
packsInput: ["xxx", "yyy"],
|
||||||
@@ -490,23 +463,8 @@ const injectedConfigMacro = ava_1.default.macro({
|
|||||||
}, {
|
}, {
|
||||||
packs: ["xxx", "yyy"],
|
packs: ["xxx", "yyy"],
|
||||||
});
|
});
|
||||||
(0, ava_1.default)("injected packs from input with existing packs overrides and ML model inject", injectedConfigMacro, {
|
|
||||||
injectedMlQueries: true,
|
|
||||||
queriesInputCombines: false,
|
|
||||||
packsInputCombines: false,
|
|
||||||
packsInput: ["xxx", "yyy"],
|
|
||||||
}, {
|
|
||||||
originalUserInput: {
|
|
||||||
packs: {
|
|
||||||
cpp: ["codeql/something-else"],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}, {
|
|
||||||
packs: ["xxx", "yyy", "codeql/javascript-experimental-atm-queries@~0.4.0"],
|
|
||||||
});
|
|
||||||
// similar, but with queries
|
// similar, but with queries
|
||||||
(0, ava_1.default)("injected queries from input", injectedConfigMacro, {
|
(0, ava_1.default)("injected queries from input", injectedConfigMacro, {
|
||||||
injectedMlQueries: false,
|
|
||||||
queriesInputCombines: false,
|
queriesInputCombines: false,
|
||||||
packsInputCombines: false,
|
packsInputCombines: false,
|
||||||
queriesInput: [{ uses: "xxx" }, { uses: "yyy" }],
|
queriesInput: [{ uses: "xxx" }, { uses: "yyy" }],
|
||||||
@@ -521,7 +479,6 @@ const injectedConfigMacro = ava_1.default.macro({
|
|||||||
],
|
],
|
||||||
});
|
});
|
||||||
(0, ava_1.default)("injected queries from input overrides", injectedConfigMacro, {
|
(0, ava_1.default)("injected queries from input overrides", injectedConfigMacro, {
|
||||||
injectedMlQueries: false,
|
|
||||||
queriesInputCombines: false,
|
queriesInputCombines: false,
|
||||||
packsInputCombines: false,
|
packsInputCombines: false,
|
||||||
queriesInput: [{ uses: "xxx" }, { uses: "yyy" }],
|
queriesInput: [{ uses: "xxx" }, { uses: "yyy" }],
|
||||||
@@ -540,7 +497,6 @@ const injectedConfigMacro = ava_1.default.macro({
|
|||||||
],
|
],
|
||||||
});
|
});
|
||||||
(0, ava_1.default)("injected queries from input combines", injectedConfigMacro, {
|
(0, ava_1.default)("injected queries from input combines", injectedConfigMacro, {
|
||||||
injectedMlQueries: false,
|
|
||||||
queriesInputCombines: true,
|
queriesInputCombines: true,
|
||||||
packsInputCombines: false,
|
packsInputCombines: false,
|
||||||
queriesInput: [{ uses: "xxx" }, { uses: "yyy" }],
|
queriesInput: [{ uses: "xxx" }, { uses: "yyy" }],
|
||||||
@@ -562,7 +518,6 @@ const injectedConfigMacro = ava_1.default.macro({
|
|||||||
],
|
],
|
||||||
});
|
});
|
||||||
(0, ava_1.default)("injected queries from input combines 2", injectedConfigMacro, {
|
(0, ava_1.default)("injected queries from input combines 2", injectedConfigMacro, {
|
||||||
injectedMlQueries: false,
|
|
||||||
queriesInputCombines: true,
|
queriesInputCombines: true,
|
||||||
packsInputCombines: true,
|
packsInputCombines: true,
|
||||||
queriesInput: [{ uses: "xxx" }, { uses: "yyy" }],
|
queriesInput: [{ uses: "xxx" }, { uses: "yyy" }],
|
||||||
@@ -577,7 +532,6 @@ const injectedConfigMacro = ava_1.default.macro({
|
|||||||
],
|
],
|
||||||
});
|
});
|
||||||
(0, ava_1.default)("injected queries and packs, but empty", injectedConfigMacro, {
|
(0, ava_1.default)("injected queries and packs, but empty", injectedConfigMacro, {
|
||||||
injectedMlQueries: false,
|
|
||||||
queriesInputCombines: true,
|
queriesInputCombines: true,
|
||||||
packsInputCombines: true,
|
packsInputCombines: true,
|
||||||
queriesInput: [],
|
queriesInput: [],
|
||||||
@@ -593,7 +547,7 @@ const injectedConfigMacro = ava_1.default.macro({
|
|||||||
const runnerConstructorStub = stubToolRunnerConstructor();
|
const runnerConstructorStub = stubToolRunnerConstructor();
|
||||||
const codeqlObject = await codeql.getCodeQLForTesting();
|
const codeqlObject = await codeql.getCodeQLForTesting();
|
||||||
// stubbed version doesn't matter. It just needs to be valid semver.
|
// stubbed version doesn't matter. It just needs to be valid semver.
|
||||||
sinon.stub(codeqlObject, "getVersion").resolves("0.0.0");
|
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("0.0.0"));
|
||||||
await codeqlObject.databaseInitCluster({ ...stubConfig, tempDir }, "", undefined, (0, testing_utils_1.createFeatures)([]), "/path/to/qlconfig.yml", (0, logging_1.getRunnerLogger)(true));
|
await codeqlObject.databaseInitCluster({ ...stubConfig, tempDir }, "", undefined, (0, testing_utils_1.createFeatures)([]), "/path/to/qlconfig.yml", (0, logging_1.getRunnerLogger)(true));
|
||||||
const args = runnerConstructorStub.firstCall.args[1];
|
const args = runnerConstructorStub.firstCall.args[1];
|
||||||
// should not have used a config file
|
// should not have used a config file
|
||||||
@@ -610,7 +564,7 @@ const injectedConfigMacro = ava_1.default.macro({
|
|||||||
const codeqlObject = await codeql.getCodeQLForTesting();
|
const codeqlObject = await codeql.getCodeQLForTesting();
|
||||||
sinon
|
sinon
|
||||||
.stub(codeqlObject, "getVersion")
|
.stub(codeqlObject, "getVersion")
|
||||||
.resolves(codeql.CODEQL_VERSION_INIT_WITH_QLCONFIG);
|
.resolves((0, testing_utils_1.makeVersionInfo)(codeql.CODEQL_VERSION_INIT_WITH_QLCONFIG));
|
||||||
await codeqlObject.databaseInitCluster({ ...stubConfig, tempDir }, "", undefined, (0, testing_utils_1.createFeatures)([feature_flags_1.Feature.CliConfigFileEnabled]), "/path/to/qlconfig.yml", (0, logging_1.getRunnerLogger)(true));
|
await codeqlObject.databaseInitCluster({ ...stubConfig, tempDir }, "", undefined, (0, testing_utils_1.createFeatures)([feature_flags_1.Feature.CliConfigFileEnabled]), "/path/to/qlconfig.yml", (0, logging_1.getRunnerLogger)(true));
|
||||||
const args = runnerConstructorStub.firstCall.args[1];
|
const args = runnerConstructorStub.firstCall.args[1];
|
||||||
// should have used a config file
|
// should have used a config file
|
||||||
@@ -625,7 +579,7 @@ const injectedConfigMacro = ava_1.default.macro({
|
|||||||
await util.withTmpDir(async (tempDir) => {
|
await util.withTmpDir(async (tempDir) => {
|
||||||
const runnerConstructorStub = stubToolRunnerConstructor();
|
const runnerConstructorStub = stubToolRunnerConstructor();
|
||||||
const codeqlObject = await codeql.getCodeQLForTesting();
|
const codeqlObject = await codeql.getCodeQLForTesting();
|
||||||
sinon.stub(codeqlObject, "getVersion").resolves("2.12.2");
|
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.12.2"));
|
||||||
await codeqlObject.databaseInitCluster({ ...stubConfig, tempDir }, "", undefined, (0, testing_utils_1.createFeatures)([feature_flags_1.Feature.CliConfigFileEnabled]), "/path/to/qlconfig.yml", (0, logging_1.getRunnerLogger)(true));
|
await codeqlObject.databaseInitCluster({ ...stubConfig, tempDir }, "", undefined, (0, testing_utils_1.createFeatures)([feature_flags_1.Feature.CliConfigFileEnabled]), "/path/to/qlconfig.yml", (0, logging_1.getRunnerLogger)(true));
|
||||||
const args = runnerConstructorStub.firstCall.args[1];
|
const args = runnerConstructorStub.firstCall.args[1];
|
||||||
// should have used a config file
|
// should have used a config file
|
||||||
@@ -642,7 +596,7 @@ const injectedConfigMacro = ava_1.default.macro({
|
|||||||
const codeqlObject = await codeql.getCodeQLForTesting();
|
const codeqlObject = await codeql.getCodeQLForTesting();
|
||||||
sinon
|
sinon
|
||||||
.stub(codeqlObject, "getVersion")
|
.stub(codeqlObject, "getVersion")
|
||||||
.resolves(codeql.CODEQL_VERSION_INIT_WITH_QLCONFIG);
|
.resolves((0, testing_utils_1.makeVersionInfo)(codeql.CODEQL_VERSION_INIT_WITH_QLCONFIG));
|
||||||
await codeqlObject.databaseInitCluster({ ...stubConfig, tempDir }, "", undefined, (0, testing_utils_1.createFeatures)([feature_flags_1.Feature.CliConfigFileEnabled]), undefined, // undefined qlconfigFile
|
await codeqlObject.databaseInitCluster({ ...stubConfig, tempDir }, "", undefined, (0, testing_utils_1.createFeatures)([feature_flags_1.Feature.CliConfigFileEnabled]), undefined, // undefined qlconfigFile
|
||||||
(0, logging_1.getRunnerLogger)(true));
|
(0, logging_1.getRunnerLogger)(true));
|
||||||
const args = runnerConstructorStub.firstCall.args[1];
|
const args = runnerConstructorStub.firstCall.args[1];
|
||||||
@@ -653,7 +607,7 @@ const injectedConfigMacro = ava_1.default.macro({
|
|||||||
(0, ava_1.default)("databaseInterpretResults() sets --sarif-add-baseline-file-info for 2.11.3", async (t) => {
|
(0, ava_1.default)("databaseInterpretResults() sets --sarif-add-baseline-file-info for 2.11.3", async (t) => {
|
||||||
const runnerConstructorStub = stubToolRunnerConstructor();
|
const runnerConstructorStub = stubToolRunnerConstructor();
|
||||||
const codeqlObject = await codeql.getCodeQLForTesting();
|
const codeqlObject = await codeql.getCodeQLForTesting();
|
||||||
sinon.stub(codeqlObject, "getVersion").resolves("2.11.3");
|
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.11.3"));
|
||||||
// safeWhich throws because of the test CodeQL object.
|
// safeWhich throws because of the test CodeQL object.
|
||||||
sinon.stub(safeWhich, "safeWhich").resolves("");
|
sinon.stub(safeWhich, "safeWhich").resolves("");
|
||||||
await codeqlObject.databaseInterpretResults("", [], "", "", "", "-v", "", stubConfig, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
await codeqlObject.databaseInterpretResults("", [], "", "", "", "-v", "", stubConfig, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
||||||
@@ -662,7 +616,7 @@ const injectedConfigMacro = ava_1.default.macro({
|
|||||||
(0, ava_1.default)("databaseInterpretResults() does not set --sarif-add-baseline-file-info for 2.11.2", async (t) => {
|
(0, ava_1.default)("databaseInterpretResults() does not set --sarif-add-baseline-file-info for 2.11.2", async (t) => {
|
||||||
const runnerConstructorStub = stubToolRunnerConstructor();
|
const runnerConstructorStub = stubToolRunnerConstructor();
|
||||||
const codeqlObject = await codeql.getCodeQLForTesting();
|
const codeqlObject = await codeql.getCodeQLForTesting();
|
||||||
sinon.stub(codeqlObject, "getVersion").resolves("2.11.2");
|
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.11.2"));
|
||||||
// safeWhich throws because of the test CodeQL object.
|
// safeWhich throws because of the test CodeQL object.
|
||||||
sinon.stub(safeWhich, "safeWhich").resolves("");
|
sinon.stub(safeWhich, "safeWhich").resolves("");
|
||||||
await codeqlObject.databaseInterpretResults("", [], "", "", "", "-v", "", stubConfig, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
await codeqlObject.databaseInterpretResults("", [], "", "", "", "-v", "", stubConfig, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
||||||
@@ -671,19 +625,19 @@ const injectedConfigMacro = ava_1.default.macro({
|
|||||||
const NEW_ANALYSIS_SUMMARY_TEST_CASES = [
|
const NEW_ANALYSIS_SUMMARY_TEST_CASES = [
|
||||||
{
|
{
|
||||||
featureEnabled: true,
|
featureEnabled: true,
|
||||||
codeqlVersion: "2.14.0",
|
codeqlVersion: "2.15.0",
|
||||||
flagPassed: true,
|
flagPassed: true,
|
||||||
negativeFlagPassed: false,
|
negativeFlagPassed: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
featureEnabled: false,
|
featureEnabled: false,
|
||||||
codeqlVersion: "2.14.0",
|
codeqlVersion: "2.15.0",
|
||||||
flagPassed: false,
|
flagPassed: false,
|
||||||
negativeFlagPassed: true,
|
negativeFlagPassed: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
featureEnabled: false,
|
featureEnabled: false,
|
||||||
codeqlVersion: "2.13.5",
|
codeqlVersion: "2.14.6",
|
||||||
flagPassed: false,
|
flagPassed: false,
|
||||||
negativeFlagPassed: false,
|
negativeFlagPassed: false,
|
||||||
},
|
},
|
||||||
@@ -696,19 +650,95 @@ for (const { featureEnabled, codeqlVersion, flagPassed, negativeFlagPassed, } of
|
|||||||
: "nothing"} for CodeQL CLI v${codeqlVersion} when the new analysis summary feature is ${featureEnabled ? "enabled" : "disabled"}`, async (t) => {
|
: "nothing"} for CodeQL CLI v${codeqlVersion} when the new analysis summary feature is ${featureEnabled ? "enabled" : "disabled"}`, async (t) => {
|
||||||
const runnerConstructorStub = stubToolRunnerConstructor();
|
const runnerConstructorStub = stubToolRunnerConstructor();
|
||||||
const codeqlObject = await codeql.getCodeQLForTesting();
|
const codeqlObject = await codeql.getCodeQLForTesting();
|
||||||
sinon.stub(codeqlObject, "getVersion").resolves(codeqlVersion);
|
sinon
|
||||||
|
.stub(codeqlObject, "getVersion")
|
||||||
|
.resolves((0, testing_utils_1.makeVersionInfo)(codeqlVersion));
|
||||||
// safeWhich throws because of the test CodeQL object.
|
// safeWhich throws because of the test CodeQL object.
|
||||||
sinon.stub(safeWhich, "safeWhich").resolves("");
|
sinon.stub(safeWhich, "safeWhich").resolves("");
|
||||||
await codeqlObject.databaseInterpretResults("", [], "", "", "", "-v", "", stubConfig, (0, testing_utils_1.createFeatures)(featureEnabled ? [feature_flags_1.Feature.NewAnalysisSummaryEnabled] : []), (0, logging_1.getRunnerLogger)(true));
|
await codeqlObject.databaseInterpretResults("", [], "", "", "", "-v", "", stubConfig, (0, testing_utils_1.createFeatures)(featureEnabled ? [feature_flags_1.Feature.AnalysisSummaryV2Enabled] : []), (0, logging_1.getRunnerLogger)(true));
|
||||||
t.is(runnerConstructorStub.firstCall.args[1].includes("--new-analysis-summary"), flagPassed, `--new-analysis-summary should${flagPassed ? "" : "n't"} be passed`);
|
t.is(runnerConstructorStub.firstCall.args[1].includes("--new-analysis-summary"), flagPassed, `--new-analysis-summary should${flagPassed ? "" : "n't"} be passed`);
|
||||||
t.is(runnerConstructorStub.firstCall.args[1].includes("--no-new-analysis-summary"), negativeFlagPassed, `--no-new-analysis-summary should${negativeFlagPassed ? "" : "n't"} be passed`);
|
t.is(runnerConstructorStub.firstCall.args[1].includes("--no-new-analysis-summary"), negativeFlagPassed, `--no-new-analysis-summary should${negativeFlagPassed ? "" : "n't"} be passed`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function stubToolRunnerConstructor() {
|
(0, ava_1.default)("database finalize recognises JavaScript no code found error on CodeQL 2.11.6", async (t) => {
|
||||||
|
stubToolRunnerConstructor(1, `2020-09-07T17:39:53.9050522Z [2020-09-07 17:39:53] [build] Done extracting /opt/hostedtoolcache/CodeQL/0.0.0-20200630/x64/codeql/javascript/tools/data/externs/web/ie_vml.js (3 ms)
|
||||||
|
2020-09-07T17:39:53.9051849Z [2020-09-07 17:39:53] [build-err] No JavaScript or TypeScript code found.
|
||||||
|
2020-09-07T17:39:53.9052444Z [2020-09-07 17:39:53] [build-err] No JavaScript or TypeScript code found.
|
||||||
|
2020-09-07T17:39:53.9251124Z [2020-09-07 17:39:53] [ERROR] Spawned process exited abnormally (code 255; tried to run: [/opt/hostedtoolcache/CodeQL/0.0.0-20200630/x64/codeql/javascript/tools/autobuild.sh])`);
|
||||||
|
const codeqlObject = await codeql.getCodeQLForTesting();
|
||||||
|
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.11.6"));
|
||||||
|
// safeWhich throws because of the test CodeQL object.
|
||||||
|
sinon.stub(safeWhich, "safeWhich").resolves("");
|
||||||
|
await t.throwsAsync(async () => await codeqlObject.finalizeDatabase("", "", ""), {
|
||||||
|
message: "No code found during the build. Please see: " +
|
||||||
|
"https://gh.io/troubleshooting-code-scanning/no-source-code-seen-during-build",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
(0, ava_1.default)("database finalize overrides no code found error on CodeQL 2.11.6", async (t) => {
|
||||||
|
stubToolRunnerConstructor(32);
|
||||||
|
const codeqlObject = await codeql.getCodeQLForTesting();
|
||||||
|
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.11.6"));
|
||||||
|
// safeWhich throws because of the test CodeQL object.
|
||||||
|
sinon.stub(safeWhich, "safeWhich").resolves("");
|
||||||
|
await t.throwsAsync(async () => await codeqlObject.finalizeDatabase("", "", ""), {
|
||||||
|
message: "No code found during the build. Please see: " +
|
||||||
|
"https://gh.io/troubleshooting-code-scanning/no-source-code-seen-during-build",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
(0, ava_1.default)("database finalize does not override no code found error on CodeQL 2.12.4", async (t) => {
|
||||||
|
const cliMessage = "CodeQL did not detect any code written in languages supported by CodeQL. Review our troubleshooting guide at " +
|
||||||
|
"https://gh.io/troubleshooting-code-scanning/no-source-code-seen-during-build.";
|
||||||
|
stubToolRunnerConstructor(32, cliMessage);
|
||||||
|
const codeqlObject = await codeql.getCodeQLForTesting();
|
||||||
|
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.12.4"));
|
||||||
|
// safeWhich throws because of the test CodeQL object.
|
||||||
|
sinon.stub(safeWhich, "safeWhich").resolves("");
|
||||||
|
await t.throwsAsync(async () => await codeqlObject.finalizeDatabase("db", "--threads=2", "--ram=2048"), {
|
||||||
|
message: 'Encountered a fatal error while running "codeql-for-testing database finalize --finalize-dataset --threads=2 --ram=2048 db". ' +
|
||||||
|
`Exit code was 32 and last log line was: ${cliMessage} See the logs for more details.`,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
(0, ava_1.default)("runTool summarizes several fatal errors", async (t) => {
|
||||||
|
const heapError = "A fatal error occurred: Evaluator heap must be at least 384.00 MiB";
|
||||||
|
const datasetImportError = "A fatal error occurred: Dataset import for /home/runner/work/_temp/codeql_databases/javascript/db-javascript failed with code 2";
|
||||||
|
const cliStderr = `Running TRAP import for CodeQL database at /home/runner/work/_temp/codeql_databases/javascript...\n` +
|
||||||
|
`${heapError}\n${datasetImportError}.`;
|
||||||
|
stubToolRunnerConstructor(32, cliStderr);
|
||||||
|
const codeqlObject = await codeql.getCodeQLForTesting();
|
||||||
|
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.12.4"));
|
||||||
|
// safeWhich throws because of the test CodeQL object.
|
||||||
|
sinon.stub(safeWhich, "safeWhich").resolves("");
|
||||||
|
await t.throwsAsync(async () => await codeqlObject.finalizeDatabase("db", "--threads=2", "--ram=2048"), {
|
||||||
|
message: 'Encountered a fatal error while running "codeql-for-testing database finalize --finalize-dataset --threads=2 --ram=2048 db". ' +
|
||||||
|
`Exit code was 32 and error was: ${datasetImportError}. Context: ${heapError}. See the logs for more details.`,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
(0, ava_1.default)("runTool outputs last line of stderr if fatal error could not be found", async (t) => {
|
||||||
|
const cliStderr = "line1\nline2\nline3\nline4\nline5";
|
||||||
|
stubToolRunnerConstructor(32, cliStderr);
|
||||||
|
const codeqlObject = await codeql.getCodeQLForTesting();
|
||||||
|
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.12.4"));
|
||||||
|
// safeWhich throws because of the test CodeQL object.
|
||||||
|
sinon.stub(safeWhich, "safeWhich").resolves("");
|
||||||
|
await t.throwsAsync(async () => await codeqlObject.finalizeDatabase("db", "--threads=2", "--ram=2048"), {
|
||||||
|
message: 'Encountered a fatal error while running "codeql-for-testing database finalize --finalize-dataset --threads=2 --ram=2048 db". ' +
|
||||||
|
"Exit code was 32 and last log line was: line5. See the logs for more details.",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
function stubToolRunnerConstructor(exitCode = 0, stderr) {
|
||||||
const runnerObjectStub = sinon.createStubInstance(toolrunner.ToolRunner);
|
const runnerObjectStub = sinon.createStubInstance(toolrunner.ToolRunner);
|
||||||
runnerObjectStub.exec.resolves(0);
|
|
||||||
const runnerConstructorStub = sinon.stub(toolrunner, "ToolRunner");
|
const runnerConstructorStub = sinon.stub(toolrunner, "ToolRunner");
|
||||||
runnerConstructorStub.returns(runnerObjectStub);
|
let stderrListener = undefined;
|
||||||
|
runnerConstructorStub.callsFake((_cmd, _args, options) => {
|
||||||
|
stderrListener = options.listeners?.stderr;
|
||||||
|
return runnerObjectStub;
|
||||||
|
});
|
||||||
|
runnerObjectStub.exec.callsFake(async () => {
|
||||||
|
if (stderrListener !== undefined && stderr !== undefined) {
|
||||||
|
stderrListener(Buffer.from(stderr));
|
||||||
|
}
|
||||||
|
return exitCode;
|
||||||
|
});
|
||||||
return runnerConstructorStub;
|
return runnerConstructorStub;
|
||||||
}
|
}
|
||||||
exports.stubToolRunnerConstructor = stubToolRunnerConstructor;
|
exports.stubToolRunnerConstructor = stubToolRunnerConstructor;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
131
lib/config-utils.js
generated
131
lib/config-utils.js
generated
@@ -23,7 +23,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.wrapEnvironment = exports.generateRegistries = exports.downloadPacks = exports.getConfig = exports.getPathToParsedConfigFile = exports.initConfig = exports.getMlPoweredJsQueriesStatus = exports.parsePacks = exports.validatePackSpecification = exports.parsePacksSpecification = exports.parsePacksFromConfig = exports.calculateAugmentation = exports.getDefaultConfig = exports.getRawLanguages = exports.getLanguages = exports.getLanguagesInRepo = 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.getQueriesMissingUses = exports.getQueriesInvalid = exports.getDisableDefaultQueriesInvalid = exports.getNameInvalid = exports.validateAndSanitisePath = exports.defaultAugmentationProperties = void 0;
|
exports.wrapEnvironment = exports.generateRegistries = exports.downloadPacks = exports.getConfig = exports.getPathToParsedConfigFile = exports.initConfig = exports.parsePacks = exports.validatePackSpecification = exports.parsePacksSpecification = exports.parsePacksFromConfig = exports.calculateAugmentation = exports.getDefaultConfig = exports.getRawLanguages = exports.getLanguageAliases = exports.getLanguages = exports.getLanguagesInRepo = 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.getQueriesMissingUses = exports.getQueriesInvalid = exports.getDisableDefaultQueriesInvalid = exports.getNameInvalid = exports.validateAndSanitisePath = exports.defaultAugmentationProperties = void 0;
|
||||||
const fs = __importStar(require("fs"));
|
const fs = __importStar(require("fs"));
|
||||||
const path = __importStar(require("path"));
|
const path = __importStar(require("path"));
|
||||||
const perf_hooks_1 = require("perf_hooks");
|
const perf_hooks_1 = require("perf_hooks");
|
||||||
@@ -45,13 +45,12 @@ const PATHS_IGNORE_PROPERTY = "paths-ignore";
|
|||||||
const PATHS_PROPERTY = "paths";
|
const PATHS_PROPERTY = "paths";
|
||||||
const PACKS_PROPERTY = "packs";
|
const PACKS_PROPERTY = "packs";
|
||||||
/**
|
/**
|
||||||
* The default, empty augmentation properties. This is most useeful
|
* The default, empty augmentation properties. This is most useful
|
||||||
* for tests.
|
* for tests.
|
||||||
*/
|
*/
|
||||||
exports.defaultAugmentationProperties = {
|
exports.defaultAugmentationProperties = {
|
||||||
queriesInputCombines: false,
|
queriesInputCombines: false,
|
||||||
packsInputCombines: false,
|
packsInputCombines: false,
|
||||||
injectedMlQueries: false,
|
|
||||||
packsInput: undefined,
|
packsInput: undefined,
|
||||||
queriesInput: undefined,
|
queriesInput: undefined,
|
||||||
};
|
};
|
||||||
@@ -139,10 +138,8 @@ const builtinSuites = [
|
|||||||
/**
|
/**
|
||||||
* Determine the set of queries associated with suiteName's suites and add them to resultMap.
|
* Determine the set of queries associated with suiteName's suites and add them to resultMap.
|
||||||
* Throws an error if suiteName is not a valid builtin suite.
|
* Throws an error if suiteName is not a valid builtin suite.
|
||||||
* May inject ML queries, and the return value will declare if this was done.
|
|
||||||
*/
|
*/
|
||||||
async function addBuiltinSuiteQueries(languages, codeQL, resultMap, packs, suiteName, features, configFile) {
|
async function addBuiltinSuiteQueries(languages, codeQL, resultMap, suiteName, configFile) {
|
||||||
let injectedMlQueries = false;
|
|
||||||
const found = builtinSuites.find((suite) => suite === suiteName);
|
const found = builtinSuites.find((suite) => suite === suiteName);
|
||||||
if (!found) {
|
if (!found) {
|
||||||
throw new util_1.UserError(getQueryUsesInvalid(configFile, suiteName));
|
throw new util_1.UserError(getQueryUsesInvalid(configFile, suiteName));
|
||||||
@@ -153,27 +150,8 @@ async function addBuiltinSuiteQueries(languages, codeQL, resultMap, packs, suite
|
|||||||
${codeql_1.CODEQL_VERSION_SECURITY_EXPERIMENTAL_SUITE}. Please upgrade to CodeQL CLI version
|
${codeql_1.CODEQL_VERSION_SECURITY_EXPERIMENTAL_SUITE}. Please upgrade to CodeQL CLI version
|
||||||
${codeql_1.CODEQL_VERSION_SECURITY_EXPERIMENTAL_SUITE} or later.`);
|
${codeql_1.CODEQL_VERSION_SECURITY_EXPERIMENTAL_SUITE} or later.`);
|
||||||
}
|
}
|
||||||
// If we're running the JavaScript security-extended analysis (or a superset of it), the repo is
|
|
||||||
// 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 (languages.includes("javascript") &&
|
|
||||||
(found === "security-experimental" ||
|
|
||||||
found === "security-extended" ||
|
|
||||||
found === "security-and-quality") &&
|
|
||||||
!packs.javascript?.some(isMlPoweredJsQueriesPack) &&
|
|
||||||
(await features.getValue(feature_flags_1.Feature.MlPoweredQueriesEnabled, codeQL))) {
|
|
||||||
if (!packs.javascript) {
|
|
||||||
packs.javascript = [];
|
|
||||||
}
|
|
||||||
packs.javascript.push(await (0, util_1.getMlPoweredJsQueriesPack)(codeQL));
|
|
||||||
injectedMlQueries = true;
|
|
||||||
}
|
|
||||||
const suites = languages.map((l) => `${l}-${suiteName}.qls`);
|
const suites = languages.map((l) => `${l}-${suiteName}.qls`);
|
||||||
await runResolveQueries(codeQL, resultMap, suites, undefined);
|
await runResolveQueries(codeQL, resultMap, suites, undefined);
|
||||||
return injectedMlQueries;
|
|
||||||
}
|
|
||||||
function isMlPoweredJsQueriesPack(pack) {
|
|
||||||
return parsePacksSpecification(pack).name === 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.
|
||||||
@@ -230,13 +208,8 @@ async function addRemoteQueries(codeQL, resultMap, queryUses, tempDir, apiDetail
|
|||||||
* parsing the 'uses' actions in the workflow file. So it can handle
|
* parsing the 'uses' actions in the workflow file. So it can handle
|
||||||
* local paths starting with './', or references to remote repos, or
|
* local paths starting with './', or references to remote repos, or
|
||||||
* a finite set of hardcoded terms for builtin suites.
|
* a finite set of hardcoded terms for builtin suites.
|
||||||
*
|
|
||||||
* This may inject ML queries into the packs to use, and the return value will
|
|
||||||
* declare if this was done.
|
|
||||||
*
|
|
||||||
* @returns whether or not we injected ML queries into the packs
|
|
||||||
*/
|
*/
|
||||||
async function parseQueryUses(languages, codeQL, resultMap, packs, queryUses, tempDir, workspacePath, apiDetails, features, logger, configFile) {
|
async function parseQueryUses(languages, codeQL, resultMap, queryUses, tempDir, workspacePath, apiDetails, features, logger, configFile) {
|
||||||
queryUses = queryUses.trim();
|
queryUses = queryUses.trim();
|
||||||
if (queryUses === "") {
|
if (queryUses === "") {
|
||||||
throw new util_1.UserError(getQueryUsesInvalid(configFile));
|
throw new util_1.UserError(getQueryUsesInvalid(configFile));
|
||||||
@@ -244,11 +217,12 @@ async function parseQueryUses(languages, codeQL, resultMap, packs, queryUses, te
|
|||||||
// Check for the local path case before we start trying to parse the repository name
|
// Check for the local path case before we start trying to parse the repository name
|
||||||
if (queryUses.startsWith("./")) {
|
if (queryUses.startsWith("./")) {
|
||||||
await addLocalQueries(codeQL, resultMap, queryUses.slice(2), workspacePath, configFile);
|
await addLocalQueries(codeQL, resultMap, queryUses.slice(2), workspacePath, configFile);
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
// Check for one of the builtin suites
|
// Check for one of the builtin suites
|
||||||
if (queryUses.indexOf("/") === -1 && queryUses.indexOf("@") === -1) {
|
if (queryUses.indexOf("/") === -1 && queryUses.indexOf("@") === -1) {
|
||||||
return await addBuiltinSuiteQueries(languages, codeQL, resultMap, packs, queryUses, features, configFile);
|
await addBuiltinSuiteQueries(languages, codeQL, resultMap, queryUses, configFile);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
// Otherwise, must be a reference to another repo.
|
// Otherwise, must be a reference to another repo.
|
||||||
// If config parsing is handled in CLI, then this repo will be downloaded
|
// If config parsing is handled in CLI, then this repo will be downloaded
|
||||||
@@ -256,7 +230,6 @@ async function parseQueryUses(languages, codeQL, resultMap, packs, queryUses, te
|
|||||||
if (!(await (0, feature_flags_1.useCodeScanningConfigInCli)(codeQL, features))) {
|
if (!(await (0, feature_flags_1.useCodeScanningConfigInCli)(codeQL, features))) {
|
||||||
await addRemoteQueries(codeQL, resultMap, queryUses, tempDir, apiDetails, logger, configFile);
|
await addRemoteQueries(codeQL, resultMap, queryUses, tempDir, apiDetails, logger, configFile);
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
// Regex validating stars in paths or paths-ignore entries.
|
// Regex validating stars in paths or paths-ignore entries.
|
||||||
// The intention is to only allow ** to appear when immediately
|
// The intention is to only allow ** to appear when immediately
|
||||||
@@ -395,7 +368,7 @@ function getNoLanguagesError() {
|
|||||||
}
|
}
|
||||||
exports.getNoLanguagesError = getNoLanguagesError;
|
exports.getNoLanguagesError = getNoLanguagesError;
|
||||||
function getUnknownLanguagesError(languages) {
|
function getUnknownLanguagesError(languages) {
|
||||||
return `Did not recognise the following languages: ${languages.join(", ")}`;
|
return `Did not recognize the following languages: ${languages.join(", ")}`;
|
||||||
}
|
}
|
||||||
exports.getUnknownLanguagesError = getUnknownLanguagesError;
|
exports.getUnknownLanguagesError = getUnknownLanguagesError;
|
||||||
/**
|
/**
|
||||||
@@ -436,13 +409,20 @@ exports.getLanguagesInRepo = getLanguagesInRepo;
|
|||||||
async function getLanguages(codeQL, languagesInput, repository, logger) {
|
async function getLanguages(codeQL, languagesInput, repository, logger) {
|
||||||
// Obtain languages without filtering them.
|
// Obtain languages without filtering them.
|
||||||
const { rawLanguages, autodetected } = await getRawLanguages(languagesInput, repository, logger);
|
const { rawLanguages, autodetected } = await getRawLanguages(languagesInput, repository, logger);
|
||||||
let languages = rawLanguages.map(languages_1.resolveAlias);
|
let languages = rawLanguages;
|
||||||
if (autodetected) {
|
if (autodetected) {
|
||||||
const availableLanguages = await codeQL.resolveLanguages();
|
const supportedLanguages = Object.keys(await codeQL.resolveLanguages());
|
||||||
languages = languages.filter((value) => value in availableLanguages);
|
languages = languages
|
||||||
|
.map(languages_1.parseLanguage)
|
||||||
|
.filter((value) => value && supportedLanguages.includes(value))
|
||||||
|
.map((value) => value);
|
||||||
logger.info(`Automatically detected languages: ${languages.join(", ")}`);
|
logger.info(`Automatically detected languages: ${languages.join(", ")}`);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
const aliases = await getLanguageAliases(codeQL);
|
||||||
|
if (aliases) {
|
||||||
|
languages = languages.map((lang) => aliases[lang] || lang);
|
||||||
|
}
|
||||||
logger.info(`Languages from configuration: ${languages.join(", ")}`);
|
logger.info(`Languages from configuration: ${languages.join(", ")}`);
|
||||||
}
|
}
|
||||||
// If the languages parameter was not given and no languages were
|
// If the languages parameter was not given and no languages were
|
||||||
@@ -454,7 +434,6 @@ async function getLanguages(codeQL, languagesInput, repository, logger) {
|
|||||||
const parsedLanguages = [];
|
const parsedLanguages = [];
|
||||||
const unknownLanguages = [];
|
const unknownLanguages = [];
|
||||||
for (const language of languages) {
|
for (const language of languages) {
|
||||||
// We know this is not an alias since we resolved it above.
|
|
||||||
const parsedLanguage = (0, languages_1.parseLanguage)(language);
|
const parsedLanguage = (0, languages_1.parseLanguage)(language);
|
||||||
if (parsedLanguage === undefined) {
|
if (parsedLanguage === undefined) {
|
||||||
unknownLanguages.push(language);
|
unknownLanguages.push(language);
|
||||||
@@ -471,6 +450,17 @@ async function getLanguages(codeQL, languagesInput, repository, logger) {
|
|||||||
return parsedLanguages;
|
return parsedLanguages;
|
||||||
}
|
}
|
||||||
exports.getLanguages = getLanguages;
|
exports.getLanguages = getLanguages;
|
||||||
|
/**
|
||||||
|
* Gets the set of languages supported by CodeQL, along with their aliases if supported by the
|
||||||
|
* version of the CLI.
|
||||||
|
*/
|
||||||
|
async function getLanguageAliases(codeql) {
|
||||||
|
if (await (0, util_1.codeQlVersionAbove)(codeql, codeql_1.CODEQL_VERSION_LANGUAGE_ALIASING)) {
|
||||||
|
return (await codeql.betterResolveLanguages()).aliases;
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
exports.getLanguageAliases = getLanguageAliases;
|
||||||
/**
|
/**
|
||||||
* Gets the set of languages in the current repository without checking to
|
* Gets the set of languages in the current repository without checking to
|
||||||
* see if these languages are actually supported by CodeQL.
|
* see if these languages are actually supported by CodeQL.
|
||||||
@@ -499,16 +489,13 @@ async function getRawLanguages(languagesInput, repository, logger) {
|
|||||||
return { rawLanguages, autodetected };
|
return { rawLanguages, autodetected };
|
||||||
}
|
}
|
||||||
exports.getRawLanguages = getRawLanguages;
|
exports.getRawLanguages = getRawLanguages;
|
||||||
async function addQueriesAndPacksFromWorkflow(codeQL, queriesInput, languages, resultMap, packs, tempDir, workspacePath, apiDetails, features, logger) {
|
async function addQueriesFromWorkflow(codeQL, queriesInput, languages, resultMap, tempDir, workspacePath, apiDetails, features, logger) {
|
||||||
let injectedMlQueries = false;
|
|
||||||
queriesInput = queriesInput.trim();
|
queriesInput = queriesInput.trim();
|
||||||
// "+" means "don't override config file" - see shouldAddConfigFileQueries
|
// "+" means "don't override config file" - see shouldAddConfigFileQueries
|
||||||
queriesInput = queriesInput.replace(/^\+/, "");
|
queriesInput = queriesInput.replace(/^\+/, "");
|
||||||
for (const query of queriesInput.split(",")) {
|
for (const query of queriesInput.split(",")) {
|
||||||
const didInject = await parseQueryUses(languages, codeQL, resultMap, packs, query, tempDir, workspacePath, apiDetails, features, logger);
|
await parseQueryUses(languages, codeQL, resultMap, query, tempDir, workspacePath, apiDetails, features, logger);
|
||||||
injectedMlQueries = injectedMlQueries || didInject;
|
|
||||||
}
|
}
|
||||||
return injectedMlQueries;
|
|
||||||
}
|
}
|
||||||
// Returns true if either no queries were provided in the workflow.
|
// Returns true if either no queries were provided in the workflow.
|
||||||
// or if the queries in the workflow were provided in "additive" mode,
|
// or if the queries in the workflow were provided in "additive" mode,
|
||||||
@@ -540,8 +527,7 @@ async function getDefaultConfig(languagesInput, rawQueriesInput, rawPacksInput,
|
|||||||
}
|
}
|
||||||
: {};
|
: {};
|
||||||
if (rawQueriesInput) {
|
if (rawQueriesInput) {
|
||||||
augmentationProperties.injectedMlQueries =
|
await addQueriesFromWorkflow(codeQL, rawQueriesInput, languages, queries, tempDir, workspacePath, apiDetails, features, logger);
|
||||||
await addQueriesAndPacksFromWorkflow(codeQL, rawQueriesInput, languages, queries, packs, tempDir, workspacePath, apiDetails, features, logger);
|
|
||||||
}
|
}
|
||||||
const { trapCaches, trapCacheDownloadTime } = await downloadCacheWithTime(trapCachingEnabled, codeQL, languages, logger);
|
const { trapCaches, trapCacheDownloadTime } = await downloadCacheWithTime(trapCachingEnabled, codeQL, languages, logger);
|
||||||
return {
|
return {
|
||||||
@@ -624,8 +610,7 @@ async function loadConfig(languagesInput, rawQueriesInput, rawPacksInput, config
|
|||||||
// unless they're prefixed with "+", in which case they supplement those
|
// unless they're prefixed with "+", in which case they supplement those
|
||||||
// in the config file.
|
// in the config file.
|
||||||
if (rawQueriesInput) {
|
if (rawQueriesInput) {
|
||||||
augmentationProperties.injectedMlQueries =
|
await addQueriesFromWorkflow(codeQL, rawQueriesInput, languages, queries, tempDir, workspacePath, apiDetails, features, logger);
|
||||||
await addQueriesAndPacksFromWorkflow(codeQL, rawQueriesInput, languages, queries, packs, tempDir, workspacePath, apiDetails, features, logger);
|
|
||||||
}
|
}
|
||||||
if (shouldAddConfigFileQueries(rawQueriesInput) &&
|
if (shouldAddConfigFileQueries(rawQueriesInput) &&
|
||||||
QUERIES_PROPERTY in parsedYAML) {
|
QUERIES_PROPERTY in parsedYAML) {
|
||||||
@@ -637,7 +622,7 @@ async function loadConfig(languagesInput, rawQueriesInput, rawPacksInput, config
|
|||||||
if (typeof query[QUERIES_USES_PROPERTY] !== "string") {
|
if (typeof query[QUERIES_USES_PROPERTY] !== "string") {
|
||||||
throw new util_1.UserError(getQueriesMissingUses(configFile));
|
throw new util_1.UserError(getQueriesMissingUses(configFile));
|
||||||
}
|
}
|
||||||
await parseQueryUses(languages, codeQL, queries, packs, query[QUERIES_USES_PROPERTY], tempDir, workspacePath, apiDetails, features, logger, configFile);
|
await parseQueryUses(languages, codeQL, queries, query[QUERIES_USES_PROPERTY], tempDir, workspacePath, apiDetails, features, logger, configFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (PATHS_IGNORE_PROPERTY in parsedYAML) {
|
if (PATHS_IGNORE_PROPERTY in parsedYAML) {
|
||||||
@@ -707,7 +692,6 @@ function calculateAugmentation(rawPacksInput, rawQueriesInput, languages) {
|
|||||||
const queriesInputCombines = shouldCombine(rawQueriesInput);
|
const queriesInputCombines = shouldCombine(rawQueriesInput);
|
||||||
const queriesInput = parseQueriesFromInput(rawQueriesInput, queriesInputCombines);
|
const queriesInput = parseQueriesFromInput(rawQueriesInput, queriesInputCombines);
|
||||||
return {
|
return {
|
||||||
injectedMlQueries: false,
|
|
||||||
packsInputCombines,
|
packsInputCombines,
|
||||||
packsInput: packsInput?.[languages[0]],
|
packsInput: packsInput?.[languages[0]],
|
||||||
queriesInput,
|
queriesInput,
|
||||||
@@ -915,46 +899,6 @@ function combinePacks(packs1, packs2) {
|
|||||||
}
|
}
|
||||||
return packs;
|
return packs;
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Get information about ML-powered JS queries to populate status reports with.
|
|
||||||
*
|
|
||||||
* This will be:
|
|
||||||
*
|
|
||||||
* - The version string if the analysis is using a single version of the ML-powered query pack.
|
|
||||||
* - "latest" if the version string of the ML-powered query pack is undefined. This is unlikely to
|
|
||||||
* occur in practice (see comment below).
|
|
||||||
* - "false" if the analysis won't run any ML-powered JS queries.
|
|
||||||
* - "other" in all other cases.
|
|
||||||
*
|
|
||||||
* Our goal of the status report here is to allow us to compare the occurrence of timeouts and other
|
|
||||||
* errors with ML-powered queries turned on and off. We also want to be able to compare minor
|
|
||||||
* version bumps caused by us bumping the version range of `ML_POWERED_JS_QUERIES_PACK` in a new
|
|
||||||
* version of the CodeQL Action. For instance, we might want to compare the `~0.1.0` and `~0.0.2`
|
|
||||||
* version strings.
|
|
||||||
*
|
|
||||||
* This function lives here rather than in `init-action.ts` so it's easier to test, since tests for
|
|
||||||
* `init-action.ts` would each need to live in their own file. See `analyze-action-env.ts` for an
|
|
||||||
* explanation as to why this is.
|
|
||||||
*/
|
|
||||||
function getMlPoweredJsQueriesStatus(config) {
|
|
||||||
const mlPoweredJsQueryPacks = (config.packs.javascript || [])
|
|
||||||
.map((p) => parsePacksSpecification(p))
|
|
||||||
.filter((pack) => pack.name === util_1.ML_POWERED_JS_QUERIES_PACK_NAME && !pack.path);
|
|
||||||
switch (mlPoweredJsQueryPacks.length) {
|
|
||||||
case 1:
|
|
||||||
// We should always specify an explicit version string in `getMlPoweredJsQueriesPack`,
|
|
||||||
// otherwise we won't be able to make changes to the pack unless those changes are compatible
|
|
||||||
// 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
|
|
||||||
// CodeQL config.
|
|
||||||
return mlPoweredJsQueryPacks[0].version || "latest";
|
|
||||||
case 0:
|
|
||||||
return "false";
|
|
||||||
default:
|
|
||||||
return "other";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.getMlPoweredJsQueriesStatus = getMlPoweredJsQueriesStatus;
|
|
||||||
function dbLocationOrDefault(dbLocation, tempDir) {
|
function dbLocationOrDefault(dbLocation, tempDir) {
|
||||||
return dbLocation || path.resolve(tempDir, "codeql_databases");
|
return dbLocation || path.resolve(tempDir, "codeql_databases");
|
||||||
}
|
}
|
||||||
@@ -1098,7 +1042,7 @@ async function getConfig(tempDir, logger) {
|
|||||||
exports.getConfig = getConfig;
|
exports.getConfig = getConfig;
|
||||||
async function downloadPacks(codeQL, languages, packs, apiDetails, registriesInput, tempDir, logger) {
|
async function downloadPacks(codeQL, languages, packs, apiDetails, registriesInput, tempDir, logger) {
|
||||||
// This code path is only used when config parsing occurs in the Action.
|
// This code path is only used when config parsing occurs in the Action.
|
||||||
const { registriesAuthTokens, qlconfigFile } = await generateRegistries(registriesInput, codeQL, tempDir, logger);
|
const { registriesAuthTokens, qlconfigFile } = await generateRegistries(registriesInput, tempDir, logger);
|
||||||
await wrapEnvironment({
|
await wrapEnvironment({
|
||||||
GITHUB_TOKEN: apiDetails.auth,
|
GITHUB_TOKEN: apiDetails.auth,
|
||||||
CODEQL_REGISTRIES_AUTH: registriesAuthTokens,
|
CODEQL_REGISTRIES_AUTH: registriesAuthTokens,
|
||||||
@@ -1138,14 +1082,11 @@ exports.downloadPacks = downloadPacks;
|
|||||||
* @returns The path to the generated `qlconfig.yml` file and the auth tokens to
|
* @returns The path to the generated `qlconfig.yml` file and the auth tokens to
|
||||||
* use for each registry.
|
* use for each registry.
|
||||||
*/
|
*/
|
||||||
async function generateRegistries(registriesInput, codeQL, tempDir, logger) {
|
async function generateRegistries(registriesInput, tempDir, logger) {
|
||||||
const registries = parseRegistries(registriesInput);
|
const registries = parseRegistries(registriesInput);
|
||||||
let registriesAuthTokens;
|
let registriesAuthTokens;
|
||||||
let qlconfigFile;
|
let qlconfigFile;
|
||||||
if (registries) {
|
if (registries) {
|
||||||
if (!(await (0, util_1.codeQlVersionAbove)(codeQL, codeql_1.CODEQL_VERSION_GHES_PACK_DOWNLOAD))) {
|
|
||||||
throw new util_1.UserError(`The 'registries' input is not supported on CodeQL CLI versions earlier than ${codeql_1.CODEQL_VERSION_GHES_PACK_DOWNLOAD}. Please upgrade to CodeQL CLI version ${codeql_1.CODEQL_VERSION_GHES_PACK_DOWNLOAD} or later.`);
|
|
||||||
}
|
|
||||||
// generate a qlconfig.yml file to hold the registry configs.
|
// generate a qlconfig.yml file to hold the registry configs.
|
||||||
const qlconfig = createRegistriesBlock(registries);
|
const qlconfig = createRegistriesBlock(registries);
|
||||||
qlconfigFile = path.join(tempDir, "qlconfig.yml");
|
qlconfigFile = path.join(tempDir, "qlconfig.yml");
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
189
lib/config-utils.test.js
generated
189
lib/config-utils.test.js
generated
@@ -35,7 +35,6 @@ const sinon = __importStar(require("sinon"));
|
|||||||
const api = __importStar(require("./api-client"));
|
const api = __importStar(require("./api-client"));
|
||||||
const codeql_1 = require("./codeql");
|
const codeql_1 = require("./codeql");
|
||||||
const configUtils = __importStar(require("./config-utils"));
|
const configUtils = __importStar(require("./config-utils"));
|
||||||
const feature_flags_1 = require("./feature-flags");
|
|
||||||
const languages_1 = require("./languages");
|
const languages_1 = require("./languages");
|
||||||
const logging_1 = require("./logging");
|
const logging_1 = require("./logging");
|
||||||
const repository_1 = require("./repository");
|
const repository_1 = require("./repository");
|
||||||
@@ -1062,66 +1061,6 @@ parseInputAndConfigErrorMacro.title = (providedTitle) => `Parse Packs input and
|
|||||||
(0, ava_1.default)("input with two languages", parseInputAndConfigErrorMacro, {}, "c/d", [languages_1.Language.cpp, languages_1.Language.csharp], false, /multi-language analysis/);
|
(0, ava_1.default)("input with two languages", parseInputAndConfigErrorMacro, {}, "c/d", [languages_1.Language.cpp, languages_1.Language.csharp], false, /multi-language analysis/);
|
||||||
(0, ava_1.default)("input with + only", parseInputAndConfigErrorMacro, {}, " + ", [languages_1.Language.cpp], true, /remove the '\+'/);
|
(0, ava_1.default)("input with + only", parseInputAndConfigErrorMacro, {}, " + ", [languages_1.Language.cpp], true, /remove the '\+'/);
|
||||||
(0, ava_1.default)("input with invalid pack name", parseInputAndConfigErrorMacro, {}, " xxx", [languages_1.Language.cpp], false, /"xxx" is not a valid pack/);
|
(0, ava_1.default)("input with invalid pack name", parseInputAndConfigErrorMacro, {}, " xxx", [languages_1.Language.cpp], false, /"xxx" is not a valid pack/);
|
||||||
const mlPoweredQueriesMacro = ava_1.default.macro({
|
|
||||||
exec: async (t, codeQLVersion, isMlPoweredQueriesEnabled, packsInput, queriesInput, expectedVersionString) => {
|
|
||||||
return await (0, util_1.withTmpDir)(async (tmpDir) => {
|
|
||||||
const codeQL = (0, codeql_1.setCodeQL)({
|
|
||||||
async getVersion() {
|
|
||||||
return codeQLVersion;
|
|
||||||
},
|
|
||||||
async resolveQueries() {
|
|
||||||
return {
|
|
||||||
byLanguage: {
|
|
||||||
javascript: { "fake-query.ql": {} },
|
|
||||||
},
|
|
||||||
noDeclaredLanguage: {},
|
|
||||||
multipleDeclaredLanguages: {},
|
|
||||||
};
|
|
||||||
},
|
|
||||||
async packDownload() {
|
|
||||||
return { packs: [] };
|
|
||||||
},
|
|
||||||
});
|
|
||||||
const { packs } = await configUtils.initConfig("javascript", queriesInput, packsInput, undefined, undefined, undefined, undefined, false, false, "", "", { owner: "github", repo: "example" }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)(isMlPoweredQueriesEnabled ? [feature_flags_1.Feature.MlPoweredQueriesEnabled] : []), (0, logging_1.getRunnerLogger)(true));
|
|
||||||
if (expectedVersionString !== undefined) {
|
|
||||||
t.deepEqual(packs, {
|
|
||||||
[languages_1.Language.javascript]: [
|
|
||||||
`codeql/javascript-experimental-atm-queries@${expectedVersionString}`,
|
|
||||||
],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
t.deepEqual(packs, {});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
title: (_providedTitle, codeQLVersion, isMlPoweredQueriesEnabled, packsInput, queriesInput, expectedVersionString) => `ML-powered queries ${expectedVersionString !== undefined
|
|
||||||
? `${expectedVersionString} are`
|
|
||||||
: "aren't"} loaded for packs: ${packsInput}, queries: ${queriesInput} using CLI v${codeQLVersion} when feature is ${isMlPoweredQueriesEnabled ? "enabled" : "disabled"}`,
|
|
||||||
});
|
|
||||||
// macro, codeQLVersion, isMlPoweredQueriesEnabled, packsInput, queriesInput, expectedVersionString
|
|
||||||
// Test that ML-powered queries aren't run when the feature is off.
|
|
||||||
(0, ava_1.default)(mlPoweredQueriesMacro, "2.12.3", false, undefined, "security-extended", undefined);
|
|
||||||
// Test that ML-powered queries aren't run when the user hasn't specified that we should run the
|
|
||||||
// `security-extended`, `security-and-quality`, or `security-experimental` query suite.
|
|
||||||
(0, ava_1.default)(mlPoweredQueriesMacro, "2.12.3", true, undefined, undefined, undefined);
|
|
||||||
// Test that we don't inject an ML-powered query pack if the user has already specified one.
|
|
||||||
(0, ava_1.default)(mlPoweredQueriesMacro, "2.12.3", true, "codeql/javascript-experimental-atm-queries@0.0.1", "security-and-quality", "0.0.1");
|
|
||||||
// Test that ML-powered queries ~0.3.0 are run on all platforms running `security-extended` on
|
|
||||||
// CodeQL CLI 2.9.4+.
|
|
||||||
(0, ava_1.default)(mlPoweredQueriesMacro, "2.9.4", true, undefined, "security-extended", "~0.3.0");
|
|
||||||
// Test that ML-powered queries ~0.3.0 are run on all platforms running `security-and-quality` on
|
|
||||||
// CodeQL CLI 2.9.4+.
|
|
||||||
(0, ava_1.default)(mlPoweredQueriesMacro, "2.9.4", true, undefined, "security-and-quality", "~0.3.0");
|
|
||||||
// Test that ML-powered queries ~0.4.0 are run on all platforms running `security-extended` on
|
|
||||||
// CodeQL CLI 2.11.3+.
|
|
||||||
(0, ava_1.default)(mlPoweredQueriesMacro, "2.11.3", true, undefined, "security-extended", "~0.4.0");
|
|
||||||
// Test that ML-powered queries ~0.4.0 are run on all platforms running `security-and-quality` on
|
|
||||||
// CodeQL CLI 2.11.3+.
|
|
||||||
(0, ava_1.default)(mlPoweredQueriesMacro, "2.11.3", true, undefined, "security-and-quality", "~0.4.0");
|
|
||||||
// Test that ML-powered queries are run on all platforms running `security-experimental` on CodeQL
|
|
||||||
// CLI 2.12.1+.
|
|
||||||
(0, ava_1.default)(mlPoweredQueriesMacro, "2.12.1", true, undefined, "security-experimental", "~0.4.0");
|
|
||||||
const calculateAugmentationMacro = ava_1.default.macro({
|
const calculateAugmentationMacro = ava_1.default.macro({
|
||||||
exec: async (t, _title, rawPacksInput, rawQueriesInput, languages, expectedAugmentationProperties) => {
|
exec: async (t, _title, rawPacksInput, rawQueriesInput, languages, expectedAugmentationProperties) => {
|
||||||
const actualAugmentationProperties = configUtils.calculateAugmentation(rawPacksInput, rawQueriesInput, languages);
|
const actualAugmentationProperties = configUtils.calculateAugmentation(rawPacksInput, rawQueriesInput, languages);
|
||||||
@@ -1134,35 +1073,30 @@ const calculateAugmentationMacro = ava_1.default.macro({
|
|||||||
queriesInput: undefined,
|
queriesInput: undefined,
|
||||||
packsInputCombines: false,
|
packsInputCombines: false,
|
||||||
packsInput: undefined,
|
packsInput: undefined,
|
||||||
injectedMlQueries: false,
|
|
||||||
});
|
});
|
||||||
(0, ava_1.default)(calculateAugmentationMacro, "With queries", undefined, " a, b , c, d", [languages_1.Language.javascript], {
|
(0, ava_1.default)(calculateAugmentationMacro, "With queries", undefined, " a, b , c, d", [languages_1.Language.javascript], {
|
||||||
queriesInputCombines: false,
|
queriesInputCombines: false,
|
||||||
queriesInput: [{ uses: "a" }, { uses: "b" }, { uses: "c" }, { uses: "d" }],
|
queriesInput: [{ uses: "a" }, { uses: "b" }, { uses: "c" }, { uses: "d" }],
|
||||||
packsInputCombines: false,
|
packsInputCombines: false,
|
||||||
packsInput: undefined,
|
packsInput: undefined,
|
||||||
injectedMlQueries: false,
|
|
||||||
});
|
});
|
||||||
(0, ava_1.default)(calculateAugmentationMacro, "With queries combining", undefined, " + a, b , c, d ", [languages_1.Language.javascript], {
|
(0, ava_1.default)(calculateAugmentationMacro, "With queries combining", undefined, " + a, b , c, d ", [languages_1.Language.javascript], {
|
||||||
queriesInputCombines: true,
|
queriesInputCombines: true,
|
||||||
queriesInput: [{ uses: "a" }, { uses: "b" }, { uses: "c" }, { uses: "d" }],
|
queriesInput: [{ uses: "a" }, { uses: "b" }, { uses: "c" }, { uses: "d" }],
|
||||||
packsInputCombines: false,
|
packsInputCombines: false,
|
||||||
packsInput: undefined,
|
packsInput: undefined,
|
||||||
injectedMlQueries: false,
|
|
||||||
});
|
});
|
||||||
(0, ava_1.default)(calculateAugmentationMacro, "With packs", " codeql/a , codeql/b , codeql/c , codeql/d ", undefined, [languages_1.Language.javascript], {
|
(0, ava_1.default)(calculateAugmentationMacro, "With packs", " codeql/a , codeql/b , codeql/c , codeql/d ", undefined, [languages_1.Language.javascript], {
|
||||||
queriesInputCombines: false,
|
queriesInputCombines: false,
|
||||||
queriesInput: undefined,
|
queriesInput: undefined,
|
||||||
packsInputCombines: false,
|
packsInputCombines: false,
|
||||||
packsInput: ["codeql/a", "codeql/b", "codeql/c", "codeql/d"],
|
packsInput: ["codeql/a", "codeql/b", "codeql/c", "codeql/d"],
|
||||||
injectedMlQueries: false,
|
|
||||||
});
|
});
|
||||||
(0, ava_1.default)(calculateAugmentationMacro, "With packs combining", " + codeql/a, codeql/b, codeql/c, codeql/d", undefined, [languages_1.Language.javascript], {
|
(0, ava_1.default)(calculateAugmentationMacro, "With packs combining", " + codeql/a, codeql/b, codeql/c, codeql/d", undefined, [languages_1.Language.javascript], {
|
||||||
queriesInputCombines: false,
|
queriesInputCombines: false,
|
||||||
queriesInput: undefined,
|
queriesInput: undefined,
|
||||||
packsInputCombines: true,
|
packsInputCombines: true,
|
||||||
packsInput: ["codeql/a", "codeql/b", "codeql/c", "codeql/d"],
|
packsInput: ["codeql/a", "codeql/b", "codeql/c", "codeql/d"],
|
||||||
injectedMlQueries: false,
|
|
||||||
});
|
});
|
||||||
const calculateAugmentationErrorMacro = ava_1.default.macro({
|
const calculateAugmentationErrorMacro = ava_1.default.macro({
|
||||||
exec: async (t, _title, rawPacksInput, rawQueriesInput, languages, expectedError) => {
|
exec: async (t, _title, rawPacksInput, rawQueriesInput, languages, expectedError) => {
|
||||||
@@ -1243,7 +1177,7 @@ const calculateAugmentationErrorMacro = ava_1.default.macro({
|
|||||||
});
|
});
|
||||||
const codeQL = (0, codeql_1.setCodeQL)({
|
const codeQL = (0, codeql_1.setCodeQL)({
|
||||||
packDownload: packDownloadStub,
|
packDownload: packDownloadStub,
|
||||||
getVersion: () => Promise.resolve("2.10.5"),
|
getVersion: () => Promise.resolve((0, testing_utils_1.makeVersionInfo)("2.10.5")),
|
||||||
});
|
});
|
||||||
// packs are supplied for go, java, and python
|
// packs are supplied for go, java, and python
|
||||||
// analyzed languages are java, javascript, and python
|
// analyzed languages are java, javascript, and python
|
||||||
@@ -1267,33 +1201,6 @@ const calculateAugmentationErrorMacro = ava_1.default.macro({
|
|||||||
t.deepEqual(process.env.CODEQL_REGISTRIES_AUTH, undefined);
|
t.deepEqual(process.env.CODEQL_REGISTRIES_AUTH, undefined);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
(0, ava_1.default)("downloadPacks-with-registries fails on 2.10.3", async (t) => {
|
|
||||||
// same thing, but this time include a registries block and
|
|
||||||
// associated env vars
|
|
||||||
return await (0, util_1.withTmpDir)(async (tmpDir) => {
|
|
||||||
process.env.GITHUB_TOKEN = "not-a-token";
|
|
||||||
process.env.CODEQL_REGISTRIES_AUTH = "not-a-registries-auth";
|
|
||||||
const logger = (0, logging_1.getRunnerLogger)(true);
|
|
||||||
const registriesInput = yaml.dump([
|
|
||||||
{
|
|
||||||
url: "http://ghcr.io",
|
|
||||||
packages: ["codeql/*", "codeql-testing/*"],
|
|
||||||
token: "not-a-token",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
url: "https://containers.GHEHOSTNAME1/v2/",
|
|
||||||
packages: "semmle/*",
|
|
||||||
token: "still-not-a-token",
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
const codeQL = (0, codeql_1.setCodeQL)({
|
|
||||||
getVersion: () => Promise.resolve("2.10.3"),
|
|
||||||
});
|
|
||||||
await t.throwsAsync(async () => {
|
|
||||||
return await configUtils.downloadPacks(codeQL, [languages_1.Language.javascript, languages_1.Language.java, languages_1.Language.python], {}, sampleApiDetails, registriesInput, tmpDir, logger);
|
|
||||||
}, { instanceOf: Error }, "'registries' input is not supported on CodeQL versions less than 2.10.4.");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
(0, ava_1.default)("downloadPacks-with-registries fails with invalid registries block", async (t) => {
|
(0, ava_1.default)("downloadPacks-with-registries fails with invalid registries block", async (t) => {
|
||||||
// same thing, but this time include a registries block and
|
// same thing, but this time include a registries block and
|
||||||
// associated env vars
|
// associated env vars
|
||||||
@@ -1314,42 +1221,18 @@ const calculateAugmentationErrorMacro = ava_1.default.macro({
|
|||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
const codeQL = (0, codeql_1.setCodeQL)({
|
const codeQL = (0, codeql_1.setCodeQL)({
|
||||||
getVersion: () => Promise.resolve("2.10.4"),
|
getVersion: () => Promise.resolve((0, testing_utils_1.makeVersionInfo)("2.10.4")),
|
||||||
});
|
});
|
||||||
await t.throwsAsync(async () => {
|
await t.throwsAsync(async () => {
|
||||||
return await configUtils.downloadPacks(codeQL, [languages_1.Language.javascript, languages_1.Language.java, languages_1.Language.python], {}, sampleApiDetails, registriesInput, tmpDir, logger);
|
return await configUtils.downloadPacks(codeQL, [languages_1.Language.javascript, languages_1.Language.java, languages_1.Language.python], {}, sampleApiDetails, registriesInput, tmpDir, logger);
|
||||||
}, { instanceOf: Error }, "Invalid 'registries' input. Must be an array of objects with 'url' and 'packages' properties.");
|
}, { instanceOf: Error }, "Invalid 'registries' input. Must be an array of objects with 'url' and 'packages' properties.");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
// the happy path for generateRegistries is already tested in downloadPacks.
|
|
||||||
// these following tests are for the error cases and when nothing is generated.
|
|
||||||
(0, ava_1.default)("no generateRegistries when CLI is too old", async (t) => {
|
|
||||||
return await (0, util_1.withTmpDir)(async (tmpDir) => {
|
|
||||||
const registriesInput = yaml.dump([
|
|
||||||
{
|
|
||||||
// no slash
|
|
||||||
url: "http://ghcr.io",
|
|
||||||
packages: ["codeql/*", "codeql-testing/*"],
|
|
||||||
token: "not-a-token",
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
const codeQL = (0, codeql_1.setCodeQL)({
|
|
||||||
// Accepted CLI versions are 2.10.4 or higher
|
|
||||||
getVersion: () => Promise.resolve("2.10.3"),
|
|
||||||
});
|
|
||||||
const logger = (0, logging_1.getRunnerLogger)(true);
|
|
||||||
await t.throwsAsync(async () => await configUtils.generateRegistries(registriesInput, codeQL, tmpDir, logger), undefined, "'registries' input is not supported on CodeQL versions less than 2.10.4.");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
(0, ava_1.default)("no generateRegistries when registries is undefined", async (t) => {
|
(0, ava_1.default)("no generateRegistries when registries is undefined", async (t) => {
|
||||||
return await (0, util_1.withTmpDir)(async (tmpDir) => {
|
return await (0, util_1.withTmpDir)(async (tmpDir) => {
|
||||||
const registriesInput = undefined;
|
const registriesInput = undefined;
|
||||||
const codeQL = (0, codeql_1.setCodeQL)({
|
|
||||||
// Accepted CLI versions are 2.10.4 or higher
|
|
||||||
getVersion: () => Promise.resolve(codeql_1.CODEQL_VERSION_GHES_PACK_DOWNLOAD),
|
|
||||||
});
|
|
||||||
const logger = (0, logging_1.getRunnerLogger)(true);
|
const logger = (0, logging_1.getRunnerLogger)(true);
|
||||||
const { registriesAuthTokens, qlconfigFile } = await configUtils.generateRegistries(registriesInput, codeQL, tmpDir, logger);
|
const { registriesAuthTokens, qlconfigFile } = await configUtils.generateRegistries(registriesInput, tmpDir, logger);
|
||||||
t.is(registriesAuthTokens, undefined);
|
t.is(registriesAuthTokens, undefined);
|
||||||
t.is(qlconfigFile, undefined);
|
t.is(qlconfigFile, undefined);
|
||||||
});
|
});
|
||||||
@@ -1364,12 +1247,8 @@ const calculateAugmentationErrorMacro = ava_1.default.macro({
|
|||||||
token: "not-a-token",
|
token: "not-a-token",
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
const codeQL = (0, codeql_1.setCodeQL)({
|
|
||||||
// Accepted CLI versions are 2.10.4 or higher
|
|
||||||
getVersion: () => Promise.resolve(codeql_1.CODEQL_VERSION_GHES_PACK_DOWNLOAD),
|
|
||||||
});
|
|
||||||
const logger = (0, logging_1.getRunnerLogger)(true);
|
const logger = (0, logging_1.getRunnerLogger)(true);
|
||||||
const { registriesAuthTokens, qlconfigFile } = await configUtils.generateRegistries(registriesInput, codeQL, tmpDir, logger);
|
const { registriesAuthTokens, qlconfigFile } = await configUtils.generateRegistries(registriesInput, tmpDir, logger);
|
||||||
t.is(registriesAuthTokens, "original");
|
t.is(registriesAuthTokens, "original");
|
||||||
t.is(qlconfigFile, path.join(tmpDir, "qlconfig.yml"));
|
t.is(qlconfigFile, path.join(tmpDir, "qlconfig.yml"));
|
||||||
});
|
});
|
||||||
@@ -1456,64 +1335,4 @@ const mockRepositoryNwo = (0, repository_1.parseRepositoryNwo)("owner/repo");
|
|||||||
t.deepEqual(mockRequest.called, args.expectedApiCall);
|
t.deepEqual(mockRequest.called, args.expectedApiCall);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
const ML_POWERED_JS_STATUS_TESTS = [
|
|
||||||
// If no packs are loaded, status is false.
|
|
||||||
[[], "false"],
|
|
||||||
// If another pack is loaded but not the ML-powered query pack, status is false.
|
|
||||||
[["some-other/pack"], "false"],
|
|
||||||
// If the ML-powered query pack is loaded with a specific version, status is that version.
|
|
||||||
[[`${util_1.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
|
|
||||||
// status is the version of the ML-powered query pack.
|
|
||||||
[["some-other/pack", `${util_1.ML_POWERED_JS_QUERIES_PACK_NAME}@~0.1.0`], "~0.1.0"],
|
|
||||||
// If the ML-powered query pack is loaded without a version, the status is "latest".
|
|
||||||
[[util_1.ML_POWERED_JS_QUERIES_PACK_NAME], "latest"],
|
|
||||||
// If the ML-powered query pack is loaded with two different versions, the status is "other".
|
|
||||||
[
|
|
||||||
[
|
|
||||||
`${util_1.ML_POWERED_JS_QUERIES_PACK_NAME}@~0.0.1`,
|
|
||||||
`${util_1.ML_POWERED_JS_QUERIES_PACK_NAME}@~0.0.2`,
|
|
||||||
],
|
|
||||||
"other",
|
|
||||||
],
|
|
||||||
// If the ML-powered query pack is loaded with no specific version, and another pack is loaded,
|
|
||||||
// the status is "latest".
|
|
||||||
[["some-other/pack", util_1.ML_POWERED_JS_QUERIES_PACK_NAME], "latest"],
|
|
||||||
];
|
|
||||||
for (const [packs, expectedStatus] of ML_POWERED_JS_STATUS_TESTS) {
|
|
||||||
const packDescriptions = `[${packs
|
|
||||||
.map((pack) => JSON.stringify(pack))
|
|
||||||
.join(", ")}]`;
|
|
||||||
(0, ava_1.default)(`ML-powered JS queries status report is "${expectedStatus}" for packs = ${packDescriptions}`, (t) => {
|
|
||||||
return (0, util_1.withTmpDir)(async (tmpDir) => {
|
|
||||||
const config = {
|
|
||||||
languages: [],
|
|
||||||
queries: {},
|
|
||||||
paths: [],
|
|
||||||
pathsIgnore: [],
|
|
||||||
originalUserInput: {},
|
|
||||||
tempDir: tmpDir,
|
|
||||||
codeQLCmd: "",
|
|
||||||
gitHubVersion: {
|
|
||||||
type: util_1.GitHubVariant.DOTCOM,
|
|
||||||
},
|
|
||||||
dbLocation: "",
|
|
||||||
packs: {
|
|
||||||
javascript: packs,
|
|
||||||
},
|
|
||||||
debugMode: false,
|
|
||||||
debugArtifactName: util_1.DEFAULT_DEBUG_ARTIFACT_NAME,
|
|
||||||
debugDatabaseName: util_1.DEFAULT_DEBUG_DATABASE_NAME,
|
|
||||||
augmentationProperties: {
|
|
||||||
injectedMlQueries: false,
|
|
||||||
packsInputCombines: false,
|
|
||||||
queriesInputCombines: false,
|
|
||||||
},
|
|
||||||
trapCaches: {},
|
|
||||||
trapCacheDownloadTime: 0,
|
|
||||||
};
|
|
||||||
t.is(configUtils.getMlPoweredJsQueriesStatus(config), expectedStatus);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
//# sourceMappingURL=config-utils.test.js.map
|
//# sourceMappingURL=config-utils.test.js.map
|
||||||
File diff suppressed because one or more lines are too long
4
lib/database-upload.js
generated
4
lib/database-upload.js
generated
@@ -56,12 +56,14 @@ async function uploadDatabases(repositoryNwo, config, apiDetails, logger) {
|
|||||||
const bundledDb = await (0, util_1.bundleDb)(config, language, codeql, language);
|
const bundledDb = await (0, util_1.bundleDb)(config, language, codeql, language);
|
||||||
const bundledDbSize = fs.statSync(bundledDb).size;
|
const bundledDbSize = fs.statSync(bundledDb).size;
|
||||||
const bundledDbReadStream = fs.createReadStream(bundledDb);
|
const bundledDbReadStream = fs.createReadStream(bundledDb);
|
||||||
|
const commitOid = await actionsUtil.getCommitOid(actionsUtil.getRequiredInput("checkout_path"));
|
||||||
try {
|
try {
|
||||||
await client.request(`POST https://uploads.github.com/repos/:owner/:repo/code-scanning/codeql/databases/:language?name=:name`, {
|
await client.request(`POST https://uploads.github.com/repos/:owner/:repo/code-scanning/codeql/databases/:language?name=:name&commit_oid=:commit_oid`, {
|
||||||
owner: repositoryNwo.owner,
|
owner: repositoryNwo.owner,
|
||||||
repo: repositoryNwo.repo,
|
repo: repositoryNwo.repo,
|
||||||
language,
|
language,
|
||||||
name: `${language}-database`,
|
name: `${language}-database`,
|
||||||
|
commit_oid: commitOid,
|
||||||
data: bundledDbReadStream,
|
data: bundledDbReadStream,
|
||||||
headers: {
|
headers: {
|
||||||
authorization: `token ${apiDetails.auth}`,
|
authorization: `token ${apiDetails.auth}`,
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"database-upload.js","sourceRoot":"","sources":["../src/database-upload.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AAEzB,4DAA8C;AAC9C,6CAA8D;AAC9D,qCAAqC;AAIrC,6CAA+B;AAC/B,iCAAkC;AAE3B,KAAK,UAAU,eAAe,CACnC,aAA4B,EAC5B,MAAc,EACd,UAA4B,EAC5B,MAAc;IAEd,IAAI,WAAW,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,KAAK,MAAM,EAAE;QAC9D,MAAM,CAAC,KAAK,CAAC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mockHttpRequests(databaseUploadStatusCode) {
|
|||||||
// Passing an auth token is required, so we just use a dummy value
|
// Passing an auth token is required, so we just use a dummy value
|
||||||
const client = github.getOctokit("123");
|
const client = github.getOctokit("123");
|
||||||
const requestSpy = sinon.stub(client, "request");
|
const requestSpy = sinon.stub(client, "request");
|
||||||
const url = "POST https://uploads.github.com/repos/:owner/:repo/code-scanning/codeql/databases/:language?name=:name";
|
const url = "POST https://uploads.github.com/repos/:owner/:repo/code-scanning/codeql/databases/:language?name=:name&commit_oid=:commit_oid";
|
||||||
const databaseUploadSpy = requestSpy.withArgs(url);
|
const databaseUploadSpy = requestSpy.withArgs(url);
|
||||||
if (databaseUploadStatusCode < 300) {
|
if (databaseUploadStatusCode < 300) {
|
||||||
databaseUploadSpy.resolves(undefined);
|
databaseUploadSpy.resolves(undefined);
|
||||||
@@ -93,7 +93,8 @@ async function mockHttpRequests(databaseUploadStatusCode) {
|
|||||||
const loggedMessages = [];
|
const loggedMessages = [];
|
||||||
await (0, database_upload_1.uploadDatabases)(testRepoName, getTestConfig(tmpDir), testApiDetails, (0, testing_utils_1.getRecordingLogger)(loggedMessages));
|
await (0, database_upload_1.uploadDatabases)(testRepoName, getTestConfig(tmpDir), testApiDetails, (0, testing_utils_1.getRecordingLogger)(loggedMessages));
|
||||||
t.assert(loggedMessages.find((v) => v.type === "debug" &&
|
t.assert(loggedMessages.find((v) => v.type === "debug" &&
|
||||||
v.message === "Database upload disabled in workflow. Skipping upload.") !== undefined);
|
v.message ===
|
||||||
|
"Database upload disabled in workflow. Skipping upload.") !== undefined);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
(0, ava_1.default)("Abort database upload if running against GHES", async (t) => {
|
(0, ava_1.default)("Abort database upload if running against GHES", async (t) => {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
2
lib/debug-artifacts.js
generated
2
lib/debug-artifacts.js
generated
@@ -56,7 +56,7 @@ async function uploadDebugArtifacts(toUpload, rootDir, artifactName) {
|
|||||||
core.info("Could not parse user-specified `matrix` input into JSON. The debug artifact will not be named with the user's `matrix` input.");
|
core.info("Could not parse user-specified `matrix` input into JSON. The debug artifact will not be named with the user's `matrix` input.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await artifact.create().uploadArtifact(sanitizeArifactName(`${artifactName}${suffix}`), toUpload.map((file) => path.normalize(file)), path.normalize(rootDir));
|
await artifact.create().uploadArtifact(sanitizeArifactName(`${artifactName}${suffix}`), toUpload.map((file) => path.normalize(file)), path.normalize(rootDir), { continueOnError: true });
|
||||||
}
|
}
|
||||||
exports.uploadDebugArtifacts = uploadDebugArtifacts;
|
exports.uploadDebugArtifacts = uploadDebugArtifacts;
|
||||||
async function uploadSarifDebugArtifact(config, outputDir) {
|
async function uploadSarifDebugArtifact(config, outputDir) {
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"debug-artifacts.js","sourceRoot":"","sources":["../src/debug-artifacts.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAE7B,4DAA8C;AAC9C,oDAAsC;AACtC,sDAA6B;AAC7B,8CAAsB;AAEtB,iDAAkD;AAClD,uCAA0C;AAC1C,qCAAqC;AAIrC,iCAKgB;AAEhB,SAAgB,mBAAmB,CAAC,IAAY;IAC9C,OAAO,IAAI,CAAC,OAAO,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAC;AAChD,CAAC;AAFD,kDAEC;AAEM,KAAK,UAAU,oBAAoB,CACxC,QAAkB,EAClB,OAAe,EACf,YAAoB;IAEpB,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;QACzB,OAAO;KACR;IACD,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,MAAM,MAAM,GAAG,IAAA,+BAAgB,EAAC,QAAQ,CAAC,CAAC;IAC1C,IAAI,MAAM,EAAE;QACV,IAAI;YACF,KAAK,MAAM,CAAC,EAAE,SAAS,CAAC,IAAI,M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,EAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE;gBAC5C,kBAAkB,GAAG,MAAM,2BAA2B,CACpD,MAAM,EACN,QAAQ,CACT,CAAC;aACH;iBAAM;gBACL,kBAAkB,GAAG,MAAM,uBAAuB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;aACtE;YACD,MAAM,oBAAoB,CACxB,CAAC,kBAAkB,CAAC,EACpB,MAAM,CAAC,UAAU,EACjB,MAAM,CAAC,iBAAiB,CACzB,CAAC;SACH;QAAC,OAAO,KAAK,EAAE;YACd,IAAI,CAAC,IAAI,CACP,8CAA8C,MAAM,CAAC,iBAAiB,IAAI,QAAQ,KAAK,KAAK,EAAE,CAC/F,CAAC;SACH;KACF;AACH,CAAC;AA1BD,8EA0BC"}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"bundleVersion": "codeql-bundle-v2.14.0",
|
"bundleVersion": "codeql-bundle-v2.15.0",
|
||||||
"cliVersion": "2.14.0",
|
"cliVersion": "2.15.0",
|
||||||
"priorBundleVersion": "codeql-bundle-v2.13.5",
|
"priorBundleVersion": "codeql-bundle-v2.14.6",
|
||||||
"priorCliVersion": "2.13.5"
|
"priorCliVersion": "2.14.6"
|
||||||
}
|
}
|
||||||
|
|||||||
47
lib/diagnostics.js
generated
Normal file
47
lib/diagnostics.js
generated
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
"use strict";
|
||||||
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.addDiagnostic = exports.makeDiagnostic = void 0;
|
||||||
|
const fs_1 = require("fs");
|
||||||
|
const path_1 = __importDefault(require("path"));
|
||||||
|
const logging_1 = require("./logging");
|
||||||
|
const util_1 = require("./util");
|
||||||
|
/**
|
||||||
|
* Constructs a new diagnostic message with the specified id and name, as well as optional additional data.
|
||||||
|
*
|
||||||
|
* @param id An identifier under which it makes sense to group this diagnostic message.
|
||||||
|
* @param name Display name for the ID.
|
||||||
|
* @param data Optional additional data to initialize the diagnostic with.
|
||||||
|
* @returns Returns the new diagnostic message.
|
||||||
|
*/
|
||||||
|
function makeDiagnostic(id, name, data = undefined) {
|
||||||
|
return {
|
||||||
|
...data,
|
||||||
|
timestamp: data?.timestamp ?? new Date().toISOString(),
|
||||||
|
source: { ...data?.source, id, name },
|
||||||
|
};
|
||||||
|
}
|
||||||
|
exports.makeDiagnostic = makeDiagnostic;
|
||||||
|
/**
|
||||||
|
* Writes the given diagnostic to the database.
|
||||||
|
*
|
||||||
|
* @param config The configuration that tells us where to store the diagnostic.
|
||||||
|
* @param diagnostic The diagnostic message to add to the database.
|
||||||
|
*/
|
||||||
|
function addDiagnostic(config, language, diagnostic) {
|
||||||
|
const logger = (0, logging_1.getActionsLogger)();
|
||||||
|
const diagnosticsPath = path_1.default.resolve((0, util_1.getCodeQLDatabasePath)(config, language), "diagnostic", "codeql-action");
|
||||||
|
try {
|
||||||
|
// Create the directory if it doesn't exist yet.
|
||||||
|
(0, fs_1.mkdirSync)(diagnosticsPath, { recursive: true });
|
||||||
|
const jsonPath = path_1.default.resolve(diagnosticsPath, `codeql-action-${diagnostic.timestamp}.json`);
|
||||||
|
(0, fs_1.writeFileSync)(jsonPath, JSON.stringify(diagnostic));
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
logger.warning(`Unable to write diagnostic message to database: ${err}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.addDiagnostic = addDiagnostic;
|
||||||
|
//# sourceMappingURL=diagnostics.js.map
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user