Skip to content

Commit b5a6f6e

Browse files
authored
Merge pull request #1 from github/main
Sync with the upstream
2 parents 4376870 + 1fcfae2 commit b5a6f6e

File tree

3,513 files changed

+382786
-63609
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,513 files changed

+382786
-63609
lines changed

.github/actions/cache-query-compilation/action.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,19 @@ runs:
2323
run: |
2424
MERGE_BASE=$(git cat-file commit $GITHUB_SHA | grep '^parent ' | head -1 | cut -f 2 -d " ")
2525
echo "merge_base=$MERGE_BASE" >> $GITHUB_ENV
26-
- name: Restore read-only cache (PR)
26+
- name: Restore cache (PR)
2727
if: ${{ github.event_name == 'pull_request' }}
28-
uses: erik-krogh/actions-cache@a88d0603fe5fb5606db9f002dfcadeb32b5f84c6
28+
uses: actions/cache/restore@v3
2929
with:
3030
path: '**/.cache'
31-
read-only: true
3231
key: codeql-compile-${{ inputs.key }}-pr-${{ github.sha }}
3332
restore-keys: |
3433
codeql-compile-${{ inputs.key }}-${{ github.base_ref }}-${{ env.merge_base }}
3534
codeql-compile-${{ inputs.key }}-${{ github.base_ref }}-
3635
codeql-compile-${{ inputs.key }}-main-
37-
- name: Fill cache (push)
36+
- name: Fill cache (only branch push)
3837
if: ${{ github.event_name != 'pull_request' }}
39-
uses: erik-krogh/actions-cache@a88d0603fe5fb5606db9f002dfcadeb32b5f84c6
38+
uses: actions/cache@v3
4039
with:
4140
path: '**/.cache'
4241
key: codeql-compile-${{ inputs.key }}-${{ github.ref_name }}-${{ github.sha }} # just fill on main

.github/actions/fetch-codeql/action.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,6 @@ runs:
1919
gh extension install github/gh-codeql
2020
gh codeql set-channel "$CHANNEL"
2121
gh codeql version
22+
printf "CODEQL_FETCHED_CODEQL_PATH=" >> "${GITHUB_ENV}"
23+
gh codeql version --format=json | jq -r .unpackedLocation >> "${GITHUB_ENV}"
2224
gh codeql version --format=json | jq -r .unpackedLocation >> "${GITHUB_PATH}"
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Find Latest CodeQL Bundle
2+
description: Finds the URL of the latest released version of the CodeQL bundle.
3+
outputs:
4+
url:
5+
description: The download URL of the latest CodeQL bundle release
6+
value: ${{ steps.find-latest.outputs.url }}
7+
runs:
8+
using: composite
9+
steps:
10+
- name: Find Latest Release
11+
id: find-latest
12+
shell: pwsh
13+
run: |
14+
$Latest = gh release list --repo github/codeql-action --exclude-drafts --limit 1000 |
15+
ForEach-Object { $C = $_ -split "`t"; return @{ type = $C[1]; tag = $C[2]; } } |
16+
Where-Object { $_.type -eq 'Latest' }
17+
18+
$Tag = $Latest.tag
19+
if ($Tag -eq '') {
20+
throw 'Failed to find latest bundle release.'
21+
}
22+
23+
Write-Output "Latest bundle tag is '${Tag}'."
24+
"url=https://github.com/github/codeql-action/releases/download/${Tag}/codeql-bundle-linux64.tar.gz" >> $env:GITHUB_OUTPUT
25+
env:
26+
GITHUB_TOKEN: ${{ github.token }}

.github/actions/os-version/action.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: OS Version
2+
description: Get OS version.
3+
4+
outputs:
5+
version:
6+
description: "OS version"
7+
value: ${{ steps.version.outputs.version }}
8+
9+
runs:
10+
using: composite
11+
steps:
12+
- if: runner.os == 'Linux'
13+
shell: bash
14+
run: |
15+
. /etc/os-release
16+
echo "VERSION=${NAME} ${VERSION}" >> $GITHUB_ENV
17+
- if: runner.os == 'Windows'
18+
shell: powershell
19+
run: |
20+
$objects = systeminfo.exe /FO CSV | ConvertFrom-Csv
21+
"VERSION=$($objects.'OS Name') $($objects.'OS Version')" >> $env:GITHUB_ENV
22+
- if: runner.os == 'macOS'
23+
shell: bash
24+
run: |
25+
echo "VERSION=$(sw_vers -productName) $(sw_vers -productVersion)" >> $GITHUB_ENV
26+
- name: Emit OS version
27+
id: version
28+
shell: bash
29+
run: |
30+
echo "$VERSION"
31+
echo "version=${VERSION}" >> $GITHUB_OUTPUT
32+

.github/dependabot.yml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,7 @@
11
version: 2
22
updates:
33
- package-ecosystem: "cargo"
4-
directory: "ruby/node-types"
5-
schedule:
6-
interval: "daily"
7-
- package-ecosystem: "cargo"
8-
directory: "ruby/generator"
9-
schedule:
10-
interval: "daily"
11-
- package-ecosystem: "cargo"
12-
directory: "ruby/extractor"
13-
schedule:
14-
interval: "daily"
15-
- package-ecosystem: "cargo"
16-
directory: "ruby/autobuilder"
4+
directory: "ruby"
175
schedule:
186
interval: "daily"
197

.github/workflows/atm-check-query-suite.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ on:
1313

1414
jobs:
1515
atm-check-query-suite:
16-
runs-on: ubuntu-latest
16+
runs-on: ubuntu-latest-xl
1717

1818
steps:
1919
- uses: actions/checkout@v3
@@ -23,6 +23,12 @@ jobs:
2323
with:
2424
channel: release
2525

26+
- name: Cache compilation cache
27+
id: query-cache
28+
uses: ./.github/actions/cache-query-compilation
29+
with:
30+
key: atm-suite
31+
2632
- name: Install ATM model
2733
run: |
2834
set -exu
@@ -50,10 +56,13 @@ jobs:
5056
echo "SARIF_PATH=${SARIF_PATH}" >> "${GITHUB_ENV}"
5157
5258
codeql database analyze \
59+
--threads=0 \
60+
--ram 50000 \
5361
--format sarif-latest \
5462
--output "${SARIF_PATH}" \
5563
--sarif-group-rules-by-pack \
5664
-vv \
65+
--compilation-cache "${{ steps.query-cache.outputs.cache-dir }}" \
5766
-- \
5867
"${DB_PATH}" \
5968
"${QUERY_PACK}/${QUERY_SUITE}"

.github/workflows/check-change-note.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,9 @@ jobs:
2626
run: |
2727
gh api 'repos/${{github.repository}}/pulls/${{github.event.number}}/files' --paginate --jq 'any(.[].filename ; test("/change-notes/.*[.]md$"))' |
2828
grep true -c
29+
- name: Fail if the change note filename doesn't match the expected format. The file name must be of the form 'YYYY-MM-DD.md' or 'YYYY-MM-DD-{title}.md', where '{title}' is arbitrary text.
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
run: |
33+
gh api 'repos/${{github.repository}}/pulls/${{github.event.number}}/files' --paginate --jq '[.[].filename | select(test("/change-notes/.*[.]md$"))] | all(test("/change-notes/[0-9]{4}-[0-9]{2}-[0-9]{2}.*[.]md$"))' |
34+
grep true -c

.github/workflows/check-query-ids.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Check query IDs
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- "**/src/**/*.ql"
7+
- misc/scripts/check-query-ids.py
8+
- .github/workflows/check-query-ids.yml
9+
branches:
10+
- main
11+
- "rc/*"
12+
workflow_dispatch:
13+
14+
jobs:
15+
check:
16+
name: Check query IDs
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v3
20+
- name: Check for duplicate query IDs
21+
run: python3 misc/scripts/check-query-ids.py

.github/workflows/close-stale.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ubuntu-latest
1313

1414
steps:
15-
- uses: actions/stale@v6
15+
- uses: actions/stale@v7
1616
with:
1717
repo-token: ${{ secrets.GITHUB_TOKEN }}
1818
stale-issue-message: 'This issue is stale because it has been open 14 days with no activity. Comment or remove the `Stale` label in order to avoid having this issue closed in 7 days.'

.github/workflows/mad_modelDiff.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
branches:
1212
- main
1313
paths:
14-
- "java/ql/src/utils/model-generator/**/*.*"
14+
- "java/ql/src/utils/modelgenerator/**/*.*"
1515
- ".github/workflows/mad_modelDiff.yml"
1616

1717
permissions:
@@ -40,12 +40,12 @@ jobs:
4040
- name: Download database
4141
env:
4242
SLUG: ${{ matrix.slug }}
43+
GH_TOKEN: ${{ github.token }}
4344
run: |
4445
set -x
4546
mkdir lib-dbs
4647
SHORTNAME=${SLUG//[^a-zA-Z0-9_]/}
47-
projectId=`curl -s https://lgtm.com/api/v1.0/projects/g/${SLUG} | jq .id`
48-
curl -L "https://lgtm.com/api/v1.0/snapshots/$projectId/java" -o "$SHORTNAME.zip"
48+
gh api -H "Accept: application/zip" "/repos/${SLUG}/code-scanning/codeql/databases/java" > "$SHORTNAME.zip"
4949
unzip -q -d "${SHORTNAME}-db" "${SHORTNAME}.zip"
5050
mkdir "lib-dbs/$SHORTNAME/"
5151
mv "${SHORTNAME}-db/"$(ls -1 "${SHORTNAME}"-db)/* "lib-dbs/${SHORTNAME}/"
@@ -61,8 +61,8 @@ jobs:
6161
DATABASE=$2
6262
cd codeql-$QL_VARIANT
6363
SHORTNAME=`basename $DATABASE`
64-
python java/ql/src/utils/model-generator/GenerateFlowModel.py --with-summaries --with-sinks $DATABASE $MODELS/${SHORTNAME}.qll
65-
mv $MODELS/${SHORTNAME}.qll $MODELS/${SHORTNAME}Generated_${QL_VARIANT}.qll
64+
python java/ql/src/utils/modelgenerator/GenerateFlowModel.py --with-summaries --with-sinks $DATABASE ${SHORTNAME}.temp.model.yml
65+
mv java/ql/lib/ext/generated/${SHORTNAME}.temp.model.yml $MODELS/${SHORTNAME}Generated_${QL_VARIANT}.model.yml
6666
cd ..
6767
}
6868
@@ -85,19 +85,21 @@ jobs:
8585
set -x
8686
MODELS=`pwd`/tmp-models
8787
ls -1 tmp-models/
88-
for m in $MODELS/*_main.qll ; do
88+
for m in $MODELS/*_main.model.yml ; do
8989
t="${m/main/"pr"}"
9090
basename=`basename $m`
91-
name="diff_${basename/_main.qll/""}"
91+
name="diff_${basename/_main.model.yml/""}"
9292
(diff -w -u $m $t | diff2html -i stdin -F $MODELS/$name.html) || true
9393
done
9494
- uses: actions/upload-artifact@v3
9595
with:
9696
name: models
97-
path: tmp-models/*.qll
97+
path: tmp-models/*.model.yml
9898
retention-days: 20
9999
- uses: actions/upload-artifact@v3
100100
with:
101101
name: diffs
102102
path: tmp-models/*.html
103+
# An html file is only produced if the generated models differ.
104+
if-no-files-found: ignore
103105
retention-days: 20

.github/workflows/mad_regenerate-models.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ jobs:
5050
SLUG: ${{ matrix.slug }}
5151
run: |
5252
SHORTNAME=${SLUG//[^a-zA-Z0-9_]/}
53-
java/ql/src/utils/model-generator/RegenerateModels.py "${SLUG}" dbs/${SHORTNAME}
53+
java/ql/src/utils/modelgenerator/RegenerateModels.py "${SLUG}" dbs/${SHORTNAME}
5454
- name: Stage changes
5555
run: |
56-
find java -name "*.qll" -print0 | xargs -0 git add
56+
find java -name "*.model.yml" -print0 | xargs -0 git add
5757
git status
5858
git diff --cached > models.patch
5959
- uses: actions/upload-artifact@v3

.github/workflows/ql-for-ql-build.yml

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,30 @@ jobs:
2222
steps:
2323
### Build the queries ###
2424
- uses: actions/checkout@v3
25+
- name: Find latest bundle
26+
id: find-latest-bundle
27+
uses: ./.github/actions/find-latest-bundle
2528
- name: Find codeql
2629
id: find-codeql
27-
uses: github/codeql-action/init@77a8d2d10c0b403a8b4aadbd223dc489ecd22683
30+
uses: github/codeql-action/init@45955cb1830b640e2c1603ad72ad542a49d47b96
2831
with:
2932
languages: javascript # does not matter
33+
tools: ${{ steps.find-latest-bundle.outputs.url }}
3034
- name: Get CodeQL version
3135
id: get-codeql-version
3236
run: |
3337
echo "version=$("${CODEQL}" --version | head -n 1 | rev | cut -d " " -f 1 | rev)" >> $GITHUB_OUTPUT
3438
shell: bash
3539
env:
3640
CODEQL: ${{ steps.find-codeql.outputs.codeql-path }}
41+
- uses: ./.github/actions/os-version
42+
id: os_version
3743
- name: Cache entire pack
3844
id: cache-pack
3945
uses: actions/cache@v3
4046
with:
4147
path: ${{ runner.temp }}/pack
42-
key: ${{ runner.os }}-pack-${{ hashFiles('ql/**/Cargo.lock') }}-${{ hashFiles('ql/**/*.rs') }}-${{ hashFiles('ql/**/*.ql*') }}-${{ hashFiles('ql/**/qlpack.yml') }}-${{ hashFiles('ql/ql/src/ql.dbscheme*') }}-${{ steps.get-codeql-version.outputs.version }}--${{ hashFiles('.github/workflows/ql-for-ql-build.yml') }}
48+
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-pack-${{ hashFiles('ql/**/Cargo.lock') }}-${{ hashFiles('ql/**/*.rs') }}-${{ hashFiles('ql/**/*.ql*') }}-${{ hashFiles('ql/**/qlpack.yml') }}-${{ hashFiles('ql/ql/src/ql.dbscheme*') }}-${{ steps.get-codeql-version.outputs.version }}--${{ hashFiles('.github/workflows/ql-for-ql-build.yml') }}
4349
- name: Cache queries
4450
if: steps.cache-pack.outputs.cache-hit != 'true'
4551
id: cache-queries
@@ -73,7 +79,7 @@ jobs:
7379
ql/target/release/ql-autobuilder.exe
7480
ql/target/release/ql-extractor
7581
ql/target/release/ql-extractor.exe
76-
key: ${{ runner.os }}-extractor-${{ hashFiles('ql/**/Cargo.lock') }}-${{ hashFiles('ql/**/*.rs') }}
82+
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-extractor-${{ hashFiles('ql/**/Cargo.lock') }}-${{ hashFiles('ql/**/*.rs') }}
7783
- name: Cache cargo
7884
if: steps.cache-extractor.outputs.cache-hit != 'true' && steps.cache-pack.outputs.cache-hit != 'true'
7985
uses: actions/cache@v3
@@ -82,7 +88,7 @@ jobs:
8288
~/.cargo/registry
8389
~/.cargo/git
8490
ql/target
85-
key: ${{ runner.os }}-rust-cargo-${{ hashFiles('ql/**/Cargo.lock') }}
91+
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-rust-cargo-${{ hashFiles('ql/**/Cargo.lock') }}
8692
- name: Check formatting
8793
if: steps.cache-extractor.outputs.cache-hit != 'true' && steps.cache-pack.outputs.cache-hit != 'true'
8894
run: cd ql; cargo fmt --all -- --check
@@ -133,19 +139,20 @@ jobs:
133139
env:
134140
CONF: ./ql-for-ql-config.yml
135141
- name: Initialize CodeQL
136-
uses: github/codeql-action/init@77a8d2d10c0b403a8b4aadbd223dc489ecd22683
142+
uses: github/codeql-action/init@45955cb1830b640e2c1603ad72ad542a49d47b96
137143
with:
138144
languages: ql
139145
db-location: ${{ runner.temp }}/db
140146
config-file: ./ql-for-ql-config.yml
141-
- name: Move pack cache
147+
tools: ${{ steps.find-latest-bundle.outputs.url }}
148+
- name: Move pack queries
142149
run: |
143-
cp -r ${PACK}/.cache ql/ql/src/.cache
150+
cp -r ${PACK}/queries ql/ql/src
144151
env:
145152
PACK: ${{ runner.temp }}/pack
146153

147154
- name: Perform CodeQL Analysis
148-
uses: github/codeql-action/analyze@77a8d2d10c0b403a8b4aadbd223dc489ecd22683
155+
uses: github/codeql-action/analyze@45955cb1830b640e2c1603ad72ad542a49d47b96
149156
with:
150157
category: "ql-for-ql"
151158
- name: Copy sarif file to CWD
@@ -167,4 +174,4 @@ jobs:
167174
with:
168175
name: ql-for-ql-langs
169176
path: split-sarif
170-
retention-days: 1
177+
retention-days: 1

.github/workflows/ql-for-ql-dataset_measure.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,18 @@ jobs:
2525

2626
- name: Find codeql
2727
id: find-codeql
28-
uses: github/codeql-action/init@77a8d2d10c0b403a8b4aadbd223dc489ecd22683
28+
uses: github/codeql-action/init@45955cb1830b640e2c1603ad72ad542a49d47b96
2929
with:
3030
languages: javascript # does not matter
31+
- uses: ./.github/actions/os-version
32+
id: os_version
3133
- uses: actions/cache@v3
3234
with:
3335
path: |
3436
~/.cargo/registry
3537
~/.cargo/git
3638
ql/target
37-
key: ${{ runner.os }}-qltest-cargo-${{ hashFiles('ql/**/Cargo.lock') }}
39+
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-qltest-cargo-${{ hashFiles('ql/**/Cargo.lock') }}
3840
- name: Build Extractor
3941
run: cd ql; env "PATH=$PATH:`dirname ${CODEQL}`" ./scripts/create-extractor-pack.sh
4042
env:

0 commit comments

Comments
 (0)