mirror of
https://github.com/github/codeql.git
synced 2026-06-12 00:11:07 +02:00
Compare commits
429 Commits
codeql-cli
...
copilot/co
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
93898f5ee1 | ||
|
|
1d5f8e3254 | ||
|
|
d590687904 | ||
|
|
27c62aa9b7 | ||
|
|
4d2e16e97b | ||
|
|
212e9d07fd | ||
|
|
cf1e064131 | ||
|
|
9ea3e9088c | ||
|
|
8e07690049 | ||
|
|
d75113de93 | ||
|
|
11e99a03d5 | ||
|
|
f54debd65a | ||
|
|
c732bd6613 | ||
|
|
f5919875b7 | ||
|
|
8d456df26f | ||
|
|
72fcf27d1a | ||
|
|
0cea01c22f | ||
|
|
a473565256 | ||
|
|
c47135a40b | ||
|
|
3cbc8f0262 | ||
|
|
cc1ea25856 | ||
|
|
5a38cbd5d5 | ||
|
|
cf6d94cf8a | ||
|
|
292fc8b777 | ||
|
|
a1759d9834 | ||
|
|
6b74874372 | ||
|
|
ef29d22c75 | ||
|
|
1f91f915c7 | ||
|
|
ba8eebe2b5 | ||
|
|
dc1409e5f4 | ||
|
|
284f42bb9e | ||
|
|
2f3524de74 | ||
|
|
b32573b060 | ||
|
|
cd2398aeea | ||
|
|
d6892eaf0d | ||
|
|
d2972cb53f | ||
|
|
5576d30780 | ||
|
|
da999ee440 | ||
|
|
3da195f50f | ||
|
|
93a4b427e3 | ||
|
|
0430c71318 | ||
|
|
52f2a5825a | ||
|
|
d55ff83568 | ||
|
|
f34275636c | ||
|
|
0a801440b9 | ||
|
|
7edf0100cc | ||
|
|
167c837088 | ||
|
|
6f2cc43f32 | ||
|
|
5042fdee84 | ||
|
|
04341c47bd | ||
|
|
af45e53e77 | ||
|
|
b27d08ee32 | ||
|
|
d11fc3a00e | ||
|
|
20ce679d61 | ||
|
|
f62ebef9e0 | ||
|
|
c3ef1ddd64 | ||
|
|
dede5bc49b | ||
|
|
ad97b6dd64 | ||
|
|
9d5dfea5c5 | ||
|
|
dc0c7d7ec2 | ||
|
|
aaa3b363e1 | ||
|
|
61a5cece56 | ||
|
|
566a92e555 | ||
|
|
9dbe9adb00 | ||
|
|
be9c785cb2 | ||
|
|
1fd31d0ddd | ||
|
|
c4e3720d8a | ||
|
|
0547e9c98d | ||
|
|
703cea2b65 | ||
|
|
e6e8e3d005 | ||
|
|
adc9b7714b | ||
|
|
e706c5f444 | ||
|
|
8a1e6d4f64 | ||
|
|
1a747dd8be | ||
|
|
28bb1a6870 | ||
|
|
45b1253b23 | ||
|
|
c99dab1d71 | ||
|
|
f3e3647209 | ||
|
|
8d099cbe38 | ||
|
|
9618e9b35c | ||
|
|
2a3cff382c | ||
|
|
c610af88d3 | ||
|
|
fa63dad1d1 | ||
|
|
019a5c01ad | ||
|
|
5fb75ac987 | ||
|
|
c1c9287535 | ||
|
|
d1226b71de | ||
|
|
71a363545a | ||
|
|
3f3bed62d3 | ||
|
|
21f216af8c | ||
|
|
1751d70c62 | ||
|
|
ac8eb50c26 | ||
|
|
1ecdc3614f | ||
|
|
e3b3888bee | ||
|
|
ef9306d82c | ||
|
|
56822f8ee1 | ||
|
|
62207f152c | ||
|
|
d5f94475b5 | ||
|
|
00e95a0757 | ||
|
|
c695c151ea | ||
|
|
ab4a575243 | ||
|
|
d2f474d998 | ||
|
|
b38440490a | ||
|
|
22b08f1ea4 | ||
|
|
5e5a0437e1 | ||
|
|
e18448dd59 | ||
|
|
a16f1c555c | ||
|
|
43c1152634 | ||
|
|
caae5a8bf1 | ||
|
|
cfb18c2477 | ||
|
|
1a82a682e9 | ||
|
|
8b6f969cdb | ||
|
|
f4da0df3c7 | ||
|
|
9bc0c1b1ab | ||
|
|
aee33a0cc9 | ||
|
|
4c31866910 | ||
|
|
09371339d7 | ||
|
|
6165623cbf | ||
|
|
df15a719cb | ||
|
|
2eac8890d3 | ||
|
|
2d581504f7 | ||
|
|
9f211cebd5 | ||
|
|
8393b40b59 | ||
|
|
f8ab76e1ba | ||
|
|
34d4e9a8e2 | ||
|
|
812e8e6b34 | ||
|
|
80c6f082d1 | ||
|
|
ed8b9c29cc | ||
|
|
d95d99848c | ||
|
|
8937e22735 | ||
|
|
37589dd8a0 | ||
|
|
a159dc1c66 | ||
|
|
7718fe40a0 | ||
|
|
aeb82858d7 | ||
|
|
c08cf81665 | ||
|
|
e06158629e | ||
|
|
3e09961662 | ||
|
|
17fe3e4e31 | ||
|
|
313500e581 | ||
|
|
ad56ebd361 | ||
|
|
6be9e2315d | ||
|
|
cc12740c0e | ||
|
|
5c2488e304 | ||
|
|
4fbea4ef95 | ||
|
|
35faec3db1 | ||
|
|
acb5c0e70f | ||
|
|
6042adebae | ||
|
|
5f54a8691d | ||
|
|
41fd59c1c1 | ||
|
|
d6e7e38e1c | ||
|
|
ec13e1bcd3 | ||
|
|
7723324687 | ||
|
|
d4c7b5b6fe | ||
|
|
6b55f865cd | ||
|
|
42c4d8a98b | ||
|
|
f962eac914 | ||
|
|
c6c3e1474c | ||
|
|
94e6ec6511 | ||
|
|
c902c75651 | ||
|
|
2b4ea18dfe | ||
|
|
98b7659cc1 | ||
|
|
d9c0b9ca31 | ||
|
|
b44bca9ea7 | ||
|
|
e66b1e4beb | ||
|
|
362c48cc6d | ||
|
|
35364a087a | ||
|
|
780591d42a | ||
|
|
3aa69823af | ||
|
|
f18cdcfec6 | ||
|
|
7862922e5c | ||
|
|
fbc861e7a4 | ||
|
|
7f2fb2eb99 | ||
|
|
769b1957a5 | ||
|
|
26da373bd4 | ||
|
|
fe7b2b9d4f | ||
|
|
44a914e40f | ||
|
|
491c373e07 | ||
|
|
996e79131e | ||
|
|
688695cd57 | ||
|
|
3c4e22a8ba | ||
|
|
c70007607a | ||
|
|
9685755479 | ||
|
|
e07f45fff4 | ||
|
|
a7405bddaa | ||
|
|
3adb7043e8 | ||
|
|
8ad461be98 | ||
|
|
0e6257de2d | ||
|
|
77f6caca00 | ||
|
|
f98dfcd0a5 | ||
|
|
a027665ab4 | ||
|
|
de1cb26a93 | ||
|
|
9599f01ae0 | ||
|
|
e8779295ee | ||
|
|
7dcd2d6ab6 | ||
|
|
b6c2915f24 | ||
|
|
5a219d1527 | ||
|
|
ec7e38cd4d | ||
|
|
871f307fa4 | ||
|
|
3ee45ff4b9 | ||
|
|
6d6e9c0d47 | ||
|
|
0ef59dffb4 | ||
|
|
fa758d6bf5 | ||
|
|
fa9426c749 | ||
|
|
0ecca91dea | ||
|
|
f669a4f3bf | ||
|
|
3275c814bd | ||
|
|
9a180036a5 | ||
|
|
93e7ab52b7 | ||
|
|
facb3b681d | ||
|
|
b67694b2ab | ||
|
|
5503140318 | ||
|
|
a094a8e460 | ||
|
|
2f8c0df537 | ||
|
|
c25398ea0c | ||
|
|
7e6b10e8cf | ||
|
|
149bfd19d3 | ||
|
|
153fbb0378 | ||
|
|
039b5927f0 | ||
|
|
2070dafeb2 | ||
|
|
c3bafc75ab | ||
|
|
19f93cd18b | ||
|
|
39becfd7e5 | ||
|
|
0f3c9ab483 | ||
|
|
a84043b627 | ||
|
|
2280955136 | ||
|
|
4897757b96 | ||
|
|
8170c207bd | ||
|
|
38a2101e11 | ||
|
|
fb04cd2212 | ||
|
|
a33af09244 | ||
|
|
25d20399f3 | ||
|
|
e6c5f944ba | ||
|
|
157424cca3 | ||
|
|
b9bf81e463 | ||
|
|
e408540d36 | ||
|
|
462a7bc423 | ||
|
|
422a6bd670 | ||
|
|
4b095f3129 | ||
|
|
3aa660663e | ||
|
|
c1e26f9ea5 | ||
|
|
f5113b1932 | ||
|
|
f77d426706 | ||
|
|
c6ce13a012 | ||
|
|
bfc6deeb9b | ||
|
|
0a876583e5 | ||
|
|
aa136a3282 | ||
|
|
8b799f84ed | ||
|
|
6825ccc74f | ||
|
|
c0273ae94f | ||
|
|
1c01bb32d9 | ||
|
|
c3bb5e8eff | ||
|
|
9d0d4e4912 | ||
|
|
a2ac0ab7d5 | ||
|
|
42aaae7cf3 | ||
|
|
30a5769e20 | ||
|
|
a72cef6fda | ||
|
|
dc80a029cb | ||
|
|
49a435c402 | ||
|
|
96ef59a22a | ||
|
|
b1615312b8 | ||
|
|
63a09484a0 | ||
|
|
7a1a90b5a4 | ||
|
|
06c908756f | ||
|
|
d93de54397 | ||
|
|
adf59f3ee5 | ||
|
|
22a8123ee1 | ||
|
|
3119ef6c1a | ||
|
|
01ff9aa91f | ||
|
|
0633bc7b91 | ||
|
|
ad69cfb721 | ||
|
|
9f64000962 | ||
|
|
2c156994de | ||
|
|
19781e53e7 | ||
|
|
5f10a88208 | ||
|
|
5add24be59 | ||
|
|
16235d7aca | ||
|
|
5f6553490c | ||
|
|
d14b8064b0 | ||
|
|
7636bf560e | ||
|
|
9b2b5971fe | ||
|
|
c2e2770bbf | ||
|
|
cb0fc786c7 | ||
|
|
2902a19a50 | ||
|
|
7f1bebe8ba | ||
|
|
305a63bc38 | ||
|
|
963715884e | ||
|
|
b6847974f7 | ||
|
|
336bbc229e | ||
|
|
a4b2c0f6fd | ||
|
|
3eaf04ef72 | ||
|
|
914c7e1a7b | ||
|
|
29ffd87bf8 | ||
|
|
eae9c0ef0e | ||
|
|
c36ad7be37 | ||
|
|
59dbd68a5e | ||
|
|
3f7b50ebba | ||
|
|
dd9c066c61 | ||
|
|
f4f85b58ca | ||
|
|
caef72b047 | ||
|
|
9787a8b072 | ||
|
|
c8f7c3d7f2 | ||
|
|
ea6f3a9568 | ||
|
|
5d6dc5c3c3 | ||
|
|
b49b8ff6bd | ||
|
|
25c4d9d09b | ||
|
|
07b8d7eba7 | ||
|
|
f40d42c575 | ||
|
|
8585bb616d | ||
|
|
fc80a2472d | ||
|
|
6d5d57acca | ||
|
|
e77d85f23e | ||
|
|
b753e7d228 | ||
|
|
8e25240282 | ||
|
|
c8196e439f | ||
|
|
c8efc34e8b | ||
|
|
ee13ea0f6b | ||
|
|
554bdf14b2 | ||
|
|
b031e5b1f8 | ||
|
|
7fa6c4e4a3 | ||
|
|
600a4969c9 | ||
|
|
55194dd757 | ||
|
|
cbe4c81ca6 | ||
|
|
3b7a53f678 | ||
|
|
ccc1dd5d3e | ||
|
|
a966dff76e | ||
|
|
6b58482dfb | ||
|
|
2307839050 | ||
|
|
92838011dd | ||
|
|
5772ee4d9b | ||
|
|
72b683d63c | ||
|
|
8a2a48d2dd | ||
|
|
5d0cb9e805 | ||
|
|
bb9e996cb6 | ||
|
|
c3a9218dcf | ||
|
|
a049850c51 | ||
|
|
49f19092fb | ||
|
|
f668b99d6d | ||
|
|
d28792537b | ||
|
|
c2fc0cf111 | ||
|
|
c3cf7c2bca | ||
|
|
1e6570ec97 | ||
|
|
57ac0192c0 | ||
|
|
d16bc36e83 | ||
|
|
fa2d633596 | ||
|
|
5ed3014f7d | ||
|
|
4bd9005f9a | ||
|
|
0c3ab803ef | ||
|
|
27e6b5c0fa | ||
|
|
23328e90d4 | ||
|
|
9a805080ea | ||
|
|
25274a1df2 | ||
|
|
1c50c0c2c6 | ||
|
|
4ae4d7d78d | ||
|
|
3c9d89851d | ||
|
|
ac7eb01817 | ||
|
|
ea29986c4f | ||
|
|
f58268064e | ||
|
|
2067113177 | ||
|
|
562f415f64 | ||
|
|
0620d348b2 | ||
|
|
48b1dad959 | ||
|
|
ef1bde7565 | ||
|
|
bfe5aa8d42 | ||
|
|
52d72836f9 | ||
|
|
eb480d1de4 | ||
|
|
1ef557c972 | ||
|
|
2eee2e50dc | ||
|
|
2010844b1e | ||
|
|
406a02fa49 | ||
|
|
6e5e650b42 | ||
|
|
eba9f35673 | ||
|
|
e1a0e204b1 | ||
|
|
5e14a7574e | ||
|
|
6ff404a6d0 | ||
|
|
9902beddec | ||
|
|
e6eac3784a | ||
|
|
5784ef22f6 | ||
|
|
bc96ae6e47 | ||
|
|
15d84b3e53 | ||
|
|
0499932ba0 | ||
|
|
732cc7bee0 | ||
|
|
853a98842d | ||
|
|
d6ef467fba | ||
|
|
c75d819a92 | ||
|
|
75c07996f3 | ||
|
|
9dddd93460 | ||
|
|
f5c3b63a4a | ||
|
|
c30d6ae3aa | ||
|
|
fc2bc26f36 | ||
|
|
3a979ac2f8 | ||
|
|
71cd5be513 | ||
|
|
51dae161a7 | ||
|
|
af0124f0f1 | ||
|
|
36946313d9 | ||
|
|
df37b50051 | ||
|
|
1c704a0912 | ||
|
|
dc864762c3 | ||
|
|
dd35bc0722 | ||
|
|
ea711b032b | ||
|
|
0f8b0a7fdd | ||
|
|
7c728981f1 | ||
|
|
809da0f8e7 | ||
|
|
043ec857ab | ||
|
|
f5b17b0b48 | ||
|
|
26dca558c7 | ||
|
|
f2f4f4cce3 | ||
|
|
5ed78d1a4a | ||
|
|
6e2fb6f0ff | ||
|
|
213ab902cd | ||
|
|
b60ce3cf04 | ||
|
|
cb84e633fa | ||
|
|
07d4df18b9 | ||
|
|
d95001f406 | ||
|
|
dc863c39a9 | ||
|
|
b6155ff443 | ||
|
|
3f44a23cf2 | ||
|
|
a367294c23 | ||
|
|
b6004045bd | ||
|
|
cc7e03b0f5 | ||
|
|
1cbd423251 | ||
|
|
437244fe90 | ||
|
|
f7cf24d1f9 | ||
|
|
c3bafacf81 | ||
|
|
57ce0b3d51 | ||
|
|
408ba2e139 | ||
|
|
7632bdba88 | ||
|
|
4b830c1864 | ||
|
|
d6c8767647 | ||
|
|
ec815397a2 |
208
.github/workflows/go-version-update.yml
vendored
Normal file
208
.github/workflows/go-version-update.yml
vendored
Normal file
@@ -0,0 +1,208 @@
|
|||||||
|
name: Update Go version
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
schedule:
|
||||||
|
- cron: "0 3 * * 1" # Run weekly on Mondays at 3 AM UTC (1 = Monday)
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
update-go-version:
|
||||||
|
name: Check and update Go version
|
||||||
|
if: github.repository == 'github/codeql'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v5
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Set up Git
|
||||||
|
run: |
|
||||||
|
git config user.name "github-actions[bot]"
|
||||||
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||||
|
|
||||||
|
- name: Fetch latest Go version
|
||||||
|
id: fetch-version
|
||||||
|
run: |
|
||||||
|
LATEST_GO_VERSION=$(curl -s https://go.dev/dl/?mode=json | jq -r '.[0].version')
|
||||||
|
|
||||||
|
if [ -z "$LATEST_GO_VERSION" ] || [ "$LATEST_GO_VERSION" = "null" ]; then
|
||||||
|
echo "Error: Failed to fetch latest Go version from go.dev"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Latest Go version from go.dev: $LATEST_GO_VERSION"
|
||||||
|
echo "version=$LATEST_GO_VERSION" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
# Extract version numbers (e.g., go1.26.0 -> 1.26.0)
|
||||||
|
LATEST_VERSION_NUM=$(echo $LATEST_GO_VERSION | sed 's/^go//')
|
||||||
|
echo "version_num=$LATEST_VERSION_NUM" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
# Extract major.minor version (e.g., 1.26.0 -> 1.26)
|
||||||
|
LATEST_MAJOR_MINOR=$(echo $LATEST_VERSION_NUM | sed -E 's/^([0-9]+\.[0-9]+).*/\1/')
|
||||||
|
echo "major_minor=$LATEST_MAJOR_MINOR" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Check current Go version
|
||||||
|
id: current-version
|
||||||
|
run: |
|
||||||
|
CURRENT_VERSION=$(sed -n 's/.*go_sdk\.download(version = \"\([^\"]*\)\".*/\1/p' MODULE.bazel)
|
||||||
|
|
||||||
|
if [ -z "$CURRENT_VERSION" ]; then
|
||||||
|
echo "Error: Could not extract Go version from MODULE.bazel"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Current Go version in MODULE.bazel: $CURRENT_VERSION"
|
||||||
|
echo "version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
# Extract major.minor version
|
||||||
|
CURRENT_MAJOR_MINOR=$(echo $CURRENT_VERSION | sed -E 's/^([0-9]+\.[0-9]+).*/\1/')
|
||||||
|
echo "major_minor=$CURRENT_MAJOR_MINOR" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Compare versions
|
||||||
|
id: compare
|
||||||
|
run: |
|
||||||
|
LATEST="${{ steps.fetch-version.outputs.version_num }}"
|
||||||
|
CURRENT="${{ steps.current-version.outputs.version }}"
|
||||||
|
|
||||||
|
echo "Latest: $LATEST"
|
||||||
|
echo "Current: $CURRENT"
|
||||||
|
|
||||||
|
if [ "$LATEST" = "$CURRENT" ]; then
|
||||||
|
echo "Go version is up to date"
|
||||||
|
echo "needs_update=false" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "Go version needs update from $CURRENT to $LATEST"
|
||||||
|
echo "needs_update=true" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Update Go version in files
|
||||||
|
if: steps.compare.outputs.needs_update == 'true'
|
||||||
|
run: |
|
||||||
|
LATEST_VERSION_NUM="${{ steps.fetch-version.outputs.version_num }}"
|
||||||
|
LATEST_MAJOR_MINOR="${{ steps.fetch-version.outputs.major_minor }}"
|
||||||
|
CURRENT_VERSION="${{ steps.current-version.outputs.version }}"
|
||||||
|
CURRENT_MAJOR_MINOR="${{ steps.current-version.outputs.major_minor }}"
|
||||||
|
|
||||||
|
echo "Updating from $CURRENT_VERSION to $LATEST_VERSION_NUM"
|
||||||
|
|
||||||
|
# Escape dots in current version strings for use in sed patterns
|
||||||
|
CURRENT_VERSION_ESCAPED=$(echo "$CURRENT_VERSION" | sed 's/\./\\./g')
|
||||||
|
CURRENT_MAJOR_MINOR_ESCAPED=$(echo "$CURRENT_MAJOR_MINOR" | sed 's/\./\\./g')
|
||||||
|
|
||||||
|
# Update MODULE.bazel
|
||||||
|
sed -i "s/go_sdk\.download(version = \"$CURRENT_VERSION_ESCAPED\")/go_sdk.download(version = \"$LATEST_VERSION_NUM\")/" MODULE.bazel
|
||||||
|
if ! grep -q "go_sdk.download(version = \"$LATEST_VERSION_NUM\")" MODULE.bazel; then
|
||||||
|
echo "Error: Failed to update MODULE.bazel"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Update go/extractor/go.mod
|
||||||
|
if ! sed -i "s/^go $CURRENT_MAJOR_MINOR_ESCAPED\$/go $LATEST_MAJOR_MINOR/" go/extractor/go.mod; then
|
||||||
|
echo "Warning: Failed to update go directive in go.mod"
|
||||||
|
fi
|
||||||
|
if ! sed -i "s/^toolchain go$CURRENT_VERSION_ESCAPED\$/toolchain go$LATEST_VERSION_NUM/" go/extractor/go.mod; then
|
||||||
|
echo "Warning: Failed to update toolchain in go.mod"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Update go/extractor/autobuilder/build-environment.go
|
||||||
|
if ! sed -i "s/var maxGoVersion = util\.NewSemVer(\"$CURRENT_MAJOR_MINOR_ESCAPED\")/var maxGoVersion = util.NewSemVer(\"$LATEST_MAJOR_MINOR\")/" go/extractor/autobuilder/build-environment.go; then
|
||||||
|
echo "Warning: Failed to update build-environment.go"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Update go/actions/test/action.yml
|
||||||
|
if ! sed -i "s/default: \"~$CURRENT_VERSION_ESCAPED\"/default: \"~$LATEST_VERSION_NUM\"/" go/actions/test/action.yml; then
|
||||||
|
echo "Warning: Failed to update action.yml"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Show what changed
|
||||||
|
git diff
|
||||||
|
|
||||||
|
- name: Check for changes
|
||||||
|
id: check-changes
|
||||||
|
if: steps.compare.outputs.needs_update == 'true'
|
||||||
|
run: |
|
||||||
|
if git diff --quiet; then
|
||||||
|
echo "No changes detected"
|
||||||
|
echo "has_changes=false" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "Changes detected"
|
||||||
|
echo "has_changes=true" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Check for existing PR
|
||||||
|
if: steps.check-changes.outputs.has_changes == 'true'
|
||||||
|
id: check-pr
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
BRANCH_NAME="workflow/go-version-update"
|
||||||
|
PR_NUMBER=$(gh pr list --head "$BRANCH_NAME" --state open --json number --jq '.[0].number')
|
||||||
|
|
||||||
|
if [ -n "$PR_NUMBER" ]; then
|
||||||
|
echo "Existing PR found: #$PR_NUMBER"
|
||||||
|
echo "pr_exists=true" >> $GITHUB_OUTPUT
|
||||||
|
echo "pr_number=$PR_NUMBER" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "No existing PR found"
|
||||||
|
echo "pr_exists=false" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Commit and push changes
|
||||||
|
if: steps.check-changes.outputs.has_changes == 'true'
|
||||||
|
run: |
|
||||||
|
BRANCH_NAME="workflow/go-version-update"
|
||||||
|
LATEST_VERSION_NUM="${{ steps.fetch-version.outputs.version_num }}"
|
||||||
|
LATEST_MAJOR_MINOR="${{ steps.fetch-version.outputs.major_minor }}"
|
||||||
|
|
||||||
|
# Create or switch to branch
|
||||||
|
git checkout -B "$BRANCH_NAME"
|
||||||
|
|
||||||
|
# Stage and commit changes
|
||||||
|
git add MODULE.bazel go/extractor/go.mod go/extractor/autobuilder/build-environment.go go/actions/test/action.yml
|
||||||
|
git commit -m "Go: Update to $LATEST_VERSION_NUM"
|
||||||
|
|
||||||
|
# Push changes
|
||||||
|
git push --force-with-lease origin "$BRANCH_NAME"
|
||||||
|
|
||||||
|
- name: Create or update PR
|
||||||
|
if: steps.check-changes.outputs.has_changes == 'true'
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
BRANCH_NAME="workflow/go-version-update"
|
||||||
|
LATEST_VERSION_NUM="${{ steps.fetch-version.outputs.version_num }}"
|
||||||
|
CURRENT_VERSION="${{ steps.current-version.outputs.version }}"
|
||||||
|
|
||||||
|
PR_TITLE="Go: Update to $LATEST_VERSION_NUM"
|
||||||
|
|
||||||
|
PR_BODY=$(cat <<EOF
|
||||||
|
This PR updates Go from $CURRENT_VERSION to $LATEST_VERSION_NUM.
|
||||||
|
|
||||||
|
Updated files:
|
||||||
|
- \`MODULE.bazel\` - go_sdk.download version
|
||||||
|
- \`go/extractor/go.mod\` - go directive and toolchain
|
||||||
|
- \`go/extractor/autobuilder/build-environment.go\` - maxGoVersion (only if MAJOR.MINOR changes)
|
||||||
|
- \`go/actions/test/action.yml\` - default go-test-version
|
||||||
|
|
||||||
|
This PR was automatically created by the [Go version update workflow](https://github.com/${{ github.repository }}/blob/main/.github/workflows/go-version-update.yml).
|
||||||
|
EOF
|
||||||
|
)
|
||||||
|
|
||||||
|
if [ "${{ steps.check-pr.outputs.pr_exists }}" = "true" ]; then
|
||||||
|
echo "Updating existing PR #${{ steps.check-pr.outputs.pr_number }}"
|
||||||
|
gh pr edit "${{ steps.check-pr.outputs.pr_number }}" --title "$PR_TITLE" --body "$PR_BODY"
|
||||||
|
else
|
||||||
|
echo "Creating new PR"
|
||||||
|
gh pr create \
|
||||||
|
--title "$PR_TITLE" \
|
||||||
|
--body "$PR_BODY" \
|
||||||
|
--base main \
|
||||||
|
--head "$BRANCH_NAME" \
|
||||||
|
--label "Go"
|
||||||
|
fi
|
||||||
@@ -273,7 +273,7 @@ use_repo(
|
|||||||
)
|
)
|
||||||
|
|
||||||
go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk")
|
go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk")
|
||||||
go_sdk.download(version = "1.26.0")
|
go_sdk.download(version = "1.26.4")
|
||||||
|
|
||||||
go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
|
go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
|
||||||
go_deps.from_file(go_mod = "//go/extractor:go.mod")
|
go_deps.from_file(go_mod = "//go/extractor:go.mod")
|
||||||
|
|||||||
@@ -8,5 +8,5 @@
|
|||||||
import actions
|
import actions
|
||||||
|
|
||||||
from UsesStep uses
|
from UsesStep uses
|
||||||
where uses.getVersion().regexpMatch("^[A-Fa-f0-9]{40}$")
|
where uses.getVersion().regexpMatch("^[A-Fa-f0-9]{40}([A-Fa-f0-9]{24})?$")
|
||||||
select uses, "This 'uses' step has a pinned SHA version."
|
select uses, "This 'uses' step has a pinned SHA version."
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
## 0.4.37
|
||||||
|
|
||||||
|
### Minor Analysis Improvements
|
||||||
|
|
||||||
|
* The GitHub Actions analysis now recognizes more Bash regex checks that restrict a value to alphanumeric characters, include regexes like `^[0-9a-zA-Z]{40}([0-9a-zA-Z]{24})?$` which check for a sha1 or sha256 hash. This may reduce false positive results where command output is validated with grouped or optional alphanumeric patterns before being used.
|
||||||
|
|
||||||
## 0.4.36
|
## 0.4.36
|
||||||
|
|
||||||
### Minor Analysis Improvements
|
### Minor Analysis Improvements
|
||||||
|
|||||||
5
actions/ql/lib/change-notes/released/0.4.37.md
Normal file
5
actions/ql/lib/change-notes/released/0.4.37.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
## 0.4.37
|
||||||
|
|
||||||
|
### Minor Analysis Improvements
|
||||||
|
|
||||||
|
* The GitHub Actions analysis now recognizes more Bash regex checks that restrict a value to alphanumeric characters, include regexes like `^[0-9a-zA-Z]{40}([0-9a-zA-Z]{24})?$` which check for a sha1 or sha256 hash. This may reduce false positive results where command output is validated with grouped or optional alphanumeric patterns before being used.
|
||||||
@@ -1,2 +1,2 @@
|
|||||||
---
|
---
|
||||||
lastReleaseVersion: 0.4.36
|
lastReleaseVersion: 0.4.37
|
||||||
|
|||||||
@@ -785,7 +785,22 @@ module Bash {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds if the given regex is used to match an alphanumeric string
|
* Holds if the given regex is used to match an alphanumeric string
|
||||||
* eg: `^[0-9a-zA-Z]{40}$`, `^[0-9]+$` or `^[a-zA-Z0-9_]+$`
|
* eg: `^[0-9a-zA-Z]{40}([0-9a-zA-Z]{24})?$`, `^[0-9]+$` or `^[a-zA-Z0-9_]+$`
|
||||||
*/
|
*/
|
||||||
string alphaNumericRegex() { result = "^\\^\\[([09azAZ_-]+)\\](\\+|\\{\\d+\\})\\$$" }
|
string alphaNumericRegex() {
|
||||||
|
exists(string r1, string r2, string r3, string r4 |
|
||||||
|
// An alphanumeric character class
|
||||||
|
r1 = "\\[([09azAZ_-]+)\\]" and
|
||||||
|
// The same as above, followed by a quantifier like `+` or `{20}`
|
||||||
|
r2 = r1 + "(\\+|\\{\\d+\\})" and
|
||||||
|
// The same as above, possibly with parentheses around it
|
||||||
|
r3 = "\\(?" + r2 + "\\)?" and
|
||||||
|
// The same as above, possibly with a `?` after it
|
||||||
|
r4 = r3 + "\\??"
|
||||||
|
|
|
||||||
|
// The same as above, repeated one or more times, and with `^` at the
|
||||||
|
// beginning and `$` at the end
|
||||||
|
result = "^\\^(" + r4 + ")+\\$$"
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
name: codeql/actions-all
|
name: codeql/actions-all
|
||||||
version: 0.4.36
|
version: 0.4.38-dev
|
||||||
library: true
|
library: true
|
||||||
warnOnImplicitThis: true
|
warnOnImplicitThis: true
|
||||||
dependencies:
|
dependencies:
|
||||||
|
|||||||
@@ -1,3 +1,22 @@
|
|||||||
|
## 0.6.29
|
||||||
|
|
||||||
|
### Query Metadata Changes
|
||||||
|
|
||||||
|
* Reversed adjustment of the name of `actions/untrusted-checkout/high`, but kept the portion of the previous change for the word "trusted" to "privileged". Added a missing "a" to phrasing in `actions/untrusted-checkout/high` and `actions/untrusted-checkout/medium`.
|
||||||
|
|
||||||
|
### Major Analysis Improvements
|
||||||
|
|
||||||
|
* Adjusted `actions/untrusted-checkout/critical` to align more with other untrusted resource queries, where the alert location is the location where the artifact is obtained from (the checkout point). This aligns with the other 2 related queries. This will cause the same alerts to re-open for closed alerts of this query.
|
||||||
|
|
||||||
|
### Minor Analysis Improvements
|
||||||
|
|
||||||
|
* Altered the alert message for clarity for queries: `actions/untrusted-checkout/critical`, `actions/untrusted-checkout/high`.
|
||||||
|
* The `actions/unpinned-tag` query now recognizes 64-character SHA-256 commit hashes as properly pinned references, in addition to 40-character SHA-1 hashes.
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Adjusted (minor) help file descriptions for queries: `actions/untrusted-checkout/critical`, `actions/untrusted-checkout/high`, `actions/untrusted-checkout/medium`. Clarified wording on in minor point, added one more listed resource and added one more recommendation for things to check.
|
||||||
|
|
||||||
## 0.6.28
|
## 0.6.28
|
||||||
|
|
||||||
### Query Metadata Changes
|
### Query Metadata Changes
|
||||||
|
|||||||
@@ -15,7 +15,9 @@ import actions
|
|||||||
import codeql.actions.security.UseOfUnversionedImmutableAction
|
import codeql.actions.security.UseOfUnversionedImmutableAction
|
||||||
|
|
||||||
bindingset[version]
|
bindingset[version]
|
||||||
private predicate isPinnedCommit(string version) { version.regexpMatch("^[A-Fa-f0-9]{40}$") }
|
private predicate isPinnedCommit(string version) {
|
||||||
|
version.regexpMatch("^[A-Fa-f0-9]{40}([A-Fa-f0-9]{24})?$")
|
||||||
|
}
|
||||||
|
|
||||||
bindingset[nwo]
|
bindingset[nwo]
|
||||||
private predicate isTrustedOwner(string nwo) {
|
private predicate isTrustedOwner(string nwo) {
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ Certain triggers automatically grant a workflow elevated privileges:
|
|||||||
* An attacker forks the repository and adds malicious code (e.g., in the build script)
|
* An attacker forks the repository and adds malicious code (e.g., in the build script)
|
||||||
* The attacker opens a PR from the fork, and, if needed, comments on the PR
|
* The attacker opens a PR from the fork, and, if needed, comments on the PR
|
||||||
* The workflow in the base repository checks out the forked code
|
* The workflow in the base repository checks out the forked code
|
||||||
* The workflow runs, (e.g. the build script etc.), which contains the malicious code
|
* The workflow runs the malicious code
|
||||||
|
|
||||||
Please note that not only build scripts can be malicious code vectors. There is a large number of other possibilities. Some of them are listed in the [LOTP](https://boostsecurityio.github.io/lotp/) catalog.
|
Please note that not only build scripts can be malicious code vectors. There is a large number of other possibilities. Some of them are listed in the [LOTP](https://boostsecurityio.github.io/lotp/) catalog.
|
||||||
|
|
||||||
@@ -41,6 +41,8 @@ The best practice is to handle the potentially untrusted pull request via the **
|
|||||||
|
|
||||||
The artifacts downloaded from the first workflow should be considered untrusted and must be verified.
|
The artifacts downloaded from the first workflow should be considered untrusted and must be verified.
|
||||||
|
|
||||||
|
Additionally, ensure that least privilege are used both at the workflow level (through event triggers and workflow permissions) and job level (through job permissions).
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
### Incorrect Usage
|
### Incorrect Usage
|
||||||
@@ -163,4 +165,5 @@ jobs:
|
|||||||
|
|
||||||
- GitHub Security Lab Research: [Keeping your GitHub Actions and workflows secure Part 1: Preventing pwn requests](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/).
|
- GitHub Security Lab Research: [Keeping your GitHub Actions and workflows secure Part 1: Preventing pwn requests](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/).
|
||||||
- Mitigating risks of untrusted checkout: [GitHub Docs](https://docs.github.com/en/enterprise-cloud@latest/actions/reference/security/secure-use#mitigating-the-risks-of-untrusted-code-checkout).
|
- Mitigating risks of untrusted checkout: [GitHub Docs](https://docs.github.com/en/enterprise-cloud@latest/actions/reference/security/secure-use#mitigating-the-risks-of-untrusted-code-checkout).
|
||||||
|
- Securing with least privilege: [Workflow secure use](https://docs.github.com/en/actions/reference/security/secure-use).
|
||||||
- Living Off the Pipeline: [LOTP](https://boostsecurityio.github.io/lotp/).
|
- Living Off the Pipeline: [LOTP](https://boostsecurityio.github.io/lotp/).
|
||||||
|
|||||||
@@ -51,5 +51,6 @@ where
|
|||||||
event.getName() = checkoutTriggers() and
|
event.getName() = checkoutTriggers() and
|
||||||
not exists(ControlCheck check | check.protects(checkout, event, "untrusted-checkout")) and
|
not exists(ControlCheck check | check.protects(checkout, event, "untrusted-checkout")) and
|
||||||
not exists(ControlCheck check | check.protects(poisonable, event, "untrusted-checkout"))
|
not exists(ControlCheck check | check.protects(poisonable, event, "untrusted-checkout"))
|
||||||
select poisonable, checkout, poisonable,
|
select checkout, checkout, poisonable,
|
||||||
"Potential execution of untrusted code on a privileged workflow ($@)", event, event.getName()
|
"Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@).",
|
||||||
|
event, event.getName()
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ Certain triggers automatically grant a workflow elevated privileges:
|
|||||||
* An attacker forks the repository and adds malicious code (e.g., in the build script)
|
* An attacker forks the repository and adds malicious code (e.g., in the build script)
|
||||||
* The attacker opens a PR from the fork, and, if needed, comments on the PR
|
* The attacker opens a PR from the fork, and, if needed, comments on the PR
|
||||||
* The workflow in the base repository checks out the forked code
|
* The workflow in the base repository checks out the forked code
|
||||||
* The workflow runs, (e.g. the build script etc.), which contains the malicious code
|
* The workflow runs the malicious code
|
||||||
|
|
||||||
Please note that not only build scripts can be malicious code vectors. There is a large number of other possibilities. Some of them are listed in the [LOTP](https://boostsecurityio.github.io/lotp/) catalog.
|
Please note that not only build scripts can be malicious code vectors. There is a large number of other possibilities. Some of them are listed in the [LOTP](https://boostsecurityio.github.io/lotp/) catalog.
|
||||||
|
|
||||||
@@ -41,6 +41,8 @@ The best practice is to handle the potentially untrusted pull request via the **
|
|||||||
|
|
||||||
The artifacts downloaded from the first workflow should be considered untrusted and must be verified.
|
The artifacts downloaded from the first workflow should be considered untrusted and must be verified.
|
||||||
|
|
||||||
|
Additionally, ensure that least privilege are used both at the workflow level (through event triggers and workflow permissions) and job level (through job permissions).
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
### Incorrect Usage
|
### Incorrect Usage
|
||||||
@@ -163,4 +165,5 @@ jobs:
|
|||||||
|
|
||||||
- GitHub Security Lab Research: [Keeping your GitHub Actions and workflows secure Part 1: Preventing pwn requests](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/).
|
- GitHub Security Lab Research: [Keeping your GitHub Actions and workflows secure Part 1: Preventing pwn requests](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/).
|
||||||
- Mitigating risks of untrusted checkout: [GitHub Docs](https://docs.github.com/en/enterprise-cloud@latest/actions/reference/security/secure-use#mitigating-the-risks-of-untrusted-code-checkout).
|
- Mitigating risks of untrusted checkout: [GitHub Docs](https://docs.github.com/en/enterprise-cloud@latest/actions/reference/security/secure-use#mitigating-the-risks-of-untrusted-code-checkout).
|
||||||
|
- Securing with least privilege: [Workflow secure use](https://docs.github.com/en/actions/reference/security/secure-use).
|
||||||
- Living Off the Pipeline: [LOTP](https://boostsecurityio.github.io/lotp/).
|
- Living Off the Pipeline: [LOTP](https://boostsecurityio.github.io/lotp/).
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @name Checkout of untrusted code in privileged context without privileged context use
|
* @name Checkout of untrusted code in a privileged context
|
||||||
* @description Privileged workflows have read/write access to the base repository and access to secrets.
|
* @description Privileged workflows have read/write access to the base repository and access to secrets.
|
||||||
* By explicitly checking out and running the build script from a fork the untrusted code is running in an environment
|
* By explicitly checking out and running the build script from a fork the untrusted code is running in an environment
|
||||||
* that is able to push to the base repository and to access secrets.
|
* that is able to push to the base repository and to access secrets.
|
||||||
@@ -42,5 +42,6 @@ where
|
|||||||
not event.getName() = "issue_comment" and
|
not event.getName() = "issue_comment" and
|
||||||
not exists(ControlCheck check | check.protects(checkout, event, "untrusted-checkout"))
|
not exists(ControlCheck check | check.protects(checkout, event, "untrusted-checkout"))
|
||||||
)
|
)
|
||||||
select checkout, "Potential execution of untrusted code on a privileged workflow ($@)", event,
|
select checkout,
|
||||||
event.getName()
|
"Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@).",
|
||||||
|
event, event.getName()
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ Certain triggers automatically grant a workflow elevated privileges:
|
|||||||
* An attacker forks the repository and adds malicious code (e.g., in the build script)
|
* An attacker forks the repository and adds malicious code (e.g., in the build script)
|
||||||
* The attacker opens a PR from the fork, and, if needed, comments on the PR
|
* The attacker opens a PR from the fork, and, if needed, comments on the PR
|
||||||
* The workflow in the base repository checks out the forked code
|
* The workflow in the base repository checks out the forked code
|
||||||
* The workflow runs, (e.g. the build script etc.), which contains the malicious code
|
* The workflow runs the malicious code
|
||||||
|
|
||||||
Please note that not only build scripts can be malicious code vectors. There is a large number of other possibilities. Some of them are listed in the [LOTP](https://boostsecurityio.github.io/lotp/) catalog.
|
Please note that not only build scripts can be malicious code vectors. There is a large number of other possibilities. Some of them are listed in the [LOTP](https://boostsecurityio.github.io/lotp/) catalog.
|
||||||
|
|
||||||
@@ -41,6 +41,8 @@ The best practice is to handle the potentially untrusted pull request via the **
|
|||||||
|
|
||||||
The artifacts downloaded from the first workflow should be considered untrusted and must be verified.
|
The artifacts downloaded from the first workflow should be considered untrusted and must be verified.
|
||||||
|
|
||||||
|
Additionally, ensure that least privilege are used both at the workflow level (through event triggers and workflow permissions) and job level (through job permissions).
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
### Incorrect Usage
|
### Incorrect Usage
|
||||||
@@ -163,4 +165,5 @@ jobs:
|
|||||||
|
|
||||||
- GitHub Security Lab Research: [Keeping your GitHub Actions and workflows secure Part 1: Preventing pwn requests](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/).
|
- GitHub Security Lab Research: [Keeping your GitHub Actions and workflows secure Part 1: Preventing pwn requests](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/).
|
||||||
- Mitigating risks of untrusted checkout: [GitHub Docs](https://docs.github.com/en/enterprise-cloud@latest/actions/reference/security/secure-use#mitigating-the-risks-of-untrusted-code-checkout).
|
- Mitigating risks of untrusted checkout: [GitHub Docs](https://docs.github.com/en/enterprise-cloud@latest/actions/reference/security/secure-use#mitigating-the-risks-of-untrusted-code-checkout).
|
||||||
|
- Securing with least privilege: [Workflow secure use](https://docs.github.com/en/actions/reference/security/secure-use).
|
||||||
- Living Off the Pipeline: [LOTP](https://boostsecurityio.github.io/lotp/).
|
- Living Off the Pipeline: [LOTP](https://boostsecurityio.github.io/lotp/).
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @name Checkout of untrusted code in trusted context
|
* @name Checkout of untrusted code in a trusted context
|
||||||
* @description Privileged workflows have read/write access to the base repository and access to secrets.
|
* @description Privileged workflows have read/write access to the base repository and access to secrets.
|
||||||
* By explicitly checking out and running the build script from a fork the untrusted code is running in an environment
|
* By explicitly checking out and running the build script from a fork the untrusted code is running in an environment
|
||||||
* that is able to push to the base repository and to access secrets.
|
* that is able to push to the base repository and to access secrets.
|
||||||
|
|||||||
18
actions/ql/src/change-notes/released/0.6.29.md
Normal file
18
actions/ql/src/change-notes/released/0.6.29.md
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
## 0.6.29
|
||||||
|
|
||||||
|
### Query Metadata Changes
|
||||||
|
|
||||||
|
* Reversed adjustment of the name of `actions/untrusted-checkout/high`, but kept the portion of the previous change for the word "trusted" to "privileged". Added a missing "a" to phrasing in `actions/untrusted-checkout/high` and `actions/untrusted-checkout/medium`.
|
||||||
|
|
||||||
|
### Major Analysis Improvements
|
||||||
|
|
||||||
|
* Adjusted `actions/untrusted-checkout/critical` to align more with other untrusted resource queries, where the alert location is the location where the artifact is obtained from (the checkout point). This aligns with the other 2 related queries. This will cause the same alerts to re-open for closed alerts of this query.
|
||||||
|
|
||||||
|
### Minor Analysis Improvements
|
||||||
|
|
||||||
|
* Altered the alert message for clarity for queries: `actions/untrusted-checkout/critical`, `actions/untrusted-checkout/high`.
|
||||||
|
* The `actions/unpinned-tag` query now recognizes 64-character SHA-256 commit hashes as properly pinned references, in addition to 40-character SHA-1 hashes.
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Adjusted (minor) help file descriptions for queries: `actions/untrusted-checkout/critical`, `actions/untrusted-checkout/high`, `actions/untrusted-checkout/medium`. Clarified wording on in minor point, added one more listed resource and added one more recommendation for things to check.
|
||||||
@@ -1,2 +1,2 @@
|
|||||||
---
|
---
|
||||||
lastReleaseVersion: 0.6.28
|
lastReleaseVersion: 0.6.29
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
name: codeql/actions-queries
|
name: codeql/actions-queries
|
||||||
version: 0.6.28
|
version: 0.6.30-dev
|
||||||
library: false
|
library: false
|
||||||
warnOnImplicitThis: true
|
warnOnImplicitThis: true
|
||||||
groups: [actions, queries]
|
groups: [actions, queries]
|
||||||
|
|||||||
@@ -11,3 +11,9 @@ jobs:
|
|||||||
- uses: foo/bar@25b062c917b0c75f8b47d8469aff6c94ffd89abb
|
- uses: foo/bar@25b062c917b0c75f8b47d8469aff6c94ffd89abb
|
||||||
- uses: docker://foo/bar@latest
|
- uses: docker://foo/bar@latest
|
||||||
- uses: docker://foo/bar@sha256:887a259a5a534f3c4f36cb02dca341673c6089431057242cdc931e9f133147e9
|
- uses: docker://foo/bar@sha256:887a259a5a534f3c4f36cb02dca341673c6089431057242cdc931e9f133147e9
|
||||||
|
# SHA-256 pinned (64 hex chars) - should NOT be flagged
|
||||||
|
- uses: foo/bar@25b062c917b0c75f8b47d8469aff6c94ffd89abb25b062c917b0c75f8b47d84d
|
||||||
|
# SHA-1 pinned (40 hex chars) regression - should NOT be flagged
|
||||||
|
- uses: foo/bar@a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2
|
||||||
|
# Invalid 50-char hex string - should be flagged
|
||||||
|
- uses: foo/bar@a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2a1b2c3d4e5
|
||||||
|
|||||||
@@ -34,3 +34,4 @@
|
|||||||
| .github/workflows/test18.yml:37:21:37:63 | sonarsource/sonarcloud-github-action@master | Unpinned 3rd party Action 'Sonar' step $@ uses 'sonarsource/sonarcloud-github-action' with ref 'master', not a pinned commit hash | .github/workflows/test18.yml:36:15:40:58 | Uses Step | Uses Step |
|
| .github/workflows/test18.yml:37:21:37:63 | sonarsource/sonarcloud-github-action@master | Unpinned 3rd party Action 'Sonar' step $@ uses 'sonarsource/sonarcloud-github-action' with ref 'master', not a pinned commit hash | .github/workflows/test18.yml:36:15:40:58 | Uses Step | Uses Step |
|
||||||
| .github/workflows/unpinned_tags.yml:10:13:10:22 | foo/bar@v1 | Unpinned 3rd party Action 'unpinned_tags.yml' step $@ uses 'foo/bar' with ref 'v1', not a pinned commit hash | .github/workflows/unpinned_tags.yml:10:7:11:4 | Uses Step | Uses Step |
|
| .github/workflows/unpinned_tags.yml:10:13:10:22 | foo/bar@v1 | Unpinned 3rd party Action 'unpinned_tags.yml' step $@ uses 'foo/bar' with ref 'v1', not a pinned commit hash | .github/workflows/unpinned_tags.yml:10:7:11:4 | Uses Step | Uses Step |
|
||||||
| .github/workflows/unpinned_tags.yml:12:13:12:35 | docker://foo/bar@latest | Unpinned 3rd party Action 'unpinned_tags.yml' step $@ uses 'docker://foo/bar' with ref 'latest', not a pinned commit hash | .github/workflows/unpinned_tags.yml:12:7:13:4 | Uses Step | Uses Step |
|
| .github/workflows/unpinned_tags.yml:12:13:12:35 | docker://foo/bar@latest | Unpinned 3rd party Action 'unpinned_tags.yml' step $@ uses 'docker://foo/bar' with ref 'latest', not a pinned commit hash | .github/workflows/unpinned_tags.yml:12:7:13:4 | Uses Step | Uses Step |
|
||||||
|
| .github/workflows/unpinned_tags.yml:19:13:19:70 | foo/bar@a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2a1b2c3d4e5 | Unpinned 3rd party Action 'unpinned_tags.yml' step $@ uses 'foo/bar' with ref 'a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2a1b2c3d4e5', not a pinned commit hash | .github/workflows/unpinned_tags.yml:19:7:19:71 | Uses Step | Uses Step |
|
||||||
|
|||||||
@@ -312,7 +312,10 @@ edges
|
|||||||
| .github/workflows/unpinned_tags.yml:9:7:10:4 | Uses Step | .github/workflows/unpinned_tags.yml:10:7:11:4 | Uses Step |
|
| .github/workflows/unpinned_tags.yml:9:7:10:4 | Uses Step | .github/workflows/unpinned_tags.yml:10:7:11:4 | Uses Step |
|
||||||
| .github/workflows/unpinned_tags.yml:10:7:11:4 | Uses Step | .github/workflows/unpinned_tags.yml:11:7:12:4 | Uses Step |
|
| .github/workflows/unpinned_tags.yml:10:7:11:4 | Uses Step | .github/workflows/unpinned_tags.yml:11:7:12:4 | Uses Step |
|
||||||
| .github/workflows/unpinned_tags.yml:11:7:12:4 | Uses Step | .github/workflows/unpinned_tags.yml:12:7:13:4 | Uses Step |
|
| .github/workflows/unpinned_tags.yml:11:7:12:4 | Uses Step | .github/workflows/unpinned_tags.yml:12:7:13:4 | Uses Step |
|
||||||
| .github/workflows/unpinned_tags.yml:12:7:13:4 | Uses Step | .github/workflows/unpinned_tags.yml:13:7:13:101 | Uses Step |
|
| .github/workflows/unpinned_tags.yml:12:7:13:4 | Uses Step | .github/workflows/unpinned_tags.yml:13:7:15:4 | Uses Step |
|
||||||
|
| .github/workflows/unpinned_tags.yml:13:7:15:4 | Uses Step | .github/workflows/unpinned_tags.yml:15:7:17:4 | Uses Step |
|
||||||
|
| .github/workflows/unpinned_tags.yml:15:7:17:4 | Uses Step | .github/workflows/unpinned_tags.yml:17:7:19:4 | Uses Step |
|
||||||
|
| .github/workflows/unpinned_tags.yml:17:7:19:4 | Uses Step | .github/workflows/unpinned_tags.yml:19:7:19:71 | Uses Step |
|
||||||
| .github/workflows/untrusted_checkout2.yml:7:9:14:6 | Run Step: pr_number | .github/workflows/untrusted_checkout2.yml:14:9:19:72 | Run Step |
|
| .github/workflows/untrusted_checkout2.yml:7:9:14:6 | Run Step: pr_number | .github/workflows/untrusted_checkout2.yml:14:9:19:72 | Run Step |
|
||||||
| .github/workflows/untrusted_checkout3.yml:11:9:12:6 | Uses Step | .github/workflows/untrusted_checkout3.yml:12:9:13:6 | Uses Step |
|
| .github/workflows/untrusted_checkout3.yml:11:9:12:6 | Uses Step | .github/workflows/untrusted_checkout3.yml:12:9:13:6 | Uses Step |
|
||||||
| .github/workflows/untrusted_checkout3.yml:12:9:13:6 | Uses Step | .github/actions/dangerous-git-checkout/action.yml:6:7:11:4 | Uses Step |
|
| .github/workflows/untrusted_checkout3.yml:12:9:13:6 | Uses Step | .github/actions/dangerous-git-checkout/action.yml:6:7:11:4 | Uses Step |
|
||||||
@@ -335,42 +338,42 @@ edges
|
|||||||
| .github/workflows/workflow_run_untrusted_checkout_2.yml:13:9:16:6 | Uses Step | .github/workflows/workflow_run_untrusted_checkout_2.yml:16:9:18:31 | Uses Step |
|
| .github/workflows/workflow_run_untrusted_checkout_2.yml:13:9:16:6 | Uses Step | .github/workflows/workflow_run_untrusted_checkout_2.yml:16:9:18:31 | Uses Step |
|
||||||
| .github/workflows/workflow_run_untrusted_checkout_3.yml:13:9:16:6 | Uses Step | .github/workflows/workflow_run_untrusted_checkout_3.yml:16:9:18:31 | Uses Step |
|
| .github/workflows/workflow_run_untrusted_checkout_3.yml:13:9:16:6 | Uses Step | .github/workflows/workflow_run_untrusted_checkout_3.yml:16:9:18:31 | Uses Step |
|
||||||
#select
|
#select
|
||||||
| .github/workflows/auto_ci.yml:32:9:37:6 | Run Step | .github/workflows/auto_ci.yml:20:9:27:6 | Uses Step | .github/workflows/auto_ci.yml:32:9:37:6 | Run Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/auto_ci.yml:6:3:6:21 | pull_request_target | pull_request_target |
|
| .github/actions/dangerous-git-checkout/action.yml:6:7:11:4 | Uses Step | .github/actions/dangerous-git-checkout/action.yml:6:7:11:4 | Uses Step | .github/workflows/untrusted_checkout3.yml:13:9:13:23 | Run Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/untrusted_checkout3.yml:4:3:4:14 | workflow_run | workflow_run |
|
||||||
| .github/workflows/auto_ci.yml:48:9:52:2 | Run Step | .github/workflows/auto_ci.yml:20:9:27:6 | Uses Step | .github/workflows/auto_ci.yml:48:9:52:2 | Run Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/auto_ci.yml:6:3:6:21 | pull_request_target | pull_request_target |
|
| .github/workflows/auto_ci.yml:20:9:27:6 | Uses Step | .github/workflows/auto_ci.yml:20:9:27:6 | Uses Step | .github/workflows/auto_ci.yml:32:9:37:6 | Run Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/auto_ci.yml:6:3:6:21 | pull_request_target | pull_request_target |
|
||||||
| .github/workflows/auto_ci.yml:79:9:84:6 | Run Step | .github/workflows/auto_ci.yml:67:9:74:6 | Uses Step | .github/workflows/auto_ci.yml:79:9:84:6 | Run Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/auto_ci.yml:6:3:6:21 | pull_request_target | pull_request_target |
|
| .github/workflows/auto_ci.yml:20:9:27:6 | Uses Step | .github/workflows/auto_ci.yml:20:9:27:6 | Uses Step | .github/workflows/auto_ci.yml:48:9:52:2 | Run Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/auto_ci.yml:6:3:6:21 | pull_request_target | pull_request_target |
|
||||||
| .github/workflows/auto_ci.yml:84:9:93:6 | Run Step | .github/workflows/auto_ci.yml:67:9:74:6 | Uses Step | .github/workflows/auto_ci.yml:84:9:93:6 | Run Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/auto_ci.yml:6:3:6:21 | pull_request_target | pull_request_target |
|
| .github/workflows/auto_ci.yml:67:9:74:6 | Uses Step | .github/workflows/auto_ci.yml:67:9:74:6 | Uses Step | .github/workflows/auto_ci.yml:79:9:84:6 | Run Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/auto_ci.yml:6:3:6:21 | pull_request_target | pull_request_target |
|
||||||
| .github/workflows/dependabot3.yml:25:9:48:6 | Run Step: set-milestone | .github/workflows/dependabot3.yml:15:9:20:6 | Uses Step | .github/workflows/dependabot3.yml:25:9:48:6 | Run Step: set-milestone | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/dependabot3.yml:3:5:3:23 | pull_request_target | pull_request_target |
|
| .github/workflows/auto_ci.yml:67:9:74:6 | Uses Step | .github/workflows/auto_ci.yml:67:9:74:6 | Uses Step | .github/workflows/auto_ci.yml:84:9:93:6 | Run Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/auto_ci.yml:6:3:6:21 | pull_request_target | pull_request_target |
|
||||||
| .github/workflows/external/TestOrg/TestRepo/.github/workflows/reusable.yml:26:9:29:7 | Run Step | .github/workflows/external/TestOrg/TestRepo/.github/workflows/reusable.yml:23:9:26:6 | Uses Step | .github/workflows/external/TestOrg/TestRepo/.github/workflows/reusable.yml:26:9:29:7 | Run Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/reusable_caller1.yaml:4:3:4:21 | pull_request_target | pull_request_target |
|
| .github/workflows/dependabot3.yml:15:9:20:6 | Uses Step | .github/workflows/dependabot3.yml:15:9:20:6 | Uses Step | .github/workflows/dependabot3.yml:25:9:48:6 | Run Step: set-milestone | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/dependabot3.yml:3:5:3:23 | pull_request_target | pull_request_target |
|
||||||
| .github/workflows/gitcheckout.yml:21:11:23:22 | Run Step | .github/workflows/gitcheckout.yml:10:11:18:8 | Run Step | .github/workflows/gitcheckout.yml:21:11:23:22 | Run Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/gitcheckout.yml:2:3:2:21 | pull_request_target | pull_request_target |
|
| .github/workflows/external/TestOrg/TestRepo/.github/workflows/reusable.yml:23:9:26:6 | Uses Step | .github/workflows/external/TestOrg/TestRepo/.github/workflows/reusable.yml:23:9:26:6 | Uses Step | .github/workflows/external/TestOrg/TestRepo/.github/workflows/reusable.yml:26:9:29:7 | Run Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/reusable_caller1.yaml:4:3:4:21 | pull_request_target | pull_request_target |
|
||||||
| .github/workflows/label_trusted_checkout2.yml:17:7:21:4 | Run Step | .github/workflows/label_trusted_checkout2.yml:12:7:16:4 | Uses Step | .github/workflows/label_trusted_checkout2.yml:17:7:21:4 | Run Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/label_trusted_checkout2.yml:2:3:2:21 | pull_request_target | pull_request_target |
|
| .github/workflows/gitcheckout.yml:10:11:18:8 | Run Step | .github/workflows/gitcheckout.yml:10:11:18:8 | Run Step | .github/workflows/gitcheckout.yml:21:11:23:22 | Run Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/gitcheckout.yml:2:3:2:21 | pull_request_target | pull_request_target |
|
||||||
| .github/workflows/level0.yml:107:9:112:2 | Run Step | .github/workflows/level0.yml:99:9:103:6 | Uses Step | .github/workflows/level0.yml:107:9:112:2 | Run Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/level0.yml:5:3:5:15 | issue_comment | issue_comment |
|
| .github/workflows/label_trusted_checkout2.yml:12:7:16:4 | Uses Step | .github/workflows/label_trusted_checkout2.yml:12:7:16:4 | Uses Step | .github/workflows/label_trusted_checkout2.yml:17:7:21:4 | Run Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/label_trusted_checkout2.yml:2:3:2:21 | pull_request_target | pull_request_target |
|
||||||
| .github/workflows/level0.yml:107:9:112:2 | Run Step | .github/workflows/level0.yml:99:9:103:6 | Uses Step | .github/workflows/level0.yml:107:9:112:2 | Run Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/level0.yml:7:3:7:21 | pull_request_target | pull_request_target |
|
| .github/workflows/level0.yml:99:9:103:6 | Uses Step | .github/workflows/level0.yml:99:9:103:6 | Uses Step | .github/workflows/level0.yml:107:9:112:2 | Run Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/level0.yml:5:3:5:15 | issue_comment | issue_comment |
|
||||||
| .github/workflows/level0.yml:133:9:135:23 | Run Step | .github/workflows/level0.yml:125:9:129:6 | Uses Step | .github/workflows/level0.yml:133:9:135:23 | Run Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/level0.yml:5:3:5:15 | issue_comment | issue_comment |
|
| .github/workflows/level0.yml:99:9:103:6 | Uses Step | .github/workflows/level0.yml:99:9:103:6 | Uses Step | .github/workflows/level0.yml:107:9:112:2 | Run Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/level0.yml:7:3:7:21 | pull_request_target | pull_request_target |
|
||||||
| .github/workflows/level0.yml:133:9:135:23 | Run Step | .github/workflows/level0.yml:125:9:129:6 | Uses Step | .github/workflows/level0.yml:133:9:135:23 | Run Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/level0.yml:7:3:7:21 | pull_request_target | pull_request_target |
|
| .github/workflows/level0.yml:125:9:129:6 | Uses Step | .github/workflows/level0.yml:125:9:129:6 | Uses Step | .github/workflows/level0.yml:133:9:135:23 | Run Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/level0.yml:5:3:5:15 | issue_comment | issue_comment |
|
||||||
| .github/workflows/poc2.yml:42:9:47:6 | Uses Step | .github/workflows/poc2.yml:37:9:42:6 | Uses Step | .github/workflows/poc2.yml:42:9:47:6 | Uses Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/poc2.yml:4:3:4:15 | issue_comment | issue_comment |
|
| .github/workflows/level0.yml:125:9:129:6 | Uses Step | .github/workflows/level0.yml:125:9:129:6 | Uses Step | .github/workflows/level0.yml:133:9:135:23 | Run Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/level0.yml:7:3:7:21 | pull_request_target | pull_request_target |
|
||||||
| .github/workflows/poc2.yml:52:9:58:24 | Run Step | .github/workflows/poc2.yml:37:9:42:6 | Uses Step | .github/workflows/poc2.yml:52:9:58:24 | Run Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/poc2.yml:4:3:4:15 | issue_comment | issue_comment |
|
| .github/workflows/poc2.yml:37:9:42:6 | Uses Step | .github/workflows/poc2.yml:37:9:42:6 | Uses Step | .github/workflows/poc2.yml:42:9:47:6 | Uses Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/poc2.yml:4:3:4:15 | issue_comment | issue_comment |
|
||||||
| .github/workflows/pr-workflow.yml:222:9:227:6 | Uses Step | .github/workflows/pr-workflow.yml:216:9:222:6 | Uses Step | .github/workflows/pr-workflow.yml:222:9:227:6 | Uses Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/pr-workflow-fork.yaml:7:3:7:21 | pull_request_target | pull_request_target |
|
| .github/workflows/poc2.yml:37:9:42:6 | Uses Step | .github/workflows/poc2.yml:37:9:42:6 | Uses Step | .github/workflows/poc2.yml:52:9:58:24 | Run Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/poc2.yml:4:3:4:15 | issue_comment | issue_comment |
|
||||||
| .github/workflows/pr-workflow.yml:256:9:261:6 | Uses Step | .github/workflows/pr-workflow.yml:250:9:256:6 | Uses Step | .github/workflows/pr-workflow.yml:256:9:261:6 | Uses Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/pr-workflow-fork.yaml:7:3:7:21 | pull_request_target | pull_request_target |
|
| .github/workflows/pr-workflow.yml:216:9:222:6 | Uses Step | .github/workflows/pr-workflow.yml:216:9:222:6 | Uses Step | .github/workflows/pr-workflow.yml:222:9:227:6 | Uses Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/pr-workflow-fork.yaml:7:3:7:21 | pull_request_target | pull_request_target |
|
||||||
| .github/workflows/pr-workflow.yml:290:9:295:6 | Uses Step | .github/workflows/pr-workflow.yml:284:9:290:6 | Uses Step | .github/workflows/pr-workflow.yml:290:9:295:6 | Uses Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/pr-workflow-fork.yaml:7:3:7:21 | pull_request_target | pull_request_target |
|
| .github/workflows/pr-workflow.yml:250:9:256:6 | Uses Step | .github/workflows/pr-workflow.yml:250:9:256:6 | Uses Step | .github/workflows/pr-workflow.yml:256:9:261:6 | Uses Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/pr-workflow-fork.yaml:7:3:7:21 | pull_request_target | pull_request_target |
|
||||||
| .github/workflows/pr-workflow.yml:391:9:395:6 | Uses Step | .github/workflows/pr-workflow.yml:386:9:391:6 | Uses Step | .github/workflows/pr-workflow.yml:391:9:395:6 | Uses Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/pr-workflow-fork.yaml:7:3:7:21 | pull_request_target | pull_request_target |
|
| .github/workflows/pr-workflow.yml:284:9:290:6 | Uses Step | .github/workflows/pr-workflow.yml:284:9:290:6 | Uses Step | .github/workflows/pr-workflow.yml:290:9:295:6 | Uses Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/pr-workflow-fork.yaml:7:3:7:21 | pull_request_target | pull_request_target |
|
||||||
| .github/workflows/pr-workflow.yml:395:9:404:6 | Uses Step | .github/workflows/pr-workflow.yml:386:9:391:6 | Uses Step | .github/workflows/pr-workflow.yml:395:9:404:6 | Uses Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/pr-workflow-fork.yaml:7:3:7:21 | pull_request_target | pull_request_target |
|
| .github/workflows/pr-workflow.yml:386:9:391:6 | Uses Step | .github/workflows/pr-workflow.yml:386:9:391:6 | Uses Step | .github/workflows/pr-workflow.yml:391:9:395:6 | Uses Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/pr-workflow-fork.yaml:7:3:7:21 | pull_request_target | pull_request_target |
|
||||||
| .github/workflows/pr-workflow.yml:404:9:414:6 | Uses Step | .github/workflows/pr-workflow.yml:386:9:391:6 | Uses Step | .github/workflows/pr-workflow.yml:404:9:414:6 | Uses Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/pr-workflow-fork.yaml:7:3:7:21 | pull_request_target | pull_request_target |
|
| .github/workflows/pr-workflow.yml:386:9:391:6 | Uses Step | .github/workflows/pr-workflow.yml:386:9:391:6 | Uses Step | .github/workflows/pr-workflow.yml:395:9:404:6 | Uses Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/pr-workflow-fork.yaml:7:3:7:21 | pull_request_target | pull_request_target |
|
||||||
| .github/workflows/pr-workflow.yml:414:9:423:6 | Uses Step | .github/workflows/pr-workflow.yml:386:9:391:6 | Uses Step | .github/workflows/pr-workflow.yml:414:9:423:6 | Uses Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/pr-workflow-fork.yaml:7:3:7:21 | pull_request_target | pull_request_target |
|
| .github/workflows/pr-workflow.yml:386:9:391:6 | Uses Step | .github/workflows/pr-workflow.yml:386:9:391:6 | Uses Step | .github/workflows/pr-workflow.yml:404:9:414:6 | Uses Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/pr-workflow-fork.yaml:7:3:7:21 | pull_request_target | pull_request_target |
|
||||||
| .github/workflows/pr-workflow.yml:423:9:432:2 | Uses Step | .github/workflows/pr-workflow.yml:386:9:391:6 | Uses Step | .github/workflows/pr-workflow.yml:423:9:432:2 | Uses Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/pr-workflow-fork.yaml:7:3:7:21 | pull_request_target | pull_request_target |
|
| .github/workflows/pr-workflow.yml:386:9:391:6 | Uses Step | .github/workflows/pr-workflow.yml:386:9:391:6 | Uses Step | .github/workflows/pr-workflow.yml:414:9:423:6 | Uses Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/pr-workflow-fork.yaml:7:3:7:21 | pull_request_target | pull_request_target |
|
||||||
| .github/workflows/reusable_local.yml:26:9:29:7 | Run Step | .github/workflows/reusable_local.yml:23:9:26:6 | Uses Step | .github/workflows/reusable_local.yml:26:9:29:7 | Run Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/reusable_caller3.yaml:4:3:4:21 | pull_request_target | pull_request_target |
|
| .github/workflows/pr-workflow.yml:386:9:391:6 | Uses Step | .github/workflows/pr-workflow.yml:386:9:391:6 | Uses Step | .github/workflows/pr-workflow.yml:423:9:432:2 | Uses Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/pr-workflow-fork.yaml:7:3:7:21 | pull_request_target | pull_request_target |
|
||||||
| .github/workflows/test7.yml:33:9:36:6 | Run Step | .github/workflows/test7.yml:19:9:24:6 | Uses Step | .github/workflows/test7.yml:33:9:36:6 | Run Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/test7.yml:4:3:4:15 | issue_comment | issue_comment |
|
| .github/workflows/reusable_local.yml:23:9:26:6 | Uses Step | .github/workflows/reusable_local.yml:23:9:26:6 | Uses Step | .github/workflows/reusable_local.yml:26:9:29:7 | Run Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/reusable_caller3.yaml:4:3:4:21 | pull_request_target | pull_request_target |
|
||||||
| .github/workflows/test7.yml:36:9:39:6 | Run Step | .github/workflows/test7.yml:19:9:24:6 | Uses Step | .github/workflows/test7.yml:36:9:39:6 | Run Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/test7.yml:4:3:4:15 | issue_comment | issue_comment |
|
| .github/workflows/test7.yml:19:9:24:6 | Uses Step | .github/workflows/test7.yml:19:9:24:6 | Uses Step | .github/workflows/test7.yml:33:9:36:6 | Run Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/test7.yml:4:3:4:15 | issue_comment | issue_comment |
|
||||||
| .github/workflows/test7.yml:49:9:59:6 | Run Step: benchmark-pr | .github/workflows/test7.yml:19:9:24:6 | Uses Step | .github/workflows/test7.yml:49:9:59:6 | Run Step: benchmark-pr | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/test7.yml:4:3:4:15 | issue_comment | issue_comment |
|
| .github/workflows/test7.yml:19:9:24:6 | Uses Step | .github/workflows/test7.yml:19:9:24:6 | Uses Step | .github/workflows/test7.yml:36:9:39:6 | Run Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/test7.yml:4:3:4:15 | issue_comment | issue_comment |
|
||||||
| .github/workflows/test7.yml:59:9:60:6 | Run Step | .github/workflows/test7.yml:19:9:24:6 | Uses Step | .github/workflows/test7.yml:59:9:60:6 | Run Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/test7.yml:4:3:4:15 | issue_comment | issue_comment |
|
| .github/workflows/test7.yml:19:9:24:6 | Uses Step | .github/workflows/test7.yml:19:9:24:6 | Uses Step | .github/workflows/test7.yml:49:9:59:6 | Run Step: benchmark-pr | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/test7.yml:4:3:4:15 | issue_comment | issue_comment |
|
||||||
| .github/workflows/test7.yml:60:9:60:37 | Run Step | .github/workflows/test7.yml:19:9:24:6 | Uses Step | .github/workflows/test7.yml:60:9:60:37 | Run Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/test7.yml:4:3:4:15 | issue_comment | issue_comment |
|
| .github/workflows/test7.yml:19:9:24:6 | Uses Step | .github/workflows/test7.yml:19:9:24:6 | Uses Step | .github/workflows/test7.yml:59:9:60:6 | Run Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/test7.yml:4:3:4:15 | issue_comment | issue_comment |
|
||||||
| .github/workflows/test10.yml:25:9:30:2 | Run Step | .github/workflows/test10.yml:20:9:25:6 | Uses Step | .github/workflows/test10.yml:25:9:30:2 | Run Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/test10.yml:8:3:8:21 | pull_request_target | pull_request_target |
|
| .github/workflows/test7.yml:19:9:24:6 | Uses Step | .github/workflows/test7.yml:19:9:24:6 | Uses Step | .github/workflows/test7.yml:60:9:60:37 | Run Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/test7.yml:4:3:4:15 | issue_comment | issue_comment |
|
||||||
| .github/workflows/test11.yml:90:7:93:54 | Uses Step | .github/workflows/test11.yml:84:7:90:4 | Uses Step | .github/workflows/test11.yml:90:7:93:54 | Uses Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/test11.yml:5:3:5:15 | issue_comment | issue_comment |
|
| .github/workflows/test10.yml:20:9:25:6 | Uses Step | .github/workflows/test10.yml:20:9:25:6 | Uses Step | .github/workflows/test10.yml:25:9:30:2 | Run Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/test10.yml:8:3:8:21 | pull_request_target | pull_request_target |
|
||||||
| .github/workflows/test17.yml:19:15:23:58 | Uses Step | .github/workflows/test17.yml:12:15:19:12 | Uses Step | .github/workflows/test17.yml:19:15:23:58 | Uses Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/test17.yml:3:5:3:16 | workflow_run | workflow_run |
|
| .github/workflows/test11.yml:84:7:90:4 | Uses Step | .github/workflows/test11.yml:84:7:90:4 | Uses Step | .github/workflows/test11.yml:90:7:93:54 | Uses Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/test11.yml:5:3:5:15 | issue_comment | issue_comment |
|
||||||
| .github/workflows/test27.yml:21:9:22:16 | Run Step | .github/workflows/test27.yml:18:9:21:6 | Uses Step | .github/workflows/test27.yml:21:9:22:16 | Run Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/test26.yml:4:3:4:14 | workflow_run | workflow_run |
|
| .github/workflows/test17.yml:12:15:19:12 | Uses Step | .github/workflows/test17.yml:12:15:19:12 | Uses Step | .github/workflows/test17.yml:19:15:23:58 | Uses Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/test17.yml:3:5:3:16 | workflow_run | workflow_run |
|
||||||
| .github/workflows/test29.yml:14:7:21:11 | Uses Step | .github/workflows/test29.yml:8:7:14:4 | Uses Step | .github/workflows/test29.yml:14:7:21:11 | Uses Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/test29.yml:1:5:1:23 | pull_request_target | pull_request_target |
|
| .github/workflows/test27.yml:18:9:21:6 | Uses Step | .github/workflows/test27.yml:18:9:21:6 | Uses Step | .github/workflows/test27.yml:21:9:22:16 | Run Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/test26.yml:4:3:4:14 | workflow_run | workflow_run |
|
||||||
| .github/workflows/untrusted_checkout3.yml:13:9:13:23 | Run Step | .github/actions/dangerous-git-checkout/action.yml:6:7:11:4 | Uses Step | .github/workflows/untrusted_checkout3.yml:13:9:13:23 | Run Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/untrusted_checkout3.yml:4:3:4:14 | workflow_run | workflow_run |
|
| .github/workflows/test29.yml:8:7:14:4 | Uses Step | .github/workflows/test29.yml:8:7:14:4 | Uses Step | .github/workflows/test29.yml:14:7:21:11 | Uses Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/test29.yml:1:5:1:23 | pull_request_target | pull_request_target |
|
||||||
| .github/workflows/untrusted_checkout4.yml:35:7:41:4 | Run Step | .github/workflows/untrusted_checkout4.yml:29:7:35:4 | Uses Step | .github/workflows/untrusted_checkout4.yml:35:7:41:4 | Run Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/untrusted_checkout4.yml:2:3:2:15 | issue_comment | issue_comment |
|
| .github/workflows/untrusted_checkout4.yml:29:7:35:4 | Uses Step | .github/workflows/untrusted_checkout4.yml:29:7:35:4 | Uses Step | .github/workflows/untrusted_checkout4.yml:35:7:41:4 | Run Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/untrusted_checkout4.yml:2:3:2:15 | issue_comment | issue_comment |
|
||||||
| .github/workflows/untrusted_checkout4.yml:41:7:47:4 | Run Step | .github/workflows/untrusted_checkout4.yml:29:7:35:4 | Uses Step | .github/workflows/untrusted_checkout4.yml:41:7:47:4 | Run Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/untrusted_checkout4.yml:2:3:2:15 | issue_comment | issue_comment |
|
| .github/workflows/untrusted_checkout4.yml:29:7:35:4 | Uses Step | .github/workflows/untrusted_checkout4.yml:29:7:35:4 | Uses Step | .github/workflows/untrusted_checkout4.yml:41:7:47:4 | Run Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/untrusted_checkout4.yml:2:3:2:15 | issue_comment | issue_comment |
|
||||||
| .github/workflows/untrusted_checkout4.yml:47:7:51:46 | Run Step | .github/workflows/untrusted_checkout4.yml:29:7:35:4 | Uses Step | .github/workflows/untrusted_checkout4.yml:47:7:51:46 | Run Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/untrusted_checkout4.yml:2:3:2:15 | issue_comment | issue_comment |
|
| .github/workflows/untrusted_checkout4.yml:29:7:35:4 | Uses Step | .github/workflows/untrusted_checkout4.yml:29:7:35:4 | Uses Step | .github/workflows/untrusted_checkout4.yml:47:7:51:46 | Run Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/untrusted_checkout4.yml:2:3:2:15 | issue_comment | issue_comment |
|
||||||
| .github/workflows/untrusted_checkout.yml:15:9:18:2 | Run Step | .github/workflows/untrusted_checkout.yml:8:9:11:6 | Uses Step | .github/workflows/untrusted_checkout.yml:15:9:18:2 | Run Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/untrusted_checkout.yml:2:3:2:21 | pull_request_target | pull_request_target |
|
| .github/workflows/untrusted_checkout.yml:8:9:11:6 | Uses Step | .github/workflows/untrusted_checkout.yml:8:9:11:6 | Uses Step | .github/workflows/untrusted_checkout.yml:15:9:18:2 | Run Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/untrusted_checkout.yml:2:3:2:21 | pull_request_target | pull_request_target |
|
||||||
| .github/workflows/untrusted_checkout.yml:30:9:32:23 | Run Step | .github/workflows/untrusted_checkout.yml:23:9:26:6 | Uses Step | .github/workflows/untrusted_checkout.yml:30:9:32:23 | Run Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/untrusted_checkout.yml:2:3:2:21 | pull_request_target | pull_request_target |
|
| .github/workflows/untrusted_checkout.yml:23:9:26:6 | Uses Step | .github/workflows/untrusted_checkout.yml:23:9:26:6 | Uses Step | .github/workflows/untrusted_checkout.yml:30:9:32:23 | Run Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/untrusted_checkout.yml:2:3:2:21 | pull_request_target | pull_request_target |
|
||||||
|
|||||||
@@ -1,23 +1,23 @@
|
|||||||
| .github/workflows/issue_comment_direct.yml:12:9:16:2 | Uses Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/issue_comment_direct.yml:4:3:4:15 | issue_comment | issue_comment |
|
| .github/workflows/issue_comment_direct.yml:12:9:16:2 | Uses Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/issue_comment_direct.yml:4:3:4:15 | issue_comment | issue_comment |
|
||||||
| .github/workflows/issue_comment_direct.yml:20:9:24:2 | Uses Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/issue_comment_direct.yml:4:3:4:15 | issue_comment | issue_comment |
|
| .github/workflows/issue_comment_direct.yml:20:9:24:2 | Uses Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/issue_comment_direct.yml:4:3:4:15 | issue_comment | issue_comment |
|
||||||
| .github/workflows/issue_comment_direct.yml:28:9:32:2 | Uses Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/issue_comment_direct.yml:4:3:4:15 | issue_comment | issue_comment |
|
| .github/workflows/issue_comment_direct.yml:28:9:32:2 | Uses Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/issue_comment_direct.yml:4:3:4:15 | issue_comment | issue_comment |
|
||||||
| .github/workflows/issue_comment_direct.yml:35:9:40:2 | Uses Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/issue_comment_direct.yml:4:3:4:15 | issue_comment | issue_comment |
|
| .github/workflows/issue_comment_direct.yml:35:9:40:2 | Uses Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/issue_comment_direct.yml:4:3:4:15 | issue_comment | issue_comment |
|
||||||
| .github/workflows/issue_comment_direct.yml:43:9:46:126 | Uses Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/issue_comment_direct.yml:4:3:4:15 | issue_comment | issue_comment |
|
| .github/workflows/issue_comment_direct.yml:43:9:46:126 | Uses Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/issue_comment_direct.yml:4:3:4:15 | issue_comment | issue_comment |
|
||||||
| .github/workflows/issue_comment_heuristic.yml:28:9:33:2 | Uses Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/issue_comment_heuristic.yml:4:3:4:15 | issue_comment | issue_comment |
|
| .github/workflows/issue_comment_heuristic.yml:28:9:33:2 | Uses Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/issue_comment_heuristic.yml:4:3:4:15 | issue_comment | issue_comment |
|
||||||
| .github/workflows/issue_comment_heuristic.yml:48:7:50:46 | Uses Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/issue_comment_heuristic.yml:4:3:4:15 | issue_comment | issue_comment |
|
| .github/workflows/issue_comment_heuristic.yml:48:7:50:46 | Uses Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/issue_comment_heuristic.yml:4:3:4:15 | issue_comment | issue_comment |
|
||||||
| .github/workflows/issue_comment_octokit2.yml:27:9:31:6 | Uses Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/issue_comment_octokit2.yml:4:3:4:15 | issue_comment | issue_comment |
|
| .github/workflows/issue_comment_octokit2.yml:27:9:31:6 | Uses Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/issue_comment_octokit2.yml:4:3:4:15 | issue_comment | issue_comment |
|
||||||
| .github/workflows/issue_comment_octokit.yml:26:9:30:6 | Uses Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/issue_comment_octokit.yml:4:3:4:15 | issue_comment | issue_comment |
|
| .github/workflows/issue_comment_octokit.yml:26:9:30:6 | Uses Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/issue_comment_octokit.yml:4:3:4:15 | issue_comment | issue_comment |
|
||||||
| .github/workflows/issue_comment_octokit.yml:30:9:35:2 | Uses Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/issue_comment_octokit.yml:4:3:4:15 | issue_comment | issue_comment |
|
| .github/workflows/issue_comment_octokit.yml:30:9:35:2 | Uses Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/issue_comment_octokit.yml:4:3:4:15 | issue_comment | issue_comment |
|
||||||
| .github/workflows/issue_comment_octokit.yml:57:9:62:2 | Uses Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/issue_comment_octokit.yml:4:3:4:15 | issue_comment | issue_comment |
|
| .github/workflows/issue_comment_octokit.yml:57:9:62:2 | Uses Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/issue_comment_octokit.yml:4:3:4:15 | issue_comment | issue_comment |
|
||||||
| .github/workflows/issue_comment_octokit.yml:79:9:83:2 | Uses Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/issue_comment_octokit.yml:4:3:4:15 | issue_comment | issue_comment |
|
| .github/workflows/issue_comment_octokit.yml:79:9:83:2 | Uses Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/issue_comment_octokit.yml:4:3:4:15 | issue_comment | issue_comment |
|
||||||
| .github/workflows/issue_comment_octokit.yml:95:9:100:2 | Uses Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/issue_comment_octokit.yml:4:3:4:15 | issue_comment | issue_comment |
|
| .github/workflows/issue_comment_octokit.yml:95:9:100:2 | Uses Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/issue_comment_octokit.yml:4:3:4:15 | issue_comment | issue_comment |
|
||||||
| .github/workflows/issue_comment_octokit.yml:109:9:114:66 | Uses Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/issue_comment_octokit.yml:4:3:4:15 | issue_comment | issue_comment |
|
| .github/workflows/issue_comment_octokit.yml:109:9:114:66 | Uses Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/issue_comment_octokit.yml:4:3:4:15 | issue_comment | issue_comment |
|
||||||
| .github/workflows/pr-workflow.yml:103:9:109:6 | Uses Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/pr-workflow-fork.yaml:7:3:7:21 | pull_request_target | pull_request_target |
|
| .github/workflows/pr-workflow.yml:103:9:109:6 | Uses Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/pr-workflow-fork.yaml:7:3:7:21 | pull_request_target | pull_request_target |
|
||||||
| .github/workflows/pr-workflow.yml:139:9:144:6 | Uses Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/pr-workflow-fork.yaml:7:3:7:21 | pull_request_target | pull_request_target |
|
| .github/workflows/pr-workflow.yml:139:9:144:6 | Uses Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/pr-workflow-fork.yaml:7:3:7:21 | pull_request_target | pull_request_target |
|
||||||
| .github/workflows/pr-workflow.yml:444:9:449:6 | Uses Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/pr-workflow-fork.yaml:7:3:7:21 | pull_request_target | pull_request_target |
|
| .github/workflows/pr-workflow.yml:444:9:449:6 | Uses Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/pr-workflow-fork.yaml:7:3:7:21 | pull_request_target | pull_request_target |
|
||||||
| .github/workflows/test13.yml:20:7:25:4 | Uses Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/test13.yml:2:3:2:15 | issue_comment | issue_comment |
|
| .github/workflows/test13.yml:20:7:25:4 | Uses Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/test13.yml:2:3:2:15 | issue_comment | issue_comment |
|
||||||
| .github/workflows/untrusted_checkout2.yml:14:9:19:72 | Run Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/untrusted_checkout2.yml:1:5:1:17 | issue_comment | issue_comment |
|
| .github/workflows/untrusted_checkout2.yml:14:9:19:72 | Run Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/untrusted_checkout2.yml:1:5:1:17 | issue_comment | issue_comment |
|
||||||
| .github/workflows/workflow_run_untrusted_checkout.yml:13:9:16:6 | Uses Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/workflow_run_untrusted_checkout.yml:2:3:2:14 | workflow_run | workflow_run |
|
| .github/workflows/workflow_run_untrusted_checkout.yml:13:9:16:6 | Uses Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/workflow_run_untrusted_checkout.yml:2:3:2:14 | workflow_run | workflow_run |
|
||||||
| .github/workflows/workflow_run_untrusted_checkout.yml:16:9:18:31 | Uses Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/workflow_run_untrusted_checkout.yml:2:3:2:14 | workflow_run | workflow_run |
|
| .github/workflows/workflow_run_untrusted_checkout.yml:16:9:18:31 | Uses Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/workflow_run_untrusted_checkout.yml:2:3:2:14 | workflow_run | workflow_run |
|
||||||
| .github/workflows/workflow_run_untrusted_checkout_2.yml:13:9:16:6 | Uses Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/workflow_run_untrusted_checkout_2.yml:2:3:2:14 | workflow_run | workflow_run |
|
| .github/workflows/workflow_run_untrusted_checkout_2.yml:13:9:16:6 | Uses Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/workflow_run_untrusted_checkout_2.yml:2:3:2:14 | workflow_run | workflow_run |
|
||||||
| .github/workflows/workflow_run_untrusted_checkout_2.yml:16:9:18:31 | Uses Step | Potential execution of untrusted code on a privileged workflow ($@) | .github/workflows/workflow_run_untrusted_checkout_2.yml:2:3:2:14 | workflow_run | workflow_run |
|
| .github/workflows/workflow_run_untrusted_checkout_2.yml:16:9:18:31 | Uses Step | Checkout of untrusted code in a privileged workflow with later potential execution (event trigger: $@). | .github/workflows/workflow_run_untrusted_checkout_2.yml:2:3:2:14 | workflow_run | workflow_run |
|
||||||
|
|||||||
@@ -11,10 +11,6 @@
|
|||||||
"java/ql/lib/semmle/code/java/dataflow/internal/rangeanalysis/SignAnalysisCommon.qll",
|
"java/ql/lib/semmle/code/java/dataflow/internal/rangeanalysis/SignAnalysisCommon.qll",
|
||||||
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/rangeanalysis/SignAnalysisCommon.qll"
|
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/rangeanalysis/SignAnalysisCommon.qll"
|
||||||
],
|
],
|
||||||
"Bound Java/C#": [
|
|
||||||
"java/ql/lib/semmle/code/java/dataflow/Bound.qll",
|
|
||||||
"csharp/ql/lib/semmle/code/csharp/dataflow/Bound.qll"
|
|
||||||
],
|
|
||||||
"ModulusAnalysis Java/C#": [
|
"ModulusAnalysis Java/C#": [
|
||||||
"java/ql/lib/semmle/code/java/dataflow/ModulusAnalysis.qll",
|
"java/ql/lib/semmle/code/java/dataflow/ModulusAnalysis.qll",
|
||||||
"csharp/ql/lib/semmle/code/csharp/dataflow/ModulusAnalysis.qll"
|
"csharp/ql/lib/semmle/code/csharp/dataflow/ModulusAnalysis.qll"
|
||||||
|
|||||||
2578
cpp/downgrades/0853f43dc8c08deecb473c54a2b70da8597f1ab5/old.dbscheme
Normal file
2578
cpp/downgrades/0853f43dc8c08deecb473c54a2b70da8597f1ab5/old.dbscheme
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,2 @@
|
|||||||
|
description: Fix NameQualifier inconsistency
|
||||||
|
compatibility: full
|
||||||
2561
cpp/downgrades/837c4e02326aee4582405d069263092e80a15d82/old.dbscheme
Normal file
2561
cpp/downgrades/837c4e02326aee4582405d069263092e80a15d82/old.dbscheme
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,6 @@
|
|||||||
|
description: Support alias templates
|
||||||
|
compatibility: full
|
||||||
|
is_alias_template.rel: delete
|
||||||
|
alias_instantiation.rel: delete
|
||||||
|
alias_template_argument.rel: delete
|
||||||
|
alias_template_argument_value.rel: delete
|
||||||
2577
cpp/downgrades/ef8d209a22e27413aaaeff4446f0ecb9fa2c227b/old.dbscheme
Normal file
2577
cpp/downgrades/ef8d209a22e27413aaaeff4446f0ecb9fa2c227b/old.dbscheme
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,6 @@
|
|||||||
|
description: Capture information about one template being generated from another
|
||||||
|
compatibility: full
|
||||||
|
class_template_generated_from.rel: delete
|
||||||
|
function_template_generated_from.rel: delete
|
||||||
|
variable_template_generated_from.rel: delete
|
||||||
|
alias_template_generated_from.rel: delete
|
||||||
@@ -1,3 +1,19 @@
|
|||||||
|
## 10.2.0
|
||||||
|
|
||||||
|
### Deprecated APIs
|
||||||
|
|
||||||
|
* The `UsingAliasTypedefType` class has been deprecated. Use `TypeAliasType` instead.
|
||||||
|
|
||||||
|
### New Features
|
||||||
|
|
||||||
|
* Added a `getOriginalTemplate` predicate to `TemplateClass`, `TemplateFunction`, `TemplateVariable`, and `AliasTemplateType`, which yields the class member template the template was generated from. The predicates only have results for templates that are members of class template instantiations.
|
||||||
|
* Added `AliasTemplateType` and `AliasTemplateInstantiationType` classes, representing C++ alias templates and their instantiations.
|
||||||
|
|
||||||
|
### Minor Analysis Improvements
|
||||||
|
|
||||||
|
* Added flow source models for `scanf_s` and related functions.
|
||||||
|
* Added a `Call` column to `LocalFlowSourceFunction::hasLocalFlowSource` and `RemoteFlowSourceFunction::hasRemoteFlowSource`. The old predicates without a `Call` column continue to be supported.
|
||||||
|
|
||||||
## 10.1.1
|
## 10.1.1
|
||||||
|
|
||||||
### Minor Analysis Improvements
|
### Minor Analysis Improvements
|
||||||
|
|||||||
@@ -30,8 +30,6 @@ class Options extends string {
|
|||||||
predicate overrideReturnsNull(Call call) {
|
predicate overrideReturnsNull(Call call) {
|
||||||
// Used in CVS:
|
// Used in CVS:
|
||||||
call.(FunctionCall).getTarget().hasGlobalName("Xstrdup")
|
call.(FunctionCall).getTarget().hasGlobalName("Xstrdup")
|
||||||
or
|
|
||||||
CustomOptions::overrideReturnsNull(call) // old Options.qll
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -45,8 +43,6 @@ class Options extends string {
|
|||||||
// Used in CVS:
|
// Used in CVS:
|
||||||
call.(FunctionCall).getTarget().hasGlobalName("Xstrdup") and
|
call.(FunctionCall).getTarget().hasGlobalName("Xstrdup") and
|
||||||
nullValue(call.getArgument(0))
|
nullValue(call.getArgument(0))
|
||||||
or
|
|
||||||
CustomOptions::returnsNull(call) // old Options.qll
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -65,8 +61,6 @@ class Options extends string {
|
|||||||
f.hasGlobalOrStdName([
|
f.hasGlobalOrStdName([
|
||||||
"exit", "_exit", "_Exit", "abort", "__assert_fail", "longjmp", "__builtin_unreachable"
|
"exit", "_exit", "_Exit", "abort", "__assert_fail", "longjmp", "__builtin_unreachable"
|
||||||
])
|
])
|
||||||
or
|
|
||||||
CustomOptions::exits(f) // old Options.qll
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -79,8 +73,7 @@ class Options extends string {
|
|||||||
* runtime, the program's behavior is undefined)
|
* runtime, the program's behavior is undefined)
|
||||||
*/
|
*/
|
||||||
predicate exprExits(Expr e) {
|
predicate exprExits(Expr e) {
|
||||||
e.(AssumeExpr).getChild(0).(CompileTimeConstantInt).getIntValue() = 0 or
|
e.(AssumeExpr).getChild(0).(CompileTimeConstantInt).getIntValue() = 0
|
||||||
CustomOptions::exprExits(e) // old Options.qll
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -88,10 +81,7 @@ class Options extends string {
|
|||||||
*
|
*
|
||||||
* By default holds only for `fgets`.
|
* By default holds only for `fgets`.
|
||||||
*/
|
*/
|
||||||
predicate alwaysCheckReturnValue(Function f) {
|
predicate alwaysCheckReturnValue(Function f) { f.hasGlobalOrStdName("fgets") }
|
||||||
f.hasGlobalOrStdName("fgets") or
|
|
||||||
CustomOptions::alwaysCheckReturnValue(f) // old Options.qll
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds if it is reasonable to ignore the return value of function
|
* Holds if it is reasonable to ignore the return value of function
|
||||||
@@ -107,8 +97,6 @@ class Options extends string {
|
|||||||
// common way of sleeping using select:
|
// common way of sleeping using select:
|
||||||
fc.getTarget().hasGlobalName("select") and
|
fc.getTarget().hasGlobalName("select") and
|
||||||
fc.getArgument(0).getValue() = "0"
|
fc.getArgument(0).getValue() = "0"
|
||||||
or
|
|
||||||
CustomOptions::okToIgnoreReturnValue(fc) // old Options.qll
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -98,57 +98,3 @@ class CustomMutexType extends MutexType {
|
|||||||
*/
|
*/
|
||||||
override predicate unlockAccess(FunctionCall fc, Expr arg) { none() }
|
override predicate unlockAccess(FunctionCall fc, Expr arg) { none() }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* DEPRECATED: customize `CustomOptions.overrideReturnsNull` instead.
|
|
||||||
*
|
|
||||||
* This predicate is required to support backwards compatibility for
|
|
||||||
* older `Options.qll` files. It should not be removed or modified by
|
|
||||||
* end users.
|
|
||||||
*/
|
|
||||||
predicate overrideReturnsNull(Call call) { none() }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* DEPRECATED: customize `CustomOptions.returnsNull` instead.
|
|
||||||
*
|
|
||||||
* This predicate is required to support backwards compatibility for
|
|
||||||
* older `Options.qll` files. It should not be removed or modified by
|
|
||||||
* end users.
|
|
||||||
*/
|
|
||||||
predicate returnsNull(Call call) { none() }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* DEPRECATED: customize `CustomOptions.exits` instead.
|
|
||||||
*
|
|
||||||
* This predicate is required to support backwards compatibility for
|
|
||||||
* older `Options.qll` files. It should not be removed or modified by
|
|
||||||
* end users.
|
|
||||||
*/
|
|
||||||
predicate exits(Function f) { none() }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* DEPRECATED: customize `CustomOptions.exprExits` instead.
|
|
||||||
*
|
|
||||||
* This predicate is required to support backwards compatibility for
|
|
||||||
* older `Options.qll` files. It should not be removed or modified by
|
|
||||||
* end users.
|
|
||||||
*/
|
|
||||||
predicate exprExits(Expr e) { none() }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* DEPRECATED: customize `CustomOptions.alwaysCheckReturnValue` instead.
|
|
||||||
*
|
|
||||||
* This predicate is required to support backwards compatibility for
|
|
||||||
* older `Options.qll` files. It should not be removed or modified by
|
|
||||||
* end users.
|
|
||||||
*/
|
|
||||||
predicate alwaysCheckReturnValue(Function f) { none() }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* DEPRECATED: customize `CustomOptions.okToIgnoreReturnValue` instead.
|
|
||||||
*
|
|
||||||
* This predicate is required to support backwards compatibility for
|
|
||||||
* older `Options.qll` files. It should not be removed or modified by
|
|
||||||
* end users.
|
|
||||||
*/
|
|
||||||
predicate okToIgnoreReturnValue(FunctionCall fc) { none() }
|
|
||||||
|
|||||||
15
cpp/ql/lib/change-notes/2026-05-27-deprecated-removal.md
Normal file
15
cpp/ql/lib/change-notes/2026-05-27-deprecated-removal.md
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
category: breaking
|
||||||
|
---
|
||||||
|
* Removed the deprecated `overrideReturnsNull` predicate from `Options.qll`. Use `CustomOptions.overrideReturnsNull` instead.
|
||||||
|
* Removed the deprecated `returnsNull` predicate from `Options.qll`. Use `CustomOptions.returnsNull` instead.
|
||||||
|
* Removed the deprecated `exits` predicate from `Options.qll`. Use `CustomOptions.exits` instead.
|
||||||
|
* Removed the deprecated `exprExits` predicate from `Options.qll`. Use `CustomOptions.exprExits` instead.
|
||||||
|
* Removed the deprecated `alwaysCheckReturnValue` predicate from `Options.qll`. Use `CustomOptions.alwaysCheckReturnValue` instead.
|
||||||
|
* Removed the deprecated `okToIgnoreReturnValue` predicate from `Options.qll`. Use `CustomOptions.okToIgnoreReturnValue` instead.
|
||||||
|
* Removed the deprecated `semmle.code.cpp.Member`. Import `semmle.code.cpp.Element` and/or `semmle.code.cpp.Type` directly.
|
||||||
|
* Removed the deprecated `UnknownDefaultLocation` class. Use `UnknownLocation` instead.
|
||||||
|
* Removed the deprecated `UnknownExprLocation` class. Use `UnknownLocation` instead.
|
||||||
|
* Removed the deprecated `UnknownStmtLocation` class. Use `UnknownLocation` instead.
|
||||||
|
* Removed the deprecated `TemplateParameter` class. Use `TypeTemplateParameter` instead.
|
||||||
|
* Support for class resolution across link targets has been removed for databases which were created with CodeQL versions before 1.23.0.
|
||||||
15
cpp/ql/lib/change-notes/released/10.2.0.md
Normal file
15
cpp/ql/lib/change-notes/released/10.2.0.md
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
## 10.2.0
|
||||||
|
|
||||||
|
### Deprecated APIs
|
||||||
|
|
||||||
|
* The `UsingAliasTypedefType` class has been deprecated. Use `TypeAliasType` instead.
|
||||||
|
|
||||||
|
### New Features
|
||||||
|
|
||||||
|
* Added a `getOriginalTemplate` predicate to `TemplateClass`, `TemplateFunction`, `TemplateVariable`, and `AliasTemplateType`, which yields the class member template the template was generated from. The predicates only have results for templates that are members of class template instantiations.
|
||||||
|
* Added `AliasTemplateType` and `AliasTemplateInstantiationType` classes, representing C++ alias templates and their instantiations.
|
||||||
|
|
||||||
|
### Minor Analysis Improvements
|
||||||
|
|
||||||
|
* Added flow source models for `scanf_s` and related functions.
|
||||||
|
* Added a `Call` column to `LocalFlowSourceFunction::hasLocalFlowSource` and `RemoteFlowSourceFunction::hasRemoteFlowSource`. The old predicates without a `Call` column continue to be supported.
|
||||||
@@ -1,2 +1,2 @@
|
|||||||
---
|
---
|
||||||
lastReleaseVersion: 10.1.1
|
lastReleaseVersion: 10.2.0
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ import semmle.code.cpp.Class
|
|||||||
import semmle.code.cpp.Struct
|
import semmle.code.cpp.Struct
|
||||||
import semmle.code.cpp.Union
|
import semmle.code.cpp.Union
|
||||||
import semmle.code.cpp.Enum
|
import semmle.code.cpp.Enum
|
||||||
import semmle.code.cpp.Member
|
|
||||||
import semmle.code.cpp.Field
|
import semmle.code.cpp.Field
|
||||||
import semmle.code.cpp.Function
|
import semmle.code.cpp.Function
|
||||||
import semmle.code.cpp.MemberFunction
|
import semmle.code.cpp.MemberFunction
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
name: codeql/cpp-all
|
name: codeql/cpp-all
|
||||||
version: 10.1.1
|
version: 10.2.1-dev
|
||||||
groups: cpp
|
groups: cpp
|
||||||
dbscheme: semmlecode.cpp.dbscheme
|
dbscheme: semmlecode.cpp.dbscheme
|
||||||
extractor: cpp
|
extractor: cpp
|
||||||
|
|||||||
@@ -856,8 +856,10 @@ class AbstractClass extends Class {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A class template (this class also finds partial specializations
|
* A class template (this class also finds partial specializations
|
||||||
* of class templates). For example in the following code there is a
|
* of class templates).
|
||||||
* `MyTemplateClass<T>` template:
|
*
|
||||||
|
* For example in the following code there is a `MyTemplateClass<T>`
|
||||||
|
* template:
|
||||||
* ```
|
* ```
|
||||||
* template<class T>
|
* template<class T>
|
||||||
* class MyTemplateClass {
|
* class MyTemplateClass {
|
||||||
@@ -893,6 +895,29 @@ class TemplateClass extends Class {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override string getAPrimaryQlClass() { result = "TemplateClass" }
|
override string getAPrimaryQlClass() { result = "TemplateClass" }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the class member template this template was generated from.
|
||||||
|
*
|
||||||
|
* This predicate only has results for templates that are members of class
|
||||||
|
* template instantiations. For example, for `MyTemplateClass<int>::C<S>`
|
||||||
|
* in the following code, the result is `MyTemplateClass<T>::C<S>`.
|
||||||
|
* ```cpp
|
||||||
|
* template<class T>
|
||||||
|
* class MyTemplateClass {
|
||||||
|
* template<class S>
|
||||||
|
* class C {
|
||||||
|
* ...
|
||||||
|
* };
|
||||||
|
* };
|
||||||
|
*
|
||||||
|
* template
|
||||||
|
* class MyTemplateClass<int>;
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
TemplateClass getOriginalTemplate() {
|
||||||
|
class_template_generated_from(underlyingElement(this), unresolveElement(result))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -278,6 +278,8 @@ class Declaration extends Locatable, @declaration {
|
|||||||
or
|
or
|
||||||
variable_template_argument(underlyingElement(this), index, unresolveElement(result))
|
variable_template_argument(underlyingElement(this), index, unresolveElement(result))
|
||||||
or
|
or
|
||||||
|
alias_template_argument(underlyingElement(this), index, unresolveElement(result))
|
||||||
|
or
|
||||||
template_template_argument(underlyingElement(this), index, unresolveElement(result))
|
template_template_argument(underlyingElement(this), index, unresolveElement(result))
|
||||||
or
|
or
|
||||||
concept_template_argument(underlyingElement(this), index, unresolveElement(result))
|
concept_template_argument(underlyingElement(this), index, unresolveElement(result))
|
||||||
@@ -290,6 +292,8 @@ class Declaration extends Locatable, @declaration {
|
|||||||
or
|
or
|
||||||
variable_template_argument_value(underlyingElement(this), index, unresolveElement(result))
|
variable_template_argument_value(underlyingElement(this), index, unresolveElement(result))
|
||||||
or
|
or
|
||||||
|
alias_template_argument_value(underlyingElement(this), index, unresolveElement(result))
|
||||||
|
or
|
||||||
template_template_argument_value(underlyingElement(this), index, unresolveElement(result))
|
template_template_argument_value(underlyingElement(this), index, unresolveElement(result))
|
||||||
or
|
or
|
||||||
concept_template_argument_value(underlyingElement(this), index, unresolveElement(result))
|
concept_template_argument_value(underlyingElement(this), index, unresolveElement(result))
|
||||||
|
|||||||
@@ -278,6 +278,15 @@ private predicate isFromTemplateInstantiationRec(Element e, Element instantiatio
|
|||||||
instantiation.(Variable).isConstructedFrom(_) and
|
instantiation.(Variable).isConstructedFrom(_) and
|
||||||
e = instantiation
|
e = instantiation
|
||||||
or
|
or
|
||||||
|
instantiation.(TypeAliasType).isConstructedFrom(_) and
|
||||||
|
e = instantiation
|
||||||
|
or
|
||||||
|
instantiation.(TemplateTemplateParameterInstantiation).isConstructedFrom(_) and
|
||||||
|
e = instantiation
|
||||||
|
or
|
||||||
|
exists(instantiation.(ConceptIdExpr).getConcept()) and
|
||||||
|
e = instantiation
|
||||||
|
or
|
||||||
isFromTemplateInstantiationRec(e.getEnclosingElement(), instantiation)
|
isFromTemplateInstantiationRec(e.getEnclosingElement(), instantiation)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -291,6 +300,15 @@ private predicate isFromUninstantiatedTemplateRec(Element e, Element template) {
|
|||||||
is_variable_template(unresolveElement(template)) and
|
is_variable_template(unresolveElement(template)) and
|
||||||
e = template
|
e = template
|
||||||
or
|
or
|
||||||
|
is_alias_template(unresolveElement(template)) and
|
||||||
|
e = template
|
||||||
|
or
|
||||||
|
usertypes(unresolveElement(template), _, 8) and // template template parameter
|
||||||
|
e = template
|
||||||
|
or
|
||||||
|
template instanceof @concept_template and
|
||||||
|
e = template
|
||||||
|
or
|
||||||
isFromUninstantiatedTemplateRec(e.getEnclosingElement(), template)
|
isFromUninstantiatedTemplateRec(e.getEnclosingElement(), template)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -828,6 +828,27 @@ class TemplateFunction extends Function {
|
|||||||
* such things -- see FunctionTemplateSpecialization for further details.
|
* such things -- see FunctionTemplateSpecialization for further details.
|
||||||
*/
|
*/
|
||||||
FunctionTemplateSpecialization getASpecialization() { result.getPrimaryTemplate() = this }
|
FunctionTemplateSpecialization getASpecialization() { result.getPrimaryTemplate() = this }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the class member template this template was generated from.
|
||||||
|
*
|
||||||
|
* This predicate only has results for templates that are members of class
|
||||||
|
* template instantiations. For example, for `MyTemplateClass<int>::f<S>`
|
||||||
|
* in the following code, the result is `MyTemplateClass<T>::f<S>`.
|
||||||
|
* ```cpp
|
||||||
|
* template<class T>
|
||||||
|
* class MyTemplateClass {
|
||||||
|
* template<class S>
|
||||||
|
* S f();
|
||||||
|
* };
|
||||||
|
*
|
||||||
|
* template
|
||||||
|
* class MyTemplateClass<int>;
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
TemplateFunction getOriginalTemplate() {
|
||||||
|
function_template_generated_from(underlyingElement(this), unresolveElement(result))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -148,28 +148,3 @@ class UnknownLocation extends Location {
|
|||||||
this.getFile().getAbsolutePath() = "" and locations_default(this, _, 0, 0, 0, 0)
|
this.getFile().getAbsolutePath() = "" and locations_default(this, _, 0, 0, 0, 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* A dummy location which is used when something doesn't have a location in
|
|
||||||
* the source code but needs to have a `Location` associated with it.
|
|
||||||
*
|
|
||||||
* DEPRECATED: use `UnknownLocation`
|
|
||||||
*/
|
|
||||||
deprecated class UnknownDefaultLocation extends UnknownLocation { }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A dummy location which is used when an expression doesn't have a
|
|
||||||
* location in the source code but needs to have a `Location` associated
|
|
||||||
* with it.
|
|
||||||
*
|
|
||||||
* DEPRECATED: use `UnknownLocation`
|
|
||||||
*/
|
|
||||||
deprecated class UnknownExprLocation extends UnknownLocation { }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A dummy location which is used when a statement doesn't have a location
|
|
||||||
* in the source code but needs to have a `Location` associated with it.
|
|
||||||
*
|
|
||||||
* DEPRECATED: use `UnknownLocation`
|
|
||||||
*/
|
|
||||||
deprecated class UnknownStmtLocation extends UnknownLocation { }
|
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
/**
|
|
||||||
* DEPRECATED: import `semmle.code.cpp.Element` and/or `semmle.code.cpp.Type` directly as required.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import semmle.code.cpp.Element
|
|
||||||
import semmle.code.cpp.Type
|
|
||||||
@@ -35,13 +35,6 @@ class NonTypeTemplateParameter extends Literal, TemplateParameterImpl {
|
|||||||
override string getAPrimaryQlClass() { result = "NonTypeTemplateParameter" }
|
override string getAPrimaryQlClass() { result = "NonTypeTemplateParameter" }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* A C++ `typename` (or `class`) template parameter.
|
|
||||||
*
|
|
||||||
* DEPRECATED: Use `TypeTemplateParameter` instead.
|
|
||||||
*/
|
|
||||||
deprecated class TemplateParameter = TypeTemplateParameter;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A C++ `typename` (or `class`) template parameter.
|
* A C++ `typename` (or `class`) template parameter.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1071,7 +1071,7 @@ class NullPointerType extends BuiltInType {
|
|||||||
* const float fa[40];
|
* const float fa[40];
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
class DerivedType extends Type, @derivedtype {
|
class DerivedType extends Type, NameQualifyingElement, @derivedtype {
|
||||||
override string toString() { result = this.getName() }
|
override string toString() { result = this.getName() }
|
||||||
|
|
||||||
override string getName() { derivedtypes(underlyingElement(this), result, _, _) }
|
override string getName() { derivedtypes(underlyingElement(this), result, _, _) }
|
||||||
|
|||||||
@@ -64,23 +64,123 @@ class CTypedefType extends TypedefType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A using alias C++ typedef type. For example the type declared in the following code:
|
* DEPRECATED: Use `TypeAlias` instead.
|
||||||
|
*
|
||||||
|
* A C++ type alias or alias template.
|
||||||
|
*
|
||||||
|
* For example the type declared in the following code:
|
||||||
* ```
|
* ```
|
||||||
* using my_int2 = int;
|
* using my_int2 = int;
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
class UsingAliasTypedefType extends TypedefType {
|
deprecated class UsingAliasTypedefType = TypeAliasType;
|
||||||
UsingAliasTypedefType() { usertype_alias_kind(underlyingElement(this), 1) }
|
|
||||||
|
|
||||||
override string getAPrimaryQlClass() { result = "UsingAliasTypedefType" }
|
/**
|
||||||
|
* A C++ type alias or alias template.
|
||||||
|
*
|
||||||
|
* For example the type declared in the following code:
|
||||||
|
* ```
|
||||||
|
* using my_int2 = int;
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
class TypeAliasType extends TypedefType {
|
||||||
|
TypeAliasType() { usertype_alias_kind(underlyingElement(this), 1) }
|
||||||
|
|
||||||
|
override string getAPrimaryQlClass() { result = "TypeAliasType" }
|
||||||
|
|
||||||
override string explain() {
|
override string explain() {
|
||||||
result = "using {" + this.getBaseType().explain() + "} as \"" + this.getName() + "\""
|
result = "using {" + this.getBaseType().explain() + "} as \"" + this.getName() + "\""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holds if this alias is constructed from another alias as a result of
|
||||||
|
* template instantiation.
|
||||||
|
*/
|
||||||
|
predicate isConstructedFrom(TypeAliasType t) {
|
||||||
|
alias_instantiation(underlyingElement(this), unresolveElement(t))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A C++ `typedef` type that is directly enclosed by a function. For example the type declared inside the function `foo` in
|
* A C++ alias template.
|
||||||
|
*
|
||||||
|
* For example the type declared in the following code:
|
||||||
|
* ```
|
||||||
|
* template <typename T>
|
||||||
|
* using my_type = T;
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
class AliasTemplateType extends TypeAliasType {
|
||||||
|
AliasTemplateType() { is_alias_template(underlyingElement(this)) }
|
||||||
|
|
||||||
|
override string getAPrimaryQlClass() { result = "AliasTemplateType" }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets an alias instantiated from this template.
|
||||||
|
*
|
||||||
|
* For example for `MyAliasTemplate<T>` in the following code, the results are
|
||||||
|
* `MyAliasTemplate<int>` and `MyAliasTemplate<long>`:
|
||||||
|
* ```
|
||||||
|
* template<typename T>
|
||||||
|
* using MyAliasTemplate = ...;
|
||||||
|
*
|
||||||
|
* MyAliasTemplate<int> instance1;
|
||||||
|
*
|
||||||
|
* MyAliasTemplate<long> instance2;
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
TypeAliasType getAnInstantiation() { result.isConstructedFrom(this) }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the class member template this template was generated from.
|
||||||
|
*
|
||||||
|
* This predicate only has results for templates that are members of class
|
||||||
|
* template instantiations. For example, for `MyTemplateClass<int>::t<S>`
|
||||||
|
* in the following code, the result is `MyTemplateClass<T>::t<S>`.
|
||||||
|
* ```cpp
|
||||||
|
* template<class T>
|
||||||
|
* class MyTemplateClass {
|
||||||
|
* template<class S>
|
||||||
|
* using t = S;
|
||||||
|
* };
|
||||||
|
*
|
||||||
|
* template
|
||||||
|
* class MyTemplateClass<int>;
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
AliasTemplateType getOriginalTemplate() {
|
||||||
|
alias_template_generated_from(underlyingElement(this), unresolveElement(result))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A C++ alias template instantiation.
|
||||||
|
*
|
||||||
|
* For example the `my_int_type` type declared in the following code:
|
||||||
|
* ```
|
||||||
|
* template <typename T>
|
||||||
|
* using my_type = T;
|
||||||
|
*
|
||||||
|
* using my_int_type = my_type<int>;
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
class AliasTemplateInstantiationType extends TypeAliasType {
|
||||||
|
AliasTemplateType at;
|
||||||
|
|
||||||
|
AliasTemplateInstantiationType() { at.getAnInstantiation() = this }
|
||||||
|
|
||||||
|
override string getAPrimaryQlClass() { result = "AliasTemplateInstantiationType" }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the alias template from which this instantiation was instantiated.
|
||||||
|
*/
|
||||||
|
AliasTemplateType getTemplate() { result = at }
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A C++ `typedef` type that is directly enclosed by a function.
|
||||||
|
*
|
||||||
|
* For example the type declared inside the function `foo` in
|
||||||
* the following code:
|
* the following code:
|
||||||
* ```
|
* ```
|
||||||
* int foo(void) { typedef int local; }
|
* int foo(void) { typedef int local; }
|
||||||
|
|||||||
@@ -614,6 +614,27 @@ class TemplateVariable extends Variable {
|
|||||||
result.isConstructedFrom(this) and
|
result.isConstructedFrom(this) and
|
||||||
not result.isSpecialization()
|
not result.isSpecialization()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the class member template this template was generated from.
|
||||||
|
*
|
||||||
|
* This predicate only has results for templates that are members of class
|
||||||
|
* template instantiations. For example, for `MyTemplateClass<int>::x<S>`
|
||||||
|
* in the following code, the result is `MyTemplateClass<T>::x<S>`.
|
||||||
|
* ```cpp
|
||||||
|
* template<class T>
|
||||||
|
* class MyTemplateClass {
|
||||||
|
* template<class S>
|
||||||
|
* static S x;
|
||||||
|
* };
|
||||||
|
*
|
||||||
|
* template
|
||||||
|
* class MyTemplateClass<int>;
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
TemplateVariable getOriginalTemplate() {
|
||||||
|
variable_template_generated_from(underlyingElement(this), unresolveElement(result))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -25,6 +25,15 @@ abstract class ScanfFunction extends Function {
|
|||||||
* (rather than a `char*`).
|
* (rather than a `char*`).
|
||||||
*/
|
*/
|
||||||
predicate isWideCharDefault() { exists(this.getName().indexOf("wscanf")) }
|
predicate isWideCharDefault() { exists(this.getName().indexOf("wscanf")) }
|
||||||
|
|
||||||
|
/** Holds if this is one of the `scanf_s` variants. */
|
||||||
|
predicate isSVariant() {
|
||||||
|
exists(string name | name = this.getName() |
|
||||||
|
name.matches("%\\_s")
|
||||||
|
or
|
||||||
|
name.matches("%\\_s\\_l")
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -34,8 +43,12 @@ class Scanf extends ScanfFunction instanceof TopLevelFunction {
|
|||||||
Scanf() {
|
Scanf() {
|
||||||
this.hasGlobalOrStdOrBslName("scanf") or // scanf(format, args...)
|
this.hasGlobalOrStdOrBslName("scanf") or // scanf(format, args...)
|
||||||
this.hasGlobalOrStdOrBslName("wscanf") or // wscanf(format, args...)
|
this.hasGlobalOrStdOrBslName("wscanf") or // wscanf(format, args...)
|
||||||
|
this.hasGlobalOrStdOrBslName("scanf_s") or // scanf_s(format, args...)
|
||||||
|
this.hasGlobalOrStdOrBslName("wscanf_s") or // wscanf_s(format, args...)
|
||||||
this.hasGlobalName("_scanf_l") or // _scanf_l(format, locale, args...)
|
this.hasGlobalName("_scanf_l") or // _scanf_l(format, locale, args...)
|
||||||
this.hasGlobalName("_wscanf_l")
|
this.hasGlobalName("_wscanf_l") or // _wscanf_l(format, locale, args...)
|
||||||
|
this.hasGlobalName("_scanf_s_l") or // _scanf_s_l(format, locale, args...)
|
||||||
|
this.hasGlobalName("_wscanf_s_l") // _wscanf_s_l(format, locale, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
override int getInputParameterIndex() { none() }
|
override int getInputParameterIndex() { none() }
|
||||||
@@ -50,8 +63,12 @@ class Fscanf extends ScanfFunction instanceof TopLevelFunction {
|
|||||||
Fscanf() {
|
Fscanf() {
|
||||||
this.hasGlobalOrStdOrBslName("fscanf") or // fscanf(src_stream, format, args...)
|
this.hasGlobalOrStdOrBslName("fscanf") or // fscanf(src_stream, format, args...)
|
||||||
this.hasGlobalOrStdOrBslName("fwscanf") or // fwscanf(src_stream, format, args...)
|
this.hasGlobalOrStdOrBslName("fwscanf") or // fwscanf(src_stream, format, args...)
|
||||||
|
this.hasGlobalOrStdOrBslName("fscanf_s") or // fscanf_s(src_stream, format, args...)
|
||||||
|
this.hasGlobalOrStdOrBslName("fwscanf_s") or // fwscanf_s(src_stream, format, args...)
|
||||||
this.hasGlobalName("_fscanf_l") or // _fscanf_l(src_stream, format, locale, args...)
|
this.hasGlobalName("_fscanf_l") or // _fscanf_l(src_stream, format, locale, args...)
|
||||||
this.hasGlobalName("_fwscanf_l")
|
this.hasGlobalName("_fwscanf_l") or // _fwscanf_l(src_stream, format, locale, args...)
|
||||||
|
this.hasGlobalName("_fscanf_s_l") or // _fscanf_s_l(src_stream, format, locale, args...)
|
||||||
|
this.hasGlobalName("_fwscanf_s_l") // _fwscanf_s_l(src_stream, format, locale, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
override int getInputParameterIndex() { result = 0 }
|
override int getInputParameterIndex() { result = 0 }
|
||||||
@@ -66,8 +83,12 @@ class Sscanf extends ScanfFunction instanceof TopLevelFunction {
|
|||||||
Sscanf() {
|
Sscanf() {
|
||||||
this.hasGlobalOrStdOrBslName("sscanf") or // sscanf(src_stream, format, args...)
|
this.hasGlobalOrStdOrBslName("sscanf") or // sscanf(src_stream, format, args...)
|
||||||
this.hasGlobalOrStdOrBslName("swscanf") or // swscanf(src, format, args...)
|
this.hasGlobalOrStdOrBslName("swscanf") or // swscanf(src, format, args...)
|
||||||
|
this.hasGlobalOrStdOrBslName("sscanf_s") or // sscanf_s(src, format, args...)
|
||||||
|
this.hasGlobalOrStdOrBslName("swscanf_s") or // swscanf_s(src, format, args...)
|
||||||
this.hasGlobalName("_sscanf_l") or // _sscanf_l(src, format, locale, args...)
|
this.hasGlobalName("_sscanf_l") or // _sscanf_l(src, format, locale, args...)
|
||||||
this.hasGlobalName("_swscanf_l")
|
this.hasGlobalName("_swscanf_l") or // _swscanf_l(src, format, locale, args...)
|
||||||
|
this.hasGlobalName("_sscanf_s_l") or // _sscanf_s_l(src, format, locale, args...)
|
||||||
|
this.hasGlobalName("_swscanf_s_l") // _swscanf_s_l(src, format, locale, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
override int getInputParameterIndex() { result = 0 }
|
override int getInputParameterIndex() { result = 0 }
|
||||||
@@ -97,6 +118,14 @@ class Snscanf extends ScanfFunction instanceof TopLevelFunction {
|
|||||||
int getInputLengthParameterIndex() { result = 1 }
|
int getInputLengthParameterIndex() { result = 1 }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private predicate isCharLike(Type t) { t instanceof CharType or t instanceof Wchar_t }
|
||||||
|
|
||||||
|
private predicate isStringLike(Type t) {
|
||||||
|
isCharLike(t.(PointerType).getBaseType())
|
||||||
|
or
|
||||||
|
isCharLike(t.(ArrayType).getBaseType())
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A call to one of the `scanf` functions.
|
* A call to one of the `scanf` functions.
|
||||||
*/
|
*/
|
||||||
@@ -130,14 +159,40 @@ class ScanfFunctionCall extends FunctionCall {
|
|||||||
*/
|
*/
|
||||||
predicate isWideCharDefault() { this.getScanfFunction().isWideCharDefault() }
|
predicate isWideCharDefault() { this.getScanfFunction().isWideCharDefault() }
|
||||||
|
|
||||||
|
bindingset[this, k]
|
||||||
|
pragma[inline_late]
|
||||||
|
private predicate isSizeArgument(int k) {
|
||||||
|
// The first vararg is never the size argument since a size argument must
|
||||||
|
// always follow a string buffer argument.
|
||||||
|
k > 0 and
|
||||||
|
isStringLike(this.getArgument(this.getScanfFunction().getNumberOfParameters() + k - 1)
|
||||||
|
.getUnspecifiedType())
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the output argument at position `n` in the vararg list of this call.
|
* Gets the output argument at position `n` in the vararg list of this call.
|
||||||
*
|
*
|
||||||
* The range of `n` is from `0` to `this.getNumberOfOutputArguments() - 1`.
|
* The range of `n` is from `0` to `this.getNumberOfOutputArguments() - 1`.
|
||||||
*/
|
*/
|
||||||
Expr getOutputArgument(int n) {
|
Expr getOutputArgument(int n) {
|
||||||
result = this.getArgument(this.getTarget().getNumberOfParameters() + n) and
|
exists(ScanfFunction target | target = this.getScanfFunction() |
|
||||||
n >= 0
|
// If this is an S variant then every string buffer argument has a
|
||||||
|
// corresponding size argument immediately following it, so we need to
|
||||||
|
// skip over those size arguments when counting the output arguments.
|
||||||
|
if target.isSVariant()
|
||||||
|
then
|
||||||
|
result =
|
||||||
|
rank[n + 1](Expr arg, int k |
|
||||||
|
k >= 0 and
|
||||||
|
arg = this.getArgument(target.getNumberOfParameters() + k) and
|
||||||
|
not this.isSizeArgument(k)
|
||||||
|
|
|
||||||
|
arg order by k
|
||||||
|
)
|
||||||
|
else (
|
||||||
|
n >= 0 and result = this.getArgument(target.getNumberOfParameters() + n)
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -276,6 +276,45 @@ private predicate isClassConstructedFrom(Class c, Class templateClass) {
|
|||||||
not c.isConstructedFrom(_) and c = templateClass
|
not c.isConstructedFrom(_) and c = templateClass
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Gets the fully templated version of `c`. */
|
||||||
|
private Class getFullyTemplatedClassOld(Class c) {
|
||||||
|
not c.isFromUninstantiatedTemplate(_) and
|
||||||
|
isClassConstructedFrom(c, result)
|
||||||
|
}
|
||||||
|
|
||||||
|
private TemplateClass getOriginalClassTemplate(TemplateClass tc) {
|
||||||
|
result = tc.getOriginalTemplate()
|
||||||
|
or
|
||||||
|
not exists(tc.getOriginalTemplate()) and
|
||||||
|
result = tc
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Gets the fully templated version of `c`. */
|
||||||
|
private Class getFullyTemplatedClassNew(Class c) {
|
||||||
|
not c.isFromUninstantiatedTemplate(_) and
|
||||||
|
exists(Class mid |
|
||||||
|
c.isConstructedFrom(mid)
|
||||||
|
or
|
||||||
|
not c.isConstructedFrom(_) and c = mid
|
||||||
|
|
|
||||||
|
result = getOriginalClassTemplate(mid)
|
||||||
|
or
|
||||||
|
not mid instanceof TemplateClass and mid = result
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Gets the fully templated version of `c`. */
|
||||||
|
private Class getFullyTemplatedClass(Class c) {
|
||||||
|
// The `Class::getOriginalTemplate` predicate was introduced in CodeQL
|
||||||
|
// version 2.25.6 and the upgrade script leaves the
|
||||||
|
// `class_template_generated_from` extensionals empty if the database
|
||||||
|
// was generated with an older extractor. So we use the old implementation
|
||||||
|
// if the `class_template_generated_from` extensional is empty.
|
||||||
|
if class_template_generated_from(_, _)
|
||||||
|
then result = getFullyTemplatedClassNew(c)
|
||||||
|
else result = getFullyTemplatedClassOld(c)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds if `f` is an instantiation of a function template `templateFunc`, or
|
* Holds if `f` is an instantiation of a function template `templateFunc`, or
|
||||||
* holds with `f = templateFunc` if `f` is not an instantiation of any function
|
* holds with `f = templateFunc` if `f` is not an instantiation of any function
|
||||||
@@ -292,7 +331,7 @@ private predicate isFunctionConstructedFrom(Function f, Function templateFunc) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Gets the fully templated version of `f`. */
|
/** Gets the fully templated version of `f`. */
|
||||||
Function getFullyTemplatedFunction(Function f) {
|
private Function getFullyTemplatedFunctionOld(Function f) {
|
||||||
not f.isFromUninstantiatedTemplate(_) and
|
not f.isFromUninstantiatedTemplate(_) and
|
||||||
(
|
(
|
||||||
exists(Class c, Class templateClass, int i |
|
exists(Class c, Class templateClass, int i |
|
||||||
@@ -306,13 +345,46 @@ Function getFullyTemplatedFunction(Function f) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private TemplateFunction getOriginalFunctionTemplate(TemplateFunction tf) {
|
||||||
|
result = tf.getOriginalTemplate()
|
||||||
|
or
|
||||||
|
not exists(tf.getOriginalTemplate()) and
|
||||||
|
result = tf
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Gets the fully templated version of `f`. */
|
||||||
|
private Function getFullyTemplatedFunctionNew(Function f) {
|
||||||
|
not f.isFromUninstantiatedTemplate(_) and
|
||||||
|
exists(Function mid |
|
||||||
|
f.isConstructedFrom(mid)
|
||||||
|
or
|
||||||
|
not f.isConstructedFrom(_) and f = mid
|
||||||
|
|
|
||||||
|
result = getOriginalFunctionTemplate(mid)
|
||||||
|
or
|
||||||
|
not mid instanceof TemplateFunction and mid = result
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Gets the fully templated version of `f`. */
|
||||||
|
Function getFullyTemplatedFunction(Function f) {
|
||||||
|
// The `Function::getOriginalTemplate` predicate was introduced in CodeQL
|
||||||
|
// version 2.25.6 and the upgrade script leaves the
|
||||||
|
// `function_template_generated_from` extensionals empty if the database
|
||||||
|
// was generated with an older extractor. So we use the old implementation
|
||||||
|
// if the `function_template_generated_from` extensional is empty.
|
||||||
|
if function_template_generated_from(_, _)
|
||||||
|
then result = getFullyTemplatedFunctionNew(f)
|
||||||
|
else result = getFullyTemplatedFunctionOld(f)
|
||||||
|
}
|
||||||
|
|
||||||
/** Prefixes `const` to `s` if `t` is const, or returns `s` otherwise. */
|
/** Prefixes `const` to `s` if `t` is const, or returns `s` otherwise. */
|
||||||
bindingset[s, t]
|
bindingset[s, t]
|
||||||
private string withConst(string s, Type t) {
|
private string withConst(string s, Type t) {
|
||||||
if t.isConst() then result = "const " + s else result = s
|
if t.isConst() then result = "const " + s else result = s
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Prefixes `volatile` to `s` if `t` is const, or returns `s` otherwise. */
|
/** Prefixes `volatile` to `s` if `t` is volatile, or returns `s` otherwise. */
|
||||||
bindingset[s, t]
|
bindingset[s, t]
|
||||||
private string withVolatile(string s, Type t) {
|
private string withVolatile(string s, Type t) {
|
||||||
if t.isVolatile() then result = "volatile " + s else result = s
|
if t.isVolatile() then result = "volatile " + s else result = s
|
||||||
@@ -490,7 +562,7 @@ pragma[nomagic]
|
|||||||
private string getTypeNameWithoutClassTemplates(Function f, int n, int remaining) {
|
private string getTypeNameWithoutClassTemplates(Function f, int n, int remaining) {
|
||||||
// If there is a declaring type then we start by expanding the function templates
|
// If there is a declaring type then we start by expanding the function templates
|
||||||
exists(Class template |
|
exists(Class template |
|
||||||
isClassConstructedFrom(f.getDeclaringType(), template) and
|
template = getFullyTemplatedClass(f.getDeclaringType()) and
|
||||||
remaining = getNumberOfSupportedClassTemplateArguments(template) and
|
remaining = getNumberOfSupportedClassTemplateArguments(template) and
|
||||||
result = getTypeNameWithoutFunctionTemplates(f, n, 0)
|
result = getTypeNameWithoutFunctionTemplates(f, n, 0)
|
||||||
)
|
)
|
||||||
@@ -502,7 +574,7 @@ private string getTypeNameWithoutClassTemplates(Function f, int n, int remaining
|
|||||||
or
|
or
|
||||||
exists(string mid, TypeTemplateParameter tp, Class template |
|
exists(string mid, TypeTemplateParameter tp, Class template |
|
||||||
mid = getTypeNameWithoutClassTemplates(f, n, remaining + 1) and
|
mid = getTypeNameWithoutClassTemplates(f, n, remaining + 1) and
|
||||||
isClassConstructedFrom(f.getDeclaringType(), template) and
|
template = getFullyTemplatedClass(f.getDeclaringType()) and
|
||||||
tp = getSupportedClassTemplateArgument(template, remaining)
|
tp = getSupportedClassTemplateArgument(template, remaining)
|
||||||
|
|
|
|
||||||
result = mid.replaceAll(tp.getName(), "class:" + remaining.toString())
|
result = mid.replaceAll(tp.getName(), "class:" + remaining.toString())
|
||||||
|
|||||||
@@ -1,59 +1,5 @@
|
|||||||
import semmle.code.cpp.Type
|
import semmle.code.cpp.Type
|
||||||
|
|
||||||
/** For upgraded databases without mangled name info. */
|
|
||||||
pragma[noinline]
|
|
||||||
private string getTopLevelClassName(@usertype c) {
|
|
||||||
not mangled_name(_, _, _) and
|
|
||||||
isClass(c) and
|
|
||||||
usertypes(c, result, _) and
|
|
||||||
not namespacembrs(_, c) and // not in a namespace
|
|
||||||
not member(_, _, c) and // not in some structure
|
|
||||||
not class_instantiation(c, _) // not a template instantiation
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* For upgraded databases without mangled name info.
|
|
||||||
* Holds if `d` is a unique complete class named `name`.
|
|
||||||
*/
|
|
||||||
pragma[noinline]
|
|
||||||
private predicate existsCompleteWithName(string name, @usertype d) {
|
|
||||||
not mangled_name(_, _, _) and
|
|
||||||
is_complete(d) and
|
|
||||||
name = getTopLevelClassName(d) and
|
|
||||||
onlyOneCompleteClassExistsWithName(name)
|
|
||||||
}
|
|
||||||
|
|
||||||
/** For upgraded databases without mangled name info. */
|
|
||||||
pragma[noinline]
|
|
||||||
private predicate onlyOneCompleteClassExistsWithName(string name) {
|
|
||||||
not mangled_name(_, _, _) and
|
|
||||||
strictcount(@usertype c | is_complete(c) and getTopLevelClassName(c) = name) = 1
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* For upgraded databases without mangled name info.
|
|
||||||
* Holds if `c` is an incomplete class named `name`.
|
|
||||||
*/
|
|
||||||
pragma[noinline]
|
|
||||||
private predicate existsIncompleteWithName(string name, @usertype c) {
|
|
||||||
not mangled_name(_, _, _) and
|
|
||||||
not is_complete(c) and
|
|
||||||
name = getTopLevelClassName(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* For upgraded databases without mangled name info.
|
|
||||||
* Holds if `c` is an incomplete class, and there exists a unique complete class `d`
|
|
||||||
* with the same name.
|
|
||||||
*/
|
|
||||||
private predicate oldHasCompleteTwin(@usertype c, @usertype d) {
|
|
||||||
not mangled_name(_, _, _) and
|
|
||||||
exists(string name |
|
|
||||||
existsIncompleteWithName(name, c) and
|
|
||||||
existsCompleteWithName(name, d)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
pragma[noinline]
|
pragma[noinline]
|
||||||
private @mangledname getClassMangledName(@usertype c) {
|
private @mangledname getClassMangledName(@usertype c) {
|
||||||
isClass(c) and
|
isClass(c) and
|
||||||
@@ -103,10 +49,7 @@ private module Cached {
|
|||||||
@usertype resolveClass(@usertype c) {
|
@usertype resolveClass(@usertype c) {
|
||||||
hasCompleteTwin(c, result)
|
hasCompleteTwin(c, result)
|
||||||
or
|
or
|
||||||
oldHasCompleteTwin(c, result)
|
|
||||||
or
|
|
||||||
not hasCompleteTwin(c, _) and
|
not hasCompleteTwin(c, _) and
|
||||||
not oldHasCompleteTwin(c, _) and
|
|
||||||
result = c
|
result = c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -136,7 +136,9 @@ private module SourceVariables {
|
|||||||
NormalSourceVariable() { this = TNormalSourceVariable(base, ind) }
|
NormalSourceVariable() { this = TNormalSourceVariable(base, ind) }
|
||||||
|
|
||||||
final override string toString() {
|
final override string toString() {
|
||||||
result = repeatStars(this.getIndirection()) + base.toString()
|
if this.getIndirection() = 0
|
||||||
|
then result = "&" + base.toString()
|
||||||
|
else result = repeatStars(this.getIndirection() - 1) + base.toString()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,7 +159,9 @@ private module SourceVariables {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final override string toString() {
|
final override string toString() {
|
||||||
result = repeatStars(this.getIndirection()) + base.toString() + " [before crement]"
|
if this.getIndirection() = 0
|
||||||
|
then result = "&" + base.toString() + " [before crement]"
|
||||||
|
else result = repeatStars(this.getIndirection() - 1) + base.toString() + " [before crement]"
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1353,6 +1357,52 @@ class PhiNode extends Definition instanceof SsaImpl::PhiNode {
|
|||||||
final predicate hasInputFromBlock(Definition input, IRBlock bb) {
|
final predicate hasInputFromBlock(Definition input, IRBlock bb) {
|
||||||
phiHasInputFromBlock(this, input, bb)
|
phiHasInputFromBlock(this, input, bb)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override int getIndirection() { result = this.getSourceVariable().getIndirection() }
|
||||||
|
|
||||||
|
override predicate isCertain() {
|
||||||
|
// If this phi node is part of a phi cycle of phi nodes the least
|
||||||
|
// fixed-point semantics of datalog means we don't get the right answer.
|
||||||
|
// So we perform an SCC reduction to simulate greatest fixed-point semantics.
|
||||||
|
getCycle(this).isCertain()
|
||||||
|
or
|
||||||
|
// If there is no cycle we get the right semantics through traditional
|
||||||
|
// recursion.
|
||||||
|
not exists(getCycle(this)) and
|
||||||
|
forex(Definition inp | inp = this.getAnInput() | inp.isCertain())
|
||||||
|
}
|
||||||
|
|
||||||
|
final override Declaration getFunction() {
|
||||||
|
result = SsaImpl::PhiNode.super.getBasicBlock().getEnclosingFunction()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private PhiNode getAnInput(PhiNode phi) { result = phi.getAnInput() }
|
||||||
|
|
||||||
|
private predicate sccEdge(PhiNode phi1, PhiNode phi2) {
|
||||||
|
getAnInput(phi1) = phi2 and getAnInput+(phi2) = phi1
|
||||||
|
}
|
||||||
|
|
||||||
|
private module PhiCycleEquivalence = QlBuiltins::EquivalenceRelation<PhiNode, sccEdge/2>;
|
||||||
|
|
||||||
|
private PhiCycle getCycle(PhiNode phi) { result.getAPhiNode() = phi }
|
||||||
|
|
||||||
|
private class PhiCycle extends PhiCycleEquivalence::EquivalenceClass {
|
||||||
|
PhiNode getAPhiNode() { PhiCycleEquivalence::getEquivalenceClass(result) = this }
|
||||||
|
|
||||||
|
predicate hasPhiNode(PhiNode phi) { this.getAPhiNode() = phi }
|
||||||
|
|
||||||
|
pragma[nomagic]
|
||||||
|
Definition getAnInput() {
|
||||||
|
result = this.getAPhiNode().getAnInput() and not this.hasPhiNode(result)
|
||||||
|
}
|
||||||
|
|
||||||
|
string toString() { result = strictconcat(this.getAPhiNode().toString(), ", ") }
|
||||||
|
|
||||||
|
predicate isCertain() {
|
||||||
|
// A phi cycle is certain if all of the inputs into the phi cycle is certain.
|
||||||
|
forex(Definition inp | inp = this.getAnInput() | inp.isCertain())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** An static single assignment (SSA) definition. */
|
/** An static single assignment (SSA) definition. */
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ abstract class Indirection extends Type {
|
|||||||
*
|
*
|
||||||
* `certain` is `true` if this write is guaranteed to write to the address.
|
* `certain` is `true` if this write is guaranteed to write to the address.
|
||||||
*/
|
*/
|
||||||
predicate isAdditionalWrite(Node0Impl value, Operand address, boolean certain) { none() }
|
predicate isAdditionalWrite(Node0Impl value, Operand address, Certainty certain) { none() }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the base type of this indirection, after specifiers have been deeply
|
* Gets the base type of this indirection, after specifiers have been deeply
|
||||||
@@ -198,11 +198,11 @@ private module IteratorIndirections {
|
|||||||
baseType = super.getValueType()
|
baseType = super.getValueType()
|
||||||
}
|
}
|
||||||
|
|
||||||
override predicate isAdditionalWrite(Node0Impl value, Operand address, boolean certain) {
|
override predicate isAdditionalWrite(Node0Impl value, Operand address, Certainty certain) {
|
||||||
exists(CallInstruction call | call.getArgumentOperand(0) = value.asOperand() |
|
exists(CallInstruction call | call.getArgumentOperand(0) = value.asOperand() |
|
||||||
this = call.getStaticCallTarget().(Function).getClassAndName("operator=") and
|
this = call.getStaticCallTarget().(Function).getClassAndName("operator=") and
|
||||||
address = call.getThisArgumentOperand() and
|
address = call.getThisArgumentOperand() and
|
||||||
certain = false
|
certain instanceof AlwaysUncertain
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -271,30 +271,62 @@ predicate isDereference(Instruction deref, Operand address, boolean additional)
|
|||||||
additional = false
|
additional = false
|
||||||
}
|
}
|
||||||
|
|
||||||
predicate isWrite(Node0Impl value, Operand address, boolean certain) {
|
private newtype TCertainty =
|
||||||
|
TCertainWhenAddressIsCertain() or
|
||||||
|
TAlwaysCertain() or
|
||||||
|
TAlwaysUncertain()
|
||||||
|
|
||||||
|
abstract private class Certainty extends TCertainty {
|
||||||
|
abstract predicate isCertain(boolean addressIsCertain);
|
||||||
|
|
||||||
|
abstract string toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private class CertainWhenAddressIsCertain extends Certainty, TCertainWhenAddressIsCertain {
|
||||||
|
override predicate isCertain(boolean addressIsCertain) { addressIsCertain = true }
|
||||||
|
|
||||||
|
override string toString() { result = "CertainWhenAddressIsCertain" }
|
||||||
|
}
|
||||||
|
|
||||||
|
private class AlwaysCertain extends Certainty, TAlwaysCertain {
|
||||||
|
override predicate isCertain(boolean addressIsCertain) {
|
||||||
|
addressIsCertain = true or addressIsCertain = false
|
||||||
|
}
|
||||||
|
|
||||||
|
override string toString() { result = "AlwaysCertain" }
|
||||||
|
}
|
||||||
|
|
||||||
|
private class AlwaysUncertain extends Certainty, TAlwaysUncertain {
|
||||||
|
override predicate isCertain(boolean addressIsCertain) { none() }
|
||||||
|
|
||||||
|
override string toString() { result = "AlwaysUncertain" }
|
||||||
|
}
|
||||||
|
|
||||||
|
predicate isWrite(Node0Impl value, Operand address, Certainty certain) {
|
||||||
any(Indirection ind).isAdditionalWrite(value, address, certain)
|
any(Indirection ind).isAdditionalWrite(value, address, certain)
|
||||||
or
|
or
|
||||||
certain = true and
|
exists(StoreInstruction store |
|
||||||
(
|
value.asInstruction() = store and
|
||||||
exists(StoreInstruction store |
|
address = store.getDestinationAddressOperand() and
|
||||||
value.asInstruction() = store and
|
certain instanceof CertainWhenAddressIsCertain
|
||||||
address = store.getDestinationAddressOperand()
|
)
|
||||||
)
|
or
|
||||||
or
|
exists(InitializeParameterInstruction init |
|
||||||
exists(InitializeParameterInstruction init |
|
value.asInstruction() = init and
|
||||||
value.asInstruction() = init and
|
address = init.getAnOperand() and
|
||||||
address = init.getAnOperand()
|
certain instanceof AlwaysCertain
|
||||||
)
|
)
|
||||||
or
|
or
|
||||||
exists(InitializeDynamicAllocationInstruction init |
|
exists(InitializeDynamicAllocationInstruction init |
|
||||||
value.asInstruction() = init and
|
value.asInstruction() = init and
|
||||||
address = init.getAllocationAddressOperand()
|
address = init.getAllocationAddressOperand() and
|
||||||
)
|
certain instanceof AlwaysCertain
|
||||||
or
|
)
|
||||||
exists(UninitializedInstruction uninitialized |
|
or
|
||||||
value.asInstruction() = uninitialized and
|
exists(UninitializedInstruction uninitialized |
|
||||||
address = uninitialized.getAnOperand()
|
value.asInstruction() = uninitialized and
|
||||||
)
|
address = uninitialized.getAnOperand() and
|
||||||
|
certain instanceof AlwaysCertain
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -718,16 +750,18 @@ private module Cached {
|
|||||||
int indirectionIndex
|
int indirectionIndex
|
||||||
) {
|
) {
|
||||||
exists(
|
exists(
|
||||||
boolean writeIsCertain, boolean addressIsCertain, int ind0, CppType type, int lower, int upper
|
Certainty writeIsCertain, boolean addressIsCertain, int ind0, CppType type, int lower,
|
||||||
|
int upper
|
||||||
|
|
|
|
||||||
isWrite(value, address, writeIsCertain) and
|
isWrite(value, address, writeIsCertain) and
|
||||||
isDefImpl(address, base, ind0, addressIsCertain) and
|
isDefImpl(address, base, ind0, addressIsCertain) and
|
||||||
certain = writeIsCertain.booleanAnd(addressIsCertain) and
|
|
||||||
type = getLanguageType(address) and
|
type = getLanguageType(address) and
|
||||||
upper = countIndirectionsForCppType(type) and
|
upper = countIndirectionsForCppType(type) and
|
||||||
ind = ind0 + [lower .. upper] and
|
ind = ind0 + [lower .. upper] and
|
||||||
indirectionIndex = ind - (ind0 + lower) and
|
indirectionIndex = ind - (ind0 + lower) and
|
||||||
lower = getMinIndirectionsForType(any(Type t | type.hasUnspecifiedType(t, _)))
|
lower = getMinIndirectionsForType(any(Type t | type.hasUnspecifiedType(t, _)))
|
||||||
|
|
|
||||||
|
if writeIsCertain.isCertain(addressIsCertain) then certain = true else certain = false
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,9 @@ private class Fopen extends Function, AliasFunction, SideEffectFunction, TaintFu
|
|||||||
Fopen() {
|
Fopen() {
|
||||||
this.hasGlobalOrStdName(["fopen", "fopen_s", "freopen"])
|
this.hasGlobalOrStdName(["fopen", "fopen_s", "freopen"])
|
||||||
or
|
or
|
||||||
this.hasGlobalName(["_open", "_wfopen", "_fsopen", "_wfsopen", "_wopen"])
|
this.hasGlobalName([
|
||||||
|
"_open", "_wfopen", "_fsopen", "_wfsopen", "_wopen", "_sopen_s", "_wsopen_s"
|
||||||
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
override predicate hasOnlySpecificWriteSideEffects() { any() }
|
override predicate hasOnlySpecificWriteSideEffects() { any() }
|
||||||
@@ -46,6 +48,10 @@ private class Fopen extends Function, AliasFunction, SideEffectFunction, TaintFu
|
|||||||
this.hasGlobalName(["_open", "_wopen"]) and
|
this.hasGlobalName(["_open", "_wopen"]) and
|
||||||
i = 0 and
|
i = 0 and
|
||||||
buffer = true
|
buffer = true
|
||||||
|
or
|
||||||
|
this.hasGlobalName(["_sopen_s", "_wsopen_s"]) and
|
||||||
|
i = 1 and
|
||||||
|
buffer = true
|
||||||
}
|
}
|
||||||
|
|
||||||
override predicate hasTaintFlow(FunctionInput input, FunctionOutput output) {
|
override predicate hasTaintFlow(FunctionInput input, FunctionOutput output) {
|
||||||
@@ -64,5 +70,9 @@ private class Fopen extends Function, AliasFunction, SideEffectFunction, TaintFu
|
|||||||
this.hasGlobalName(["_open", "_wopen"]) and
|
this.hasGlobalName(["_open", "_wopen"]) and
|
||||||
input.isParameterDeref(0) and
|
input.isParameterDeref(0) and
|
||||||
output.isReturnValue()
|
output.isReturnValue()
|
||||||
|
or
|
||||||
|
this.hasGlobalName(["_sopen_s", "_wsopen_s"]) and
|
||||||
|
input.isParameterDeref(1) and
|
||||||
|
output.isParameterDeref(0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,10 @@ abstract private class ScanfFunctionModel extends ArrayFunction, TaintFunction,
|
|||||||
(
|
(
|
||||||
if exists(this.getLengthParameterIndex())
|
if exists(this.getLengthParameterIndex())
|
||||||
then result = this.getLengthParameterIndex() + 2
|
then result = this.getLengthParameterIndex() + 2
|
||||||
else result = 2
|
else
|
||||||
|
if exists(this.(ScanfFunction).getInputParameterIndex())
|
||||||
|
then result = 2
|
||||||
|
else result = 1
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,13 +72,24 @@ abstract private class ScanfFunctionModel extends ArrayFunction, TaintFunction,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private predicate hasFlowSource(
|
||||||
|
ScanfFunction func, ScanfFunctionCall call, FunctionOutput output, string description
|
||||||
|
) {
|
||||||
|
exists(int n, Expr arg |
|
||||||
|
call.getScanfFunction() = func and
|
||||||
|
call.getOutputArgument(_) = arg and
|
||||||
|
call.getArgument(n) = arg and
|
||||||
|
output.isParameterDeref(n) and
|
||||||
|
description = "value read by " + func.getName()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The standard function `scanf` and its assorted variants
|
* The standard function `scanf` and its assorted variants
|
||||||
*/
|
*/
|
||||||
private class ScanfModel extends ScanfFunctionModel, LocalFlowSourceFunction instanceof Scanf {
|
private class ScanfModel extends ScanfFunctionModel, LocalFlowSourceFunction instanceof Scanf {
|
||||||
override predicate hasLocalFlowSource(FunctionOutput output, string description) {
|
override predicate hasLocalFlowSource(Call call, FunctionOutput output, string description) {
|
||||||
output.isParameterDeref(any(int i | i >= this.getArgsStartPosition())) and
|
hasFlowSource(this, call, output, description)
|
||||||
description = "value read by " + this.getName()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,9 +97,8 @@ private class ScanfModel extends ScanfFunctionModel, LocalFlowSourceFunction ins
|
|||||||
* The standard function `fscanf` and its assorted variants
|
* The standard function `fscanf` and its assorted variants
|
||||||
*/
|
*/
|
||||||
private class FscanfModel extends ScanfFunctionModel, RemoteFlowSourceFunction instanceof Fscanf {
|
private class FscanfModel extends ScanfFunctionModel, RemoteFlowSourceFunction instanceof Fscanf {
|
||||||
override predicate hasRemoteFlowSource(FunctionOutput output, string description) {
|
override predicate hasRemoteFlowSource(Call call, FunctionOutput output, string description) {
|
||||||
output.isParameterDeref(any(int i | i >= this.getArgsStartPosition())) and
|
hasFlowSource(this, call, output, description)
|
||||||
description = "value read by " + this.getName()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override predicate hasSocketInput(FunctionInput input) {
|
override predicate hasSocketInput(FunctionInput input) {
|
||||||
|
|||||||
@@ -18,7 +18,17 @@ abstract class RemoteFlowSourceFunction extends Function {
|
|||||||
/**
|
/**
|
||||||
* Holds if remote data described by `description` flows from `output` of a call to this function.
|
* Holds if remote data described by `description` flows from `output` of a call to this function.
|
||||||
*/
|
*/
|
||||||
abstract predicate hasRemoteFlowSource(FunctionOutput output, string description);
|
predicate hasRemoteFlowSource(FunctionOutput output, string description) {
|
||||||
|
this.hasRemoteFlowSource(_, output, description)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holds if remote data described by `description` flows from `output` of `call` to this function.
|
||||||
|
*/
|
||||||
|
predicate hasRemoteFlowSource(Call call, FunctionOutput output, string description) {
|
||||||
|
call.getTarget() = this and
|
||||||
|
this.hasRemoteFlowSource(output, description)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds if remote data from this source comes from a socket or stream
|
* Holds if remote data from this source comes from a socket or stream
|
||||||
@@ -35,7 +45,17 @@ abstract class LocalFlowSourceFunction extends Function {
|
|||||||
/**
|
/**
|
||||||
* Holds if data described by `description` flows from `output` of a call to this function.
|
* Holds if data described by `description` flows from `output` of a call to this function.
|
||||||
*/
|
*/
|
||||||
abstract predicate hasLocalFlowSource(FunctionOutput output, string description);
|
predicate hasLocalFlowSource(FunctionOutput output, string description) {
|
||||||
|
this.hasLocalFlowSource(_, output, description)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holds if data described by `description` flows from `output` of `call` to this function.
|
||||||
|
*/
|
||||||
|
predicate hasLocalFlowSource(Call call, FunctionOutput output, string description) {
|
||||||
|
call.getTarget() = this and
|
||||||
|
this.hasLocalFlowSource(output, description)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** A library function that sends data over a network connection. */
|
/** A library function that sends data over a network connection. */
|
||||||
|
|||||||
@@ -28,8 +28,7 @@ private class RemoteModelSource extends RemoteFlowSource {
|
|||||||
|
|
||||||
RemoteModelSource() {
|
RemoteModelSource() {
|
||||||
exists(CallInstruction call, RemoteFlowSourceFunction func, FunctionOutput output |
|
exists(CallInstruction call, RemoteFlowSourceFunction func, FunctionOutput output |
|
||||||
call.getStaticCallTarget() = func and
|
func.hasRemoteFlowSource(call.getConvertedResultExpression(), output, sourceType) and
|
||||||
func.hasRemoteFlowSource(output, sourceType) and
|
|
||||||
this = callOutput(call, output)
|
this = callOutput(call, output)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -46,7 +45,7 @@ private class LocalModelSource extends LocalFlowSource {
|
|||||||
LocalModelSource() {
|
LocalModelSource() {
|
||||||
exists(CallInstruction call, LocalFlowSourceFunction func, FunctionOutput output |
|
exists(CallInstruction call, LocalFlowSourceFunction func, FunctionOutput output |
|
||||||
call.getStaticCallTarget() = func and
|
call.getStaticCallTarget() = func and
|
||||||
func.hasLocalFlowSource(output, sourceType) and
|
func.hasLocalFlowSource(call.getConvertedResultExpression(), output, sourceType) and
|
||||||
this = callOutput(call, output)
|
this = callOutput(call, output)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -912,6 +912,10 @@ class_template_argument_value(
|
|||||||
int index: int ref,
|
int index: int ref,
|
||||||
int arg_value: @expr ref
|
int arg_value: @expr ref
|
||||||
);
|
);
|
||||||
|
class_template_generated_from(
|
||||||
|
unique int template: @usertype ref,
|
||||||
|
int from: @usertype ref
|
||||||
|
)
|
||||||
|
|
||||||
@user_or_decltype = @usertype | @decltype;
|
@user_or_decltype = @usertype | @decltype;
|
||||||
|
|
||||||
@@ -943,6 +947,10 @@ function_template_argument_value(
|
|||||||
int index: int ref,
|
int index: int ref,
|
||||||
int arg_value: @expr ref
|
int arg_value: @expr ref
|
||||||
);
|
);
|
||||||
|
function_template_generated_from(
|
||||||
|
unique int template: @function ref,
|
||||||
|
int from: @function ref
|
||||||
|
);
|
||||||
|
|
||||||
is_variable_template(unique int id: @variable ref);
|
is_variable_template(unique int id: @variable ref);
|
||||||
variable_instantiation(
|
variable_instantiation(
|
||||||
@@ -959,6 +967,30 @@ variable_template_argument_value(
|
|||||||
int index: int ref,
|
int index: int ref,
|
||||||
int arg_value: @expr ref
|
int arg_value: @expr ref
|
||||||
);
|
);
|
||||||
|
variable_template_generated_from(
|
||||||
|
unique int template: @variable ref,
|
||||||
|
int from: @variable ref
|
||||||
|
);
|
||||||
|
|
||||||
|
is_alias_template(unique int id: @usertype ref);
|
||||||
|
alias_instantiation(
|
||||||
|
unique int to: @usertype ref,
|
||||||
|
int from: @usertype ref
|
||||||
|
);
|
||||||
|
alias_template_argument(
|
||||||
|
int type_id: @usertype ref,
|
||||||
|
int index: int ref,
|
||||||
|
int arg_type: @type ref
|
||||||
|
);
|
||||||
|
alias_template_argument_value(
|
||||||
|
int type_id: @usertype ref,
|
||||||
|
int index: int ref,
|
||||||
|
int arg_value: @expr ref
|
||||||
|
);
|
||||||
|
alias_template_generated_from(
|
||||||
|
unique int template: @usertype ref,
|
||||||
|
int from: @usertype ref
|
||||||
|
);
|
||||||
|
|
||||||
template_template_instantiation(
|
template_template_instantiation(
|
||||||
int to: @usertype ref,
|
int to: @usertype ref,
|
||||||
@@ -1398,7 +1430,8 @@ specialnamequalifyingelements(
|
|||||||
@namequalifyingelement = @namespace
|
@namequalifyingelement = @namespace
|
||||||
| @specialnamequalifyingelement
|
| @specialnamequalifyingelement
|
||||||
| @usertype
|
| @usertype
|
||||||
| @decltype;
|
| @decltype
|
||||||
|
| @derivedtype;
|
||||||
|
|
||||||
namequalifiers(
|
namequalifiers(
|
||||||
unique int id: @namequalifier,
|
unique int id: @namequalifier,
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,2 @@
|
|||||||
|
description: Support alias templates
|
||||||
|
compatibility: backwards
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,2 @@
|
|||||||
|
description: Capture information about one template being generated from another
|
||||||
|
compatibility: backwards
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,2 @@
|
|||||||
|
description: Fix NameQualifier inconsistency
|
||||||
|
compatibility: full
|
||||||
@@ -1,3 +1,7 @@
|
|||||||
|
## 1.6.4
|
||||||
|
|
||||||
|
No user-facing changes.
|
||||||
|
|
||||||
## 1.6.3
|
## 1.6.3
|
||||||
|
|
||||||
### Minor Analysis Improvements
|
### Minor Analysis Improvements
|
||||||
|
|||||||
@@ -44,10 +44,7 @@ class ExternalApiDataNode extends DataFlow::Node {
|
|||||||
/** A configuration for tracking flow from `RemoteFlowSource`s to `ExternalApiDataNode`s. */
|
/** A configuration for tracking flow from `RemoteFlowSource`s to `ExternalApiDataNode`s. */
|
||||||
private module UntrustedDataToExternalApiConfig implements DataFlow::ConfigSig {
|
private module UntrustedDataToExternalApiConfig implements DataFlow::ConfigSig {
|
||||||
predicate isSource(DataFlow::Node source) {
|
predicate isSource(DataFlow::Node source) {
|
||||||
exists(RemoteFlowSourceFunction remoteFlow |
|
any(RemoteFlowSourceFunction remoteFlow).hasRemoteFlowSource(source.asExpr(), _, _)
|
||||||
remoteFlow = source.asExpr().(Call).getTarget() and
|
|
||||||
remoteFlow.hasRemoteFlowSource(_, _)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
predicate isSink(DataFlow::Node sink) { sink instanceof ExternalApiDataNode }
|
predicate isSink(DataFlow::Node sink) { sink instanceof ExternalApiDataNode }
|
||||||
|
|||||||
@@ -94,9 +94,8 @@ class Recv extends SendRecv instanceof RemoteFlowSourceFunction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override Expr getDataExpr(Call call) {
|
override Expr getDataExpr(Call call) {
|
||||||
call.getTarget() = this and
|
|
||||||
exists(FunctionOutput output, int arg |
|
exists(FunctionOutput output, int arg |
|
||||||
super.hasRemoteFlowSource(output, _) and
|
super.hasRemoteFlowSource(call, output, _) and
|
||||||
output.isParameterDeref(arg) and
|
output.isParameterDeref(arg) and
|
||||||
result = call.getArgument(arg)
|
result = call.getArgument(arg)
|
||||||
)
|
)
|
||||||
|
|||||||
3
cpp/ql/src/change-notes/released/1.6.4.md
Normal file
3
cpp/ql/src/change-notes/released/1.6.4.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
## 1.6.4
|
||||||
|
|
||||||
|
No user-facing changes.
|
||||||
@@ -1,2 +1,2 @@
|
|||||||
---
|
---
|
||||||
lastReleaseVersion: 1.6.3
|
lastReleaseVersion: 1.6.4
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
name: codeql/cpp-queries
|
name: codeql/cpp-queries
|
||||||
version: 1.6.3
|
version: 1.6.5-dev
|
||||||
groups:
|
groups:
|
||||||
- cpp
|
- cpp
|
||||||
- queries
|
- queries
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
jsf/4.13 Functions/AV Rule 107.ql
|
query: jsf/4.13 Functions/AV Rule 107.ql
|
||||||
|
postprocess: utils/test/InlineExpectationsTestQuery.ql
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
Best Practices/Hiding/LocalVariableHidesGlobalVariable.ql
|
query: Best Practices/Hiding/LocalVariableHidesGlobalVariable.ql
|
||||||
|
postprocess: utils/test/InlineExpectationsTestQuery.ql
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ void test1()
|
|||||||
|
|
||||||
void test2()
|
void test2()
|
||||||
{
|
{
|
||||||
Lock<Mutex> myLock(); // BAD (interpreted as a function declaration, this does nothing)
|
Lock<Mutex> myLock(); // BAD (interpreted as a function declaration, this does nothing) // $ Alert[cpp/function-in-block]
|
||||||
|
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
@@ -62,14 +62,14 @@ void test3()
|
|||||||
|
|
||||||
void test4()
|
void test4()
|
||||||
{
|
{
|
||||||
Lock<Mutex>(myMutex); // BAD (creates an uninitialized variable called `myMutex`, probably not intended)
|
Lock<Mutex>(myMutex); // BAD (creates an uninitialized variable called `myMutex`, probably not intended) // $ Alert[cpp/local-variable-hides-global-variable]
|
||||||
|
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
|
|
||||||
void test5()
|
void test5()
|
||||||
{
|
{
|
||||||
Lock<Mutex> myLock(Mutex); // BAD (interpreted as a function declaration, this does nothing)
|
Lock<Mutex> myLock(Mutex); // BAD (interpreted as a function declaration, this does nothing) // $ Alert[cpp/function-in-block]
|
||||||
|
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
semmle/code/cpp/PrintAST.ql
|
query: semmle/code/cpp/PrintAST.ql
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
experimental/Security/CWE/CWE-020/NoCheckBeforeUnsafePutUser.ql
|
query: experimental/Security/CWE/CWE-020/NoCheckBeforeUnsafePutUser.ql
|
||||||
|
postprocess: utils/test/InlineExpectationsTestQuery.ql
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
experimental/Security/CWE/CWE-020/LateCheckOfFunctionArgument.ql
|
query: experimental/Security/CWE/CWE-020/LateCheckOfFunctionArgument.ql
|
||||||
|
postprocess: utils/test/InlineExpectationsTestQuery.ql
|
||||||
|
|||||||
@@ -3,6 +3,6 @@ void workFunction_0(char *s) {
|
|||||||
char buf[80], buf1[8];
|
char buf[80], buf1[8];
|
||||||
if(len<0) return;
|
if(len<0) return;
|
||||||
memset(buf,0,len); //GOOD
|
memset(buf,0,len); //GOOD
|
||||||
memset(buf1,0,len1); //BAD
|
memset(buf1,0,len1); //BAD // $ Alert
|
||||||
if(len1<0) return;
|
if(len1<0) return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
experimental/Security/CWE/CWE-078/WordexpTainted.ql
|
query: experimental/Security/CWE/CWE-078/WordexpTainted.ql
|
||||||
|
postprocess: utils/test/InlineExpectationsTestQuery.ql
|
||||||
|
|||||||
@@ -19,14 +19,14 @@ enum {
|
|||||||
|
|
||||||
int wordexp(const char *restrict s, wordexp_t *restrict p, int flags);
|
int wordexp(const char *restrict s, wordexp_t *restrict p, int flags);
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) { // $ Source
|
||||||
char *filePath = argv[2];
|
char *filePath = argv[2];
|
||||||
|
|
||||||
{
|
{
|
||||||
// BAD: the user string is injected directly into `wordexp` which performs command substitution
|
// BAD: the user string is injected directly into `wordexp` which performs command substitution
|
||||||
|
|
||||||
wordexp_t we;
|
wordexp_t we;
|
||||||
wordexp(filePath, &we, 0);
|
wordexp(filePath, &we, 0); // $ Alert
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
experimental/Security/CWE/CWE-1041/FindWrapperFunctions.ql
|
query: experimental/Security/CWE/CWE-1041/FindWrapperFunctions.ql
|
||||||
|
postprocess: utils/test/InlineExpectationsTestQuery.ql
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ void myFclose(FILE * fmy)
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
fe = fopen("myFile.txt", "wt");
|
fe = fopen("myFile.txt", "wt");
|
||||||
fclose(fe); // BAD
|
fclose(fe); // BAD // $ Alert
|
||||||
fe = fopen("myFile.txt", "wt");
|
fe = fopen("myFile.txt", "wt");
|
||||||
myFclose(fe); // GOOD
|
myFclose(fe); // GOOD
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
experimental/Security/CWE/CWE-1126/DeclarationOfVariableWithUnnecessarilyWideScope.ql
|
query: experimental/Security/CWE/CWE-1126/DeclarationOfVariableWithUnnecessarilyWideScope.ql
|
||||||
|
postprocess: utils/test/InlineExpectationsTestQuery.ql
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ void workFunction_0(char *s) {
|
|||||||
while(intIndex > 2)
|
while(intIndex > 2)
|
||||||
{
|
{
|
||||||
buf[intIndex] = 1;
|
buf[intIndex] = 1;
|
||||||
int intIndex; // BAD
|
int intIndex; // BAD // $ Alert
|
||||||
intIndex--;
|
intIndex--;
|
||||||
}
|
}
|
||||||
intIndex = 10;
|
intIndex = 10;
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
experimental/Security/CWE/CWE-1240/CustomCryptographicPrimitive.ql
|
query: experimental/Security/CWE/CWE-1240/CustomCryptographicPrimitive.ql
|
||||||
|
postprocess: utils/test/InlineExpectationsTestQuery.ql
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ int strlen(const char *string);
|
|||||||
|
|
||||||
// the following function is homebrew crypto written for this test. This is a bad algorithm
|
// the following function is homebrew crypto written for this test. This is a bad algorithm
|
||||||
// on multiple levels and should never be used in cryptography.
|
// on multiple levels and should never be used in cryptography.
|
||||||
void encryptString(char *string, unsigned int key) {
|
void encryptString(char *string, unsigned int key) { // $ Alert
|
||||||
char *ptr = string;
|
char *ptr = string;
|
||||||
int len = strlen(string);
|
int len = strlen(string);
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ void encryptString(char *string, unsigned int key) {
|
|||||||
|
|
||||||
// the following function is homebrew crypto written for this test. This is a bad algorithm
|
// the following function is homebrew crypto written for this test. This is a bad algorithm
|
||||||
// on multiple levels and should never be used in cryptography.
|
// on multiple levels and should never be used in cryptography.
|
||||||
void MyEncrypt(const unsigned int *dataIn, unsigned int *dataOut, unsigned int dataSize, unsigned int key[2]) {
|
void MyEncrypt(const unsigned int *dataIn, unsigned int *dataOut, unsigned int dataSize, unsigned int key[2]) { // $ Alert
|
||||||
unsigned int state[2];
|
unsigned int state[2];
|
||||||
unsigned int t;
|
unsigned int t;
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ void MyEncrypt(const unsigned int *dataIn, unsigned int *dataOut, unsigned int d
|
|||||||
// the following function resembles an implementation of the AES "mix columns"
|
// the following function resembles an implementation of the AES "mix columns"
|
||||||
// step. It is not accurate, efficient or safe and should never be used in
|
// step. It is not accurate, efficient or safe and should never be used in
|
||||||
// cryptography.
|
// cryptography.
|
||||||
void mix_columns(const uint8_t inputs[4], uint8_t outputs[4]) {
|
void mix_columns(const uint8_t inputs[4], uint8_t outputs[4]) { // $ Alert
|
||||||
// The "mix columns" step takes four bytes as inputs. Each byte represents a
|
// The "mix columns" step takes four bytes as inputs. Each byte represents a
|
||||||
// polynomial with 8 one-bit coefficients, e.g. input bits 00001101
|
// polynomial with 8 one-bit coefficients, e.g. input bits 00001101
|
||||||
// represent the polynomial x^3 + x^2 + 1. Arithmetic is reduced modulo
|
// represent the polynomial x^3 + x^2 + 1. Arithmetic is reduced modulo
|
||||||
@@ -80,7 +80,7 @@ void mix_columns(const uint8_t inputs[4], uint8_t outputs[4]) {
|
|||||||
// the following function resembles initialization of an S-box as may be done
|
// the following function resembles initialization of an S-box as may be done
|
||||||
// in an implementation of DES, AES and other encryption algorithms. It is not
|
// in an implementation of DES, AES and other encryption algorithms. It is not
|
||||||
// accurate, efficient or safe and should never be used in cryptography.
|
// accurate, efficient or safe and should never be used in cryptography.
|
||||||
void init_aes_sbox(unsigned char data[256]) {
|
void init_aes_sbox(unsigned char data[256]) { // $ Alert
|
||||||
// initialize `data` in a loop using lots of ^, ^= and << operations and
|
// initialize `data` in a loop using lots of ^, ^= and << operations and
|
||||||
// a few fixed constants.
|
// a few fixed constants.
|
||||||
unsigned int state = 0x12345678;
|
unsigned int state = 0x12345678;
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
experimental/Security/CWE/CWE-125/DangerousWorksWithMultibyteOrWideCharacters.ql
|
query: experimental/Security/CWE/CWE-125/DangerousWorksWithMultibyteOrWideCharacters.ql
|
||||||
|
postprocess: utils/test/InlineExpectationsTestQuery.ql
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ static void badTest1(const char* ptr)
|
|||||||
int ret;
|
int ret;
|
||||||
int len;
|
int len;
|
||||||
len = strlen(ptr);
|
len = strlen(ptr);
|
||||||
for (wchar_t wc; (ret = mbtowc(&wc, ptr, 4)) > 0; len-=ret) { // BAD:we can get unpredictable results
|
for (wchar_t wc; (ret = mbtowc(&wc, ptr, 4)) > 0; len-=ret) { // BAD:we can get unpredictable results // $ Alert
|
||||||
wprintf(L"%lc", wc);
|
wprintf(L"%lc", wc);
|
||||||
ptr += ret;
|
ptr += ret;
|
||||||
}
|
}
|
||||||
@@ -73,7 +73,7 @@ static void badTest2(const char* ptr)
|
|||||||
int ret;
|
int ret;
|
||||||
int len;
|
int len;
|
||||||
len = strlen(ptr);
|
len = strlen(ptr);
|
||||||
for (wchar_t wc; (ret = mbtowc(&wc, ptr, sizeof(wchar_t))) > 0; len-=ret) { // BAD:we can get unpredictable results
|
for (wchar_t wc; (ret = mbtowc(&wc, ptr, sizeof(wchar_t))) > 0; len-=ret) { // BAD:we can get unpredictable results // $ Alert
|
||||||
wprintf(L"%lc", wc);
|
wprintf(L"%lc", wc);
|
||||||
ptr += ret;
|
ptr += ret;
|
||||||
}
|
}
|
||||||
@@ -103,7 +103,7 @@ static void badTest3(const char* ptr,int wc_len)
|
|||||||
len = wc_len;
|
len = wc_len;
|
||||||
wchar_t *wc = new wchar_t[wc_len];
|
wchar_t *wc = new wchar_t[wc_len];
|
||||||
while (*ptr && len > 0) {
|
while (*ptr && len > 0) {
|
||||||
ret = mbtowc(wc, ptr, MB_CUR_MAX); // BAD
|
ret = mbtowc(wc, ptr, MB_CUR_MAX); // BAD // $ Alert
|
||||||
if (ret <0)
|
if (ret <0)
|
||||||
break;
|
break;
|
||||||
if (ret == 0 || ret > len)
|
if (ret == 0 || ret > len)
|
||||||
@@ -120,7 +120,7 @@ static void badTest4(const char* ptr,int wc_len)
|
|||||||
len = wc_len;
|
len = wc_len;
|
||||||
wchar_t *wc = new wchar_t[wc_len];
|
wchar_t *wc = new wchar_t[wc_len];
|
||||||
while (*ptr && len > 0) {
|
while (*ptr && len > 0) {
|
||||||
ret = mbtowc(wc, ptr, 16); // BAD
|
ret = mbtowc(wc, ptr, 16); // BAD // $ Alert
|
||||||
if (ret <0)
|
if (ret <0)
|
||||||
break;
|
break;
|
||||||
if (ret == 0 || ret > len)
|
if (ret == 0 || ret > len)
|
||||||
@@ -137,7 +137,7 @@ static void badTest5(const char* ptr,int wc_len)
|
|||||||
len = wc_len;
|
len = wc_len;
|
||||||
wchar_t *wc = new wchar_t[wc_len];
|
wchar_t *wc = new wchar_t[wc_len];
|
||||||
while (*ptr && len > 0) {
|
while (*ptr && len > 0) {
|
||||||
ret = mbtowc(wc, ptr, sizeof(wchar_t)); // BAD
|
ret = mbtowc(wc, ptr, sizeof(wchar_t)); // BAD // $ Alert
|
||||||
if (ret <0)
|
if (ret <0)
|
||||||
break;
|
break;
|
||||||
if (ret == 0 || ret > len)
|
if (ret == 0 || ret > len)
|
||||||
@@ -155,7 +155,7 @@ static void badTest6(const char* ptr,int wc_len)
|
|||||||
len = wc_len;
|
len = wc_len;
|
||||||
wchar_t *wc = new wchar_t[wc_len];
|
wchar_t *wc = new wchar_t[wc_len];
|
||||||
while (*ptr && wc_len > 0) {
|
while (*ptr && wc_len > 0) {
|
||||||
ret = mbtowc(wc, ptr, wc_len); // BAD
|
ret = mbtowc(wc, ptr, wc_len); // BAD // $ Alert
|
||||||
if (ret <0)
|
if (ret <0)
|
||||||
if (checkErrors()) {
|
if (checkErrors()) {
|
||||||
++ptr;
|
++ptr;
|
||||||
@@ -178,7 +178,7 @@ static void badTest7(const char* ptr,int wc_len)
|
|||||||
len = wc_len;
|
len = wc_len;
|
||||||
wchar_t *wc = new wchar_t[wc_len];
|
wchar_t *wc = new wchar_t[wc_len];
|
||||||
while (*ptr && wc_len > 0) {
|
while (*ptr && wc_len > 0) {
|
||||||
ret = mbtowc(wc, ptr, len); // BAD
|
ret = mbtowc(wc, ptr, len); // BAD // $ Alert
|
||||||
if (ret <0)
|
if (ret <0)
|
||||||
break;
|
break;
|
||||||
if (ret == 0 || ret > len)
|
if (ret == 0 || ret > len)
|
||||||
@@ -194,7 +194,7 @@ static void badTest8(const char* ptr,wchar_t *wc)
|
|||||||
int len;
|
int len;
|
||||||
len = strlen(ptr);
|
len = strlen(ptr);
|
||||||
while (*ptr && len > 0) {
|
while (*ptr && len > 0) {
|
||||||
ret = mbtowc(wc, ptr, len); // BAD
|
ret = mbtowc(wc, ptr, len); // BAD // $ Alert
|
||||||
if (ret <0)
|
if (ret <0)
|
||||||
break;
|
break;
|
||||||
if (ret == 0 || ret > len)
|
if (ret == 0 || ret > len)
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ void* calloc (size_t num, size_t size);
|
|||||||
void* malloc (size_t size);
|
void* malloc (size_t size);
|
||||||
|
|
||||||
static void badTest1(void *src, int size) {
|
static void badTest1(void *src, int size) {
|
||||||
WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)src, -1, (LPSTR)src, size, 0, 0); // BAD
|
WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)src, -1, (LPSTR)src, size, 0, 0); // BAD // $ Alert
|
||||||
MultiByteToWideChar(CP_ACP, 0, (LPCSTR)src, -1, (LPCWSTR)src, 30); // BAD
|
MultiByteToWideChar(CP_ACP, 0, (LPCSTR)src, -1, (LPCWSTR)src, 30); // BAD // $ Alert
|
||||||
}
|
}
|
||||||
void goodTest2(){
|
void goodTest2(){
|
||||||
wchar_t src[] = L"0123456789ABCDEF";
|
wchar_t src[] = L"0123456789ABCDEF";
|
||||||
@@ -42,7 +42,7 @@ void goodTest2(){
|
|||||||
static void badTest2(){
|
static void badTest2(){
|
||||||
wchar_t src[] = L"0123456789ABCDEF";
|
wchar_t src[] = L"0123456789ABCDEF";
|
||||||
char dst[16];
|
char dst[16];
|
||||||
WideCharToMultiByte(CP_UTF8, 0, src, -1, dst, 16, NULL, NULL); // BAD
|
WideCharToMultiByte(CP_UTF8, 0, src, -1, dst, 16, NULL, NULL); // BAD // $ Alert
|
||||||
printf("%s\n", dst);
|
printf("%s\n", dst);
|
||||||
}
|
}
|
||||||
static void goodTest3(){
|
static void goodTest3(){
|
||||||
@@ -55,7 +55,7 @@ static void badTest3(){
|
|||||||
char src[] = "0123456789ABCDEF";
|
char src[] = "0123456789ABCDEF";
|
||||||
int size = MultiByteToWideChar(CP_UTF8, 0, src,sizeof(src),NULL,0);
|
int size = MultiByteToWideChar(CP_UTF8, 0, src,sizeof(src),NULL,0);
|
||||||
wchar_t * dst = (wchar_t*)calloc(size + 1, 1);
|
wchar_t * dst = (wchar_t*)calloc(size + 1, 1);
|
||||||
MultiByteToWideChar(CP_UTF8, 0, src, -1, dst, size+1); // BAD
|
MultiByteToWideChar(CP_UTF8, 0, src, -1, dst, size+1); // BAD // $ Alert
|
||||||
}
|
}
|
||||||
static void goodTest4(){
|
static void goodTest4(){
|
||||||
char src[] = "0123456789ABCDEF";
|
char src[] = "0123456789ABCDEF";
|
||||||
@@ -67,13 +67,13 @@ static void badTest4(){
|
|||||||
char src[] = "0123456789ABCDEF";
|
char src[] = "0123456789ABCDEF";
|
||||||
int size = MultiByteToWideChar(CP_UTF8, 0, src,sizeof(src),NULL,0);
|
int size = MultiByteToWideChar(CP_UTF8, 0, src,sizeof(src),NULL,0);
|
||||||
wchar_t * dst = (wchar_t*)malloc(size + 1);
|
wchar_t * dst = (wchar_t*)malloc(size + 1);
|
||||||
MultiByteToWideChar(CP_UTF8, 0, src, -1, dst, size+1); // BAD
|
MultiByteToWideChar(CP_UTF8, 0, src, -1, dst, size+1); // BAD // $ Alert
|
||||||
}
|
}
|
||||||
static int goodTest5(void *src){
|
static int goodTest5(void *src){
|
||||||
return WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)src, -1, 0, 0, 0, 0); // GOOD
|
return WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)src, -1, 0, 0, 0, 0); // GOOD
|
||||||
}
|
}
|
||||||
static int badTest5 (void *src) {
|
static int badTest5 (void *src) {
|
||||||
return WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)src, -1, 0, 3, 0, 0); // BAD
|
return WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)src, -1, 0, 3, 0, 0); // BAD // $ Alert
|
||||||
}
|
}
|
||||||
static void goodTest6(WCHAR *src)
|
static void goodTest6(WCHAR *src)
|
||||||
{
|
{
|
||||||
@@ -90,6 +90,6 @@ static void goodTest6(WCHAR *src)
|
|||||||
static void badTest6(WCHAR *src)
|
static void badTest6(WCHAR *src)
|
||||||
{
|
{
|
||||||
char dst[5] ="";
|
char dst[5] ="";
|
||||||
WideCharToMultiByte(CP_ACP, 0, src, -1, dst, 260, 0, 0); // BAD
|
WideCharToMultiByte(CP_ACP, 0, src, -1, dst, 260, 0, 0); // BAD // $ Alert
|
||||||
printf("%s\n", dst);
|
printf("%s\n", dst);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,11 +12,11 @@ size_t mbsrtowcs(wchar_t *wcstr,const char *mbstr,size_t count, mbstate_t *mbsta
|
|||||||
|
|
||||||
|
|
||||||
static void badTest1(void *src, int size) {
|
static void badTest1(void *src, int size) {
|
||||||
mbstowcs((wchar_t*)src,(char*)src,size); // BAD
|
mbstowcs((wchar_t*)src,(char*)src,size); // BAD // $ Alert
|
||||||
_locale_t locale;
|
_locale_t locale;
|
||||||
_mbstowcs_l((wchar_t*)src,(char*)src,size,locale); // BAD
|
_mbstowcs_l((wchar_t*)src,(char*)src,size,locale); // BAD // $ Alert
|
||||||
mbstate_t *mbstate;
|
mbstate_t *mbstate;
|
||||||
mbsrtowcs((wchar_t*)src,(char*)src,size,mbstate); // BAD
|
mbsrtowcs((wchar_t*)src,(char*)src,size,mbstate); // BAD // $ Alert
|
||||||
}
|
}
|
||||||
static void goodTest2(){
|
static void goodTest2(){
|
||||||
char src[] = "0123456789ABCDEF";
|
char src[] = "0123456789ABCDEF";
|
||||||
@@ -32,7 +32,7 @@ static void goodTest2(){
|
|||||||
static void badTest2(){
|
static void badTest2(){
|
||||||
char src[] = "0123456789ABCDEF";
|
char src[] = "0123456789ABCDEF";
|
||||||
wchar_t dst[16];
|
wchar_t dst[16];
|
||||||
mbstowcs(dst, src,16); // BAD
|
mbstowcs(dst, src,16); // BAD // $ Alert
|
||||||
printf("%s\n", dst);
|
printf("%s\n", dst);
|
||||||
}
|
}
|
||||||
static void goodTest3(){
|
static void goodTest3(){
|
||||||
@@ -45,7 +45,7 @@ static void badTest3(){
|
|||||||
char src[] = "0123456789ABCDEF";
|
char src[] = "0123456789ABCDEF";
|
||||||
int size = mbstowcs(NULL, src,NULL);
|
int size = mbstowcs(NULL, src,NULL);
|
||||||
wchar_t * dst = (wchar_t*)calloc(size + 1, 1);
|
wchar_t * dst = (wchar_t*)calloc(size + 1, 1);
|
||||||
mbstowcs(dst, src,size+1); // BAD
|
mbstowcs(dst, src,size+1); // BAD // $ Alert
|
||||||
}
|
}
|
||||||
static void goodTest4(){
|
static void goodTest4(){
|
||||||
char src[] = "0123456789ABCDEF";
|
char src[] = "0123456789ABCDEF";
|
||||||
@@ -57,13 +57,13 @@ static void badTest4(){
|
|||||||
char src[] = "0123456789ABCDEF";
|
char src[] = "0123456789ABCDEF";
|
||||||
int size = mbstowcs(NULL, src,NULL);
|
int size = mbstowcs(NULL, src,NULL);
|
||||||
wchar_t * dst = (wchar_t*)malloc(size + 1);
|
wchar_t * dst = (wchar_t*)malloc(size + 1);
|
||||||
mbstowcs(dst, src,size+1); // BAD
|
mbstowcs(dst, src,size+1); // BAD // $ Alert
|
||||||
}
|
}
|
||||||
static int goodTest5(void *src){
|
static int goodTest5(void *src){
|
||||||
return mbstowcs(NULL, (char*)src,NULL); // GOOD
|
return mbstowcs(NULL, (char*)src,NULL); // GOOD
|
||||||
}
|
}
|
||||||
static int badTest5 (void *src) {
|
static int badTest5 (void *src) {
|
||||||
return mbstowcs(NULL, (char*)src,3); // BAD
|
return mbstowcs(NULL, (char*)src,3); // BAD // $ Alert
|
||||||
}
|
}
|
||||||
static void goodTest6(void *src){
|
static void goodTest6(void *src){
|
||||||
wchar_t dst[5];
|
wchar_t dst[5];
|
||||||
@@ -77,6 +77,6 @@ static void goodTest6(void *src){
|
|||||||
}
|
}
|
||||||
static void badTest6(void *src){
|
static void badTest6(void *src){
|
||||||
wchar_t dst[5];
|
wchar_t dst[5];
|
||||||
mbstowcs(dst, (char*)src,260); // BAD
|
mbstowcs(dst, (char*)src,260); // BAD // $ Alert
|
||||||
printf("%s\n", dst);
|
printf("%s\n", dst);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ static size_t badTest1(unsigned char *src){
|
|||||||
int cb = 0;
|
int cb = 0;
|
||||||
unsigned char dst[50];
|
unsigned char dst[50];
|
||||||
while( cb < sizeof(dst) )
|
while( cb < sizeof(dst) )
|
||||||
dst[cb++]=*src++; // BAD
|
dst[cb++]=*src++; // BAD // $ Alert
|
||||||
return _mbclen(dst);
|
return _mbclen(dst);
|
||||||
}
|
}
|
||||||
static void goodTest2(unsigned char *src){
|
static void goodTest2(unsigned char *src){
|
||||||
@@ -33,7 +33,7 @@ static void badTest2(unsigned char *src){
|
|||||||
unsigned char dst[50];
|
unsigned char dst[50];
|
||||||
while( cb < sizeof(dst) )
|
while( cb < sizeof(dst) )
|
||||||
{
|
{
|
||||||
_mbccpy(dst+cb,src); // BAD
|
_mbccpy(dst+cb,src); // BAD // $ Alert
|
||||||
cb+=_mbclen(src);
|
cb+=_mbclen(src);
|
||||||
src=_mbsinc(src);
|
src=_mbsinc(src);
|
||||||
}
|
}
|
||||||
@@ -44,5 +44,5 @@ static void goodTest3(){
|
|||||||
}
|
}
|
||||||
static void badTest3(){
|
static void badTest3(){
|
||||||
wchar_t name[50];
|
wchar_t name[50];
|
||||||
name[sizeof(name) - 1] = L'\0'; // BAD
|
name[sizeof(name) - 1] = L'\0'; // BAD // $ Alert
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
experimental/Security/CWE/CWE-190/AllocMultiplicationOverflow.ql
|
query: experimental/Security/CWE/CWE-190/AllocMultiplicationOverflow.ql
|
||||||
|
postprocess: utils/test/InlineExpectationsTestQuery.ql
|
||||||
|
|||||||
@@ -10,31 +10,31 @@ void test()
|
|||||||
int y = getAnInt();
|
int y = getAnInt();
|
||||||
|
|
||||||
char *buffer1 = (char *)malloc(x + y); // GOOD
|
char *buffer1 = (char *)malloc(x + y); // GOOD
|
||||||
char *buffer2 = (char *)malloc(x * y); // BAD
|
char *buffer2 = (char *)malloc(x * y); // BAD // $ Alert
|
||||||
int *buffer3 = (int *)malloc(x * sizeof(int)); // GOOD
|
int *buffer3 = (int *)malloc(x * sizeof(int)); // GOOD
|
||||||
int *buffer4 = (int *)malloc(x * y * sizeof(int)); // BAD
|
int *buffer4 = (int *)malloc(x * y * sizeof(int)); // BAD // $ Alert
|
||||||
|
|
||||||
if ((x <= 1000) && (y <= 1000))
|
if ((x <= 1000) && (y <= 1000))
|
||||||
{
|
{
|
||||||
char *buffer5 = (char *)malloc(x * y); // GOOD [FALSE POSITIVE]
|
char *buffer5 = (char *)malloc(x * y); // GOOD [FALSE POSITIVE] // $ Alert
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t size1 = x * y;
|
size_t size1 = x * y; // $ Source
|
||||||
char *buffer5 = (char *)malloc(size1); // BAD
|
char *buffer5 = (char *)malloc(size1); // BAD // $ Alert
|
||||||
|
|
||||||
size_t size2 = x;
|
size_t size2 = x;
|
||||||
size2 *= y;
|
size2 *= y;
|
||||||
char *buffer6 = (char *)malloc(size2); // BAD [NOT DETECTED]
|
char *buffer6 = (char *)malloc(size2); // BAD [NOT DETECTED]
|
||||||
|
|
||||||
char *buffer7 = new char[x * 10]; // GOOD
|
char *buffer7 = new char[x * 10]; // GOOD
|
||||||
char *buffer8 = new char[x * y]; // BAD
|
char *buffer8 = new char[x * y]; // BAD // $ Alert
|
||||||
char *buffer9 = new char[x * x]; // BAD
|
char *buffer9 = new char[x * x]; // BAD // $ Alert
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// --- custom allocators ---
|
// --- custom allocators ---
|
||||||
|
|
||||||
void *MyMalloc1(size_t size) { return malloc(size); } // [additional detection here]
|
void *MyMalloc1(size_t size) { return malloc(size); } // [additional detection here] // $ Alert
|
||||||
void *MyMalloc2(size_t size);
|
void *MyMalloc2(size_t size);
|
||||||
|
|
||||||
void customAllocatorTests()
|
void customAllocatorTests()
|
||||||
@@ -42,6 +42,6 @@ void customAllocatorTests()
|
|||||||
int x = getAnInt();
|
int x = getAnInt();
|
||||||
int y = getAnInt();
|
int y = getAnInt();
|
||||||
|
|
||||||
char *buffer1 = (char *)MyMalloc1(x * y); // BAD
|
char *buffer1 = (char *)MyMalloc1(x * y); // BAD // $ Alert Source
|
||||||
char *buffer2 = (char *)MyMalloc2(x * y); // BAD
|
char *buffer2 = (char *)MyMalloc2(x * y); // BAD // $ Alert
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
experimental/Security/CWE/CWE-190/DangerousUseOfTransformationAfterOperation.ql
|
query: experimental/Security/CWE/CWE-190/DangerousUseOfTransformationAfterOperation.ql
|
||||||
|
postprocess: utils/test/InlineExpectationsTestQuery.ql
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user