Skip to content

Commit 42776fb

Browse files
authored
Merge branch 'main' into denisl/goreferenceupdate
2 parents 47fc9f2 + 2f62351 commit 42776fb

File tree

751 files changed

+32064
-5030
lines changed

Some content is hidden

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

751 files changed

+32064
-5030
lines changed

.bazelversion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8.0.0
1+
8.1.1
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
name: Microsoft CodeQL Pack Publish
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
check-branch:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Fail if not on main branch
11+
run: |
12+
if [ "$GITHUB_REF" != "refs/heads/main" ]; then
13+
echo "This workflow can only run on the 'main' branch."
14+
exit 1
15+
fi
16+
codeqlversion:
17+
needs: check-branch
18+
runs-on: ubuntu-latest
19+
outputs:
20+
codeql_version: ${{ steps.set_codeql_version.outputs.codeql_version }}
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
- name: Set CodeQL Version
27+
id: set_codeql_version
28+
run: |
29+
git fetch
30+
git fetch --tags
31+
CURRENT_COMMIT=$(git rev-list -1 HEAD)
32+
CURRENT_TAG=$(git describe --tags --abbrev=0 --match 'codeql-cli/v*' $CURRENT_COMMIT)
33+
CODEQL_VERSION="${CURRENT_TAG#codeql-cli/}"
34+
echo "CODEQL_VERSION=$CODEQL_VERSION" >> $GITHUB_OUTPUT
35+
publishlibs:
36+
environment: secure-publish
37+
needs: codeqlversion
38+
runs-on: ubuntu-latest
39+
strategy:
40+
matrix:
41+
language: ['powershell']
42+
steps:
43+
- name: Checkout repository
44+
uses: actions/checkout@v4
45+
- name: Install CodeQL
46+
shell: bash
47+
run: |
48+
gh extension install github/gh-codeql
49+
gh codeql download "${{ needs.codeqlversion.outputs.codeql_version }}"
50+
gh codeql set-version "${{ needs.codeqlversion.outputs.codeql_version }}"
51+
env:
52+
GITHUB_TOKEN: ${{ github.token }}
53+
- name: Publish OS Microsoft CodeQL Lib Pack
54+
shell: bash
55+
run: |
56+
# Download latest qlpack
57+
gh codeql pack download "microsoft/$LANGUAGE-all"
58+
PACK_DIR="$HOME/.codeql/packages/microsoft/$LANGUAGE-all"
59+
VERSION_COUNT=$(ls -d "$PACK_DIR"/*/ | wc -l)
60+
[[ "$VERSION_COUNT" -ne 1 ]] && { echo "Expected exactly one version in $PACK_DIR, but found $VERSION_COUNT. Exiting."; exit 1; }
61+
62+
# Increment version
63+
CURRENT_VERSION=$(ls -v "$PACK_DIR" | tail -n 1)
64+
MAJOR=$(echo "$CURRENT_VERSION" | cut -d. -f1)
65+
MINOR=$(echo "$CURRENT_VERSION" | cut -d. -f2)
66+
PATCH=$(echo "$CURRENT_VERSION" | cut -d. -f3)
67+
NEXT_VERSION="$MAJOR.$MINOR.$((PATCH + 1))"
68+
69+
# Extract dependencies from the existing qlpack.yml before deleting
70+
DEPENDENCIES=$(yq 'select(has("dependencies")) | .dependencies | {"dependencies": .}' "$LANGUAGE/ql/lib/qlpack.yml" 2>/dev/null)
71+
DATAEXTENSIONS=$(yq 'select(has("dataExtensions")) | .dataExtensions | {"dataExtensions": .}' "$LANGUAGE/ql/lib/qlpack.yml" 2>/dev/null)
72+
rm -f "$LANGUAGE/ql/lib/qlpack.yml" "$LANGUAGE/ql/lib/qlpack.lock"
73+
74+
# Create new qlpack.yml with modified content
75+
cat <<EOF > "$LANGUAGE/ql/lib/qlpack.yml"
76+
name: microsoft/$LANGUAGE-all
77+
version: $NEXT_VERSION
78+
extractor: $LANGUAGE
79+
groups:
80+
- $LANGUAGE
81+
- microsoft-all
82+
dbscheme: semmlecode.$LANGUAGE.dbscheme
83+
extractor: $LANGUAGE
84+
library: true
85+
upgrades: upgrades
86+
$DEPENDENCIES
87+
$DATAEXTENSIONS
88+
warnOnImplicitThis: true
89+
EOF
90+
91+
# Publish pack
92+
cat "$LANGUAGE/ql/lib/qlpack.yml"
93+
gh codeql pack publish "$LANGUAGE/ql/lib"
94+
env:
95+
LANGUAGE: ${{ matrix.language }}
96+
GITHUB_TOKEN: ${{ secrets.PACKAGE_PUBLISH }}
97+
publish:
98+
environment: secure-publish
99+
needs: codeqlversion
100+
runs-on: ubuntu-latest
101+
strategy:
102+
matrix:
103+
language: ['csharp', 'cpp', 'java', 'javascript', 'python', 'ruby', 'go', 'rust', 'swift', 'powershell']
104+
steps:
105+
- name: Checkout repository
106+
uses: actions/checkout@v4
107+
- name: Install CodeQL
108+
shell: bash
109+
run: |
110+
gh extension install github/gh-codeql
111+
gh codeql download "${{ needs.codeqlversion.outputs.codeql_version }}"
112+
gh codeql set-version "${{ needs.codeqlversion.outputs.codeql_version }}"
113+
env:
114+
GITHUB_TOKEN: ${{ github.token }}
115+
- name: Publish OS Microsoft CodeQL Pack
116+
shell: bash
117+
run: |
118+
# Download latest qlpack
119+
gh codeql pack download "microsoft/$LANGUAGE-queries"
120+
PACK_DIR="$HOME/.codeql/packages/microsoft/$LANGUAGE-queries"
121+
VERSION_COUNT=$(ls -d "$PACK_DIR"/*/ | wc -l)
122+
[[ "$VERSION_COUNT" -ne 1 ]] && { echo "Expected exactly one version in $PACK_DIR, but found $VERSION_COUNT. Exiting."; exit 1; }
123+
124+
# Increment version
125+
CURRENT_VERSION=$(ls -v "$PACK_DIR" | tail -n 1)
126+
MAJOR=$(echo "$CURRENT_VERSION" | cut -d. -f1)
127+
MINOR=$(echo "$CURRENT_VERSION" | cut -d. -f2)
128+
PATCH=$(echo "$CURRENT_VERSION" | cut -d. -f3)
129+
NEXT_VERSION="$MAJOR.$MINOR.$((PATCH + 1))"
130+
131+
# Extract dependencies from the existing qlpack.yml before deleting
132+
DEPENDENCIES=$(yq 'select(has("dependencies")) | .dependencies | {"dependencies": .}' "$LANGUAGE/ql/src/qlpack.yml" 2>/dev/null)
133+
rm -f "$LANGUAGE/ql/src/qlpack.yml" "$LANGUAGE/ql/src/qlpack.lock"
134+
135+
# Create new qlpack.yml with modified content
136+
cat <<EOF > "$LANGUAGE/ql/src/qlpack.yml"
137+
name: microsoft/$LANGUAGE-queries
138+
version: $NEXT_VERSION
139+
extractor: $LANGUAGE
140+
groups:
141+
- $LANGUAGE
142+
- queries
143+
$DEPENDENCIES
144+
EOF
145+
146+
# Publish pack
147+
cat "$LANGUAGE/ql/src/qlpack.yml"
148+
gh codeql pack publish "$LANGUAGE/ql/src"
149+
env:
150+
LANGUAGE: ${{ matrix.language }}
151+
GITHUB_TOKEN: ${{ secrets.PACKAGE_PUBLISH }}
152+

.github/workflows/sync-main-tags.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ jobs:
2121
fetch-depth: 0
2222
- name: Push Tags
2323
run: |
24+
git remote add upstream https://github.com/github/codeql.git
2425
git fetch upstream --tags --force
2526
git push --force origin --tags
2627
env:

.github/workflows/sync-main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ jobs:
7878
--label 'autogenerated' \
7979
--title 'Sync Main (autogenerated)' \
8080
--body "This PR syncs the latest changes from \`codeql-cli/latest\` into \`main\`." \
81-
--reviewer 'MathiasVP'
81+
--reviewer 'MathiasVP' \
8282
--reviewer 'ropwareJB'
8383
else
8484
echo "No changes to sync from auto/sync-main-pr to main. Exiting gracefully."

CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
/java/ql/test-kotlin1/ @github/codeql-kotlin
1515
/java/ql/test-kotlin2/ @github/codeql-kotlin
1616

17+
# Experimental CodeQL cryptography
18+
**/experimental/quantum/ @github/ps-codeql
19+
1720
# CodeQL tools and associated docs
1821
/docs/codeql/codeql-cli/ @github/codeql-cli-reviewers
1922
/docs/codeql/codeql-for-visual-studio-code/ @github/codeql-vscode-reviewers
Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,34 @@
1-
if (($null -ne $env:LGTM_INDEX_INCLUDE) -or ($null -ne $env:LGTM_INDEX_EXCLUDE) -or ($null -ne $env:LGTM_INDEX_FILTERS)) {
2-
Write-Output 'Path filters set. Passing them through to the JavaScript extractor.'
3-
} else {
4-
Write-Output 'No path filters set. Using the default filters.'
5-
# Note: We're adding the `reusable_workflows` subdirectories to proactively
6-
# record workflows that were called cross-repo, check them out locally,
7-
# and enable an interprocedural analysis across the workflow files.
8-
# These workflows follow the convention `.github/reusable_workflows/<nwo>/*.ya?ml`
9-
$DefaultPathFilters = @(
10-
'exclude:**/*',
11-
'include:.github/workflows/*.yml',
12-
'include:.github/workflows/*.yaml',
13-
'include:.github/reusable_workflows/**/*.yml',
14-
'include:.github/reusable_workflows/**/*.yaml',
15-
'include:**/action.yml',
16-
'include:**/action.yaml'
17-
)
1+
# Note: We're adding the `reusable_workflows` subdirectories to proactively
2+
# record workflows that were called cross-repo, check them out locally,
3+
# and enable an interprocedural analysis across the workflow files.
4+
# These workflows follow the convention `.github/reusable_workflows/<nwo>/*.ya?ml`
5+
$DefaultPathFilters = @(
6+
'exclude:**/*',
7+
'include:.github/workflows/*.yml',
8+
'include:.github/workflows/*.yaml',
9+
'include:.github/reusable_workflows/**/*.yml',
10+
'include:.github/reusable_workflows/**/*.yaml',
11+
'include:**/action.yml',
12+
'include:**/action.yaml'
13+
)
1814

15+
if ($null -ne $env:LGTM_INDEX_FILTERS) {
16+
Write-Output 'LGTM_INDEX_FILTERS set. Using the default filters together with the user-provided filters, and passing through to the JavaScript extractor.'
17+
# Begin with the default path inclusions only,
18+
# followed by the user-provided filters.
19+
# If the user provided `paths`, those patterns override the default inclusions
20+
# (because `LGTM_INDEX_FILTERS` will begin with `exclude:**/*`).
21+
# If the user provided `paths-ignore`, those patterns are excluded.
22+
$PathFilters = ($DefaultPathFilters -join "`n") + "`n" + $env:LGTM_INDEX_FILTERS
23+
$env:LGTM_INDEX_FILTERS = $PathFilters
24+
} else {
25+
Write-Output 'LGTM_INDEX_FILTERS not set. Using the default filters, and passing through to the JavaScript extractor.'
1926
$env:LGTM_INDEX_FILTERS = $DefaultPathFilters -join "`n"
2027
}
2128

2229
# Find the JavaScript extractor directory via `codeql resolve extractor`.
2330
$CodeQL = Join-Path $env:CODEQL_DIST 'codeql.exe'
24-
$env:CODEQL_EXTRACTOR_JAVASCRIPT_ROOT = &$CodeQL resolve extractor --language javascript
31+
$env:CODEQL_EXTRACTOR_JAVASCRIPT_ROOT = &"$CodeQL" resolve extractor --language javascript
2532
if ($LASTEXITCODE -ne 0) {
2633
throw 'Failed to resolve JavaScript extractor.'
2734
}
@@ -40,7 +47,7 @@ $env:CODEQL_EXTRACTOR_JAVASCRIPT_SOURCE_ARCHIVE_DIR = $env:CODEQL_EXTRACTOR_ACTI
4047
$env:CODEQL_EXTRACTOR_JAVASCRIPT_TRAP_DIR = $env:CODEQL_EXTRACTOR_ACTIONS_TRAP_DIR
4148
$env:CODEQL_EXTRACTOR_JAVASCRIPT_WIP_DATABASE = $env:CODEQL_EXTRACTOR_ACTIONS_WIP_DATABASE
4249

43-
&$JavaScriptAutoBuild
50+
&"$JavaScriptAutoBuild"
4451
if ($LASTEXITCODE -ne 0) {
4552
throw "JavaScript autobuilder failed."
4653
}

actions/extractor/tools/autobuild.cmd

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
@echo off
22
rem All of the work is done in the PowerShell script
3-
powershell.exe %~dp0autobuild-impl.ps1
3+
echo "Running PowerShell script at '%~dp0autobuild-impl.ps1'"
4+
powershell.exe -File "%~dp0autobuild-impl.ps1"

actions/extractor/tools/autobuild.sh

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,28 @@ include:**/action.yaml
1717
END
1818
)
1919

20-
if [ -n "${LGTM_INDEX_INCLUDE:-}" ] || [ -n "${LGTM_INDEX_EXCLUDE:-}" ] || [ -n "${LGTM_INDEX_FILTERS:-}" ] ; then
21-
echo "Path filters set. Passing them through to the JavaScript extractor."
20+
if [ -n "${LGTM_INDEX_FILTERS:-}" ]; then
21+
echo "LGTM_INDEX_FILTERS set. Using the default filters together with the user-provided filters, and passing through to the JavaScript extractor."
22+
# Begin with the default path inclusions only,
23+
# followed by the user-provided filters.
24+
# If the user provided `paths`, those patterns override the default inclusions
25+
# (because `LGTM_INDEX_FILTERS` will begin with `exclude:**/*`).
26+
# If the user provided `paths-ignore`, those patterns are excluded.
27+
PATH_FILTERS="$(cat << END
28+
${DEFAULT_PATH_FILTERS}
29+
${LGTM_INDEX_FILTERS}
30+
END
31+
)"
32+
LGTM_INDEX_FILTERS="${PATH_FILTERS}"
33+
export LGTM_INDEX_FILTERS
2234
else
23-
echo "No path filters set. Using the default filters."
35+
echo "LGTM_INDEX_FILTERS not set. Using the default filters, and passing through to the JavaScript extractor."
2436
LGTM_INDEX_FILTERS="${DEFAULT_PATH_FILTERS}"
2537
export LGTM_INDEX_FILTERS
2638
fi
2739

2840
# Find the JavaScript extractor directory via `codeql resolve extractor`.
29-
CODEQL_EXTRACTOR_JAVASCRIPT_ROOT="$($CODEQL_DIST/codeql resolve extractor --language javascript)"
41+
CODEQL_EXTRACTOR_JAVASCRIPT_ROOT="$("${CODEQL_DIST}/codeql" resolve extractor --language javascript)"
3042
export CODEQL_EXTRACTOR_JAVASCRIPT_ROOT
3143

3244
echo "Found JavaScript extractor at '${CODEQL_EXTRACTOR_JAVASCRIPT_ROOT}'."
@@ -42,4 +54,4 @@ env CODEQL_EXTRACTOR_JAVASCRIPT_DIAGNOSTIC_DIR="${CODEQL_EXTRACTOR_ACTIONS_DIAGN
4254
CODEQL_EXTRACTOR_JAVASCRIPT_SOURCE_ARCHIVE_DIR="${CODEQL_EXTRACTOR_ACTIONS_SOURCE_ARCHIVE_DIR}" \
4355
CODEQL_EXTRACTOR_JAVASCRIPT_TRAP_DIR="${CODEQL_EXTRACTOR_ACTIONS_TRAP_DIR}" \
4456
CODEQL_EXTRACTOR_JAVASCRIPT_WIP_DATABASE="${CODEQL_EXTRACTOR_ACTIONS_WIP_DATABASE}" \
45-
${JAVASCRIPT_AUTO_BUILD}
57+
"${JAVASCRIPT_AUTO_BUILD}"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import actions
2+
3+
from AstNode n
4+
where n instanceof Workflow or n instanceof CompositeAction
5+
select n
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
| src/.github/action.yaml:1:1:11:32 | name: ' ... action' |
2+
| src/.github/actions/action-name/action.yml:1:1:11:32 | name: ' ... action' |
3+
| src/.github/workflows/workflow.yml:1:1:12:33 | name: A workflow |
4+
| src/action.yml:1:1:11:32 | name: ' ... action' |
5+
| src/excluded/action.yml:1:1:11:32 | name: ' ... action' |
6+
| src/included/action.yml:1:1:11:32 | name: ' ... action' |

0 commit comments

Comments
 (0)