-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Merge upstream codeql-cli-2.22.3 #20841
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
0e887d8
b40a437
03e671a
a2d4c20
db7119c
4dfa886
2186fef
10a8863
8ef8210
126ddf9
8aa1099
8ef818c
4645586
0d11efc
0644878
58acb60
25fb1aa
3d84e5a
077549d
9521d06
7668175
64bc3ed
b8a78f7
7bfefef
b88ed68
ed8cc6a
dae0582
8e09d96
f882af9
229914f
56977c7
3ba3b11
9ed32b1
f69cfdc
ae83d56
ebc167c
b79f366
8664842
9be1f2d
f513259
a38d57f
c50b0c6
2d045ea
31fbb6f
86cc09b
b82bd2c
c18db91
0912cc3
25d94fa
05a7cfd
72178f0
1ff04d9
1486200
9032d86
cb89695
6ab05cd
52f5ac5
849e0b4
4122283
0585c2f
7d07773
eec092c
2a26c43
8aa8dde
bd90435
766cf82
654bf2f
52ff5d3
2731983
f7c9899
4e524a1
b6b4df5
d4571f5
1d64a79
28de6ed
398d27b
3101cc8
1816356
d198877
8cd58aa
81f9e88
87e0b08
4dfa5d2
3606679
866977b
5fb45c8
4c5945f
b1b0892
6d496ee
f39d08e
75d37dc
5f07641
670ad74
205d2e5
72af800
5fde177
ef3654f
cb8496b
6ac9354
3f4a169
2541bcd
6ab6279
a95f3b3
b72af27
03a7d3d
1149d33
9266713
6d62e87
2e93ec5
3b90949
d78280e
c961340
4e0ea04
482fda7
a0dbf93
7c83d9d
95926cb
3ba8799
7991eb4
ae4b3e8
e795630
f9c3bde
71fec26
3880d9f
e3b3f0b
b66c99b
7b4d2a9
ffc53d7
eb15e3b
cb63c6a
b0d6192
f8bdfa4
3829528
1bd93b9
9b5897c
e96e464
337132b
f39c114
0936531
c6ab941
627ee85
214ca2a
05dbec6
5231a1f
1f79f38
3840d92
1bdd366
218f79f
6501d12
b5fb6b5
cfbde9a
b475871
97170ee
a5a632f
b3dbe20
5e0ef92
9b6eddb
bf7ebcc
5a90fc4
e66ae68
72f8680
44ed048
c8b2fda
2403ce6
0a06da0
04872b7
bd3f774
42104ec
f2f18fe
2e290d2
f87f720
84c3df2
7a96fec
bc99894
bce32b4
6df032d
b85c176
7f9930e
9af1306
e8df3cc
a512b5a
6a95515
9681711
e1efae5
e566145
c8eb734
90999b3
3ab33c7
2cb9f80
1990cf8
d1f1807
805e6c6
1f775b9
9916bbb
8d3f6b8
869c613
ca2cf5e
831f25d
2ec78ed
4276405
e39d9f9
5692eb0
93a3833
ca20eb5
54226ec
c83268f
3332f70
6530fac
4e690b7
4f21586
7d9a77a
d7a4063
abf320b
a130224
12107ec
5e8514f
a1bd3a5
bfb10a2
786db34
a0ab6c4
4ab6f5c
8ab8e67
9bc74bd
aa81060
97f11a1
3759158
1e1e4c6
2fba40f
294af54
6a7c1e9
0e39139
76ddb40
83b8f89
13ef779
2a0a312
ab8130e
641d379
a20e093
d6adad8
ced775a
18ff8d2
7eef5ba
cfa09c6
635b32d
f0ffcd0
12969dd
b179734
4bf4363
5087c8d
a26da74
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,152 @@ | ||
| name: Microsoft CodeQL Pack Publish | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| check-branch: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Fail if not on main branch | ||
| run: | | ||
| if [ "$GITHUB_REF" != "refs/heads/main" ]; then | ||
| echo "This workflow can only run on the 'main' branch." | ||
| exit 1 | ||
| fi | ||
| codeqlversion: | ||
| needs: check-branch | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| codeql_version: ${{ steps.set_codeql_version.outputs.codeql_version }} | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Set CodeQL Version | ||
| id: set_codeql_version | ||
| run: | | ||
| git fetch | ||
| git fetch --tags | ||
| CURRENT_COMMIT=$(git rev-list -1 HEAD) | ||
| CURRENT_TAG=$(git describe --tags --abbrev=0 --match 'codeql-cli/v*' $CURRENT_COMMIT) | ||
| CODEQL_VERSION="${CURRENT_TAG#codeql-cli/}" | ||
| echo "CODEQL_VERSION=$CODEQL_VERSION" >> $GITHUB_OUTPUT | ||
| publishlibs: | ||
|
Comment on lines
+17
to
+35
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
|
||
| environment: secure-publish | ||
| needs: codeqlversion | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| language: ['powershell'] | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| - name: Install CodeQL | ||
| shell: bash | ||
| run: | | ||
| gh extension install github/gh-codeql | ||
| gh codeql download "${{ needs.codeqlversion.outputs.codeql_version }}" | ||
| gh codeql set-version "${{ needs.codeqlversion.outputs.codeql_version }}" | ||
| env: | ||
| GITHUB_TOKEN: ${{ github.token }} | ||
| - name: Publish OS Microsoft CodeQL Lib Pack | ||
| shell: bash | ||
| run: | | ||
| # Download latest qlpack | ||
| gh codeql pack download "microsoft/$LANGUAGE-all" | ||
| PACK_DIR="$HOME/.codeql/packages/microsoft/$LANGUAGE-all" | ||
| VERSION_COUNT=$(ls -d "$PACK_DIR"/*/ | wc -l) | ||
| [[ "$VERSION_COUNT" -ne 1 ]] && { echo "Expected exactly one version in $PACK_DIR, but found $VERSION_COUNT. Exiting."; exit 1; } | ||
|
|
||
| # Increment version | ||
| CURRENT_VERSION=$(ls -v "$PACK_DIR" | tail -n 1) | ||
| MAJOR=$(echo "$CURRENT_VERSION" | cut -d. -f1) | ||
| MINOR=$(echo "$CURRENT_VERSION" | cut -d. -f2) | ||
| PATCH=$(echo "$CURRENT_VERSION" | cut -d. -f3) | ||
| NEXT_VERSION="$MAJOR.$MINOR.$((PATCH + 1))" | ||
|
|
||
| # Extract dependencies from the existing qlpack.yml before deleting | ||
| DEPENDENCIES=$(yq 'select(has("dependencies")) | .dependencies | {"dependencies": .}' "$LANGUAGE/ql/lib/qlpack.yml" 2>/dev/null) | ||
| DATAEXTENSIONS=$(yq 'select(has("dataExtensions")) | .dataExtensions | {"dataExtensions": .}' "$LANGUAGE/ql/lib/qlpack.yml" 2>/dev/null) | ||
| rm -f "$LANGUAGE/ql/lib/qlpack.yml" "$LANGUAGE/ql/lib/qlpack.lock" | ||
|
|
||
| # Create new qlpack.yml with modified content | ||
| cat <<EOF > "$LANGUAGE/ql/lib/qlpack.yml" | ||
| name: microsoft/$LANGUAGE-all | ||
| version: $NEXT_VERSION | ||
| extractor: $LANGUAGE | ||
| groups: | ||
| - $LANGUAGE | ||
| - microsoft-all | ||
| dbscheme: semmlecode.$LANGUAGE.dbscheme | ||
| extractor: $LANGUAGE | ||
| library: true | ||
| upgrades: upgrades | ||
| $DEPENDENCIES | ||
| $DATAEXTENSIONS | ||
| warnOnImplicitThis: true | ||
| EOF | ||
|
|
||
| # Publish pack | ||
| cat "$LANGUAGE/ql/lib/qlpack.yml" | ||
| gh codeql pack publish "$LANGUAGE/ql/lib" | ||
| env: | ||
| LANGUAGE: ${{ matrix.language }} | ||
| GITHUB_TOKEN: ${{ secrets.PACKAGE_PUBLISH }} | ||
| publish: | ||
|
Comment on lines
+36
to
+97
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
|
||
| environment: secure-publish | ||
| needs: codeqlversion | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| language: ['csharp', 'cpp', 'java', 'javascript', 'python', 'ruby', 'go', 'rust', 'swift', 'powershell', 'iac'] | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| - name: Install CodeQL | ||
| shell: bash | ||
| run: | | ||
| gh extension install github/gh-codeql | ||
| gh codeql download "${{ needs.codeqlversion.outputs.codeql_version }}" | ||
| gh codeql set-version "${{ needs.codeqlversion.outputs.codeql_version }}" | ||
| env: | ||
| GITHUB_TOKEN: ${{ github.token }} | ||
| - name: Publish OS Microsoft CodeQL Pack | ||
| shell: bash | ||
| run: | | ||
| # Download latest qlpack | ||
| gh codeql pack download "microsoft/$LANGUAGE-queries" | ||
| PACK_DIR="$HOME/.codeql/packages/microsoft/$LANGUAGE-queries" | ||
| VERSION_COUNT=$(ls -d "$PACK_DIR"/*/ | wc -l) | ||
| [[ "$VERSION_COUNT" -ne 1 ]] && { echo "Expected exactly one version in $PACK_DIR, but found $VERSION_COUNT. Exiting."; exit 1; } | ||
|
|
||
| # Increment version | ||
| CURRENT_VERSION=$(ls -v "$PACK_DIR" | tail -n 1) | ||
| MAJOR=$(echo "$CURRENT_VERSION" | cut -d. -f1) | ||
| MINOR=$(echo "$CURRENT_VERSION" | cut -d. -f2) | ||
| PATCH=$(echo "$CURRENT_VERSION" | cut -d. -f3) | ||
| NEXT_VERSION="$MAJOR.$MINOR.$((PATCH + 1))" | ||
|
|
||
| # Extract dependencies from the existing qlpack.yml before deleting | ||
| DEPENDENCIES=$(yq 'select(has("dependencies")) | .dependencies | {"dependencies": .}' "$LANGUAGE/ql/src/qlpack.yml" 2>/dev/null) | ||
| rm -f "$LANGUAGE/ql/src/qlpack.yml" "$LANGUAGE/ql/src/qlpack.lock" | ||
|
|
||
| # Create new qlpack.yml with modified content | ||
| cat <<EOF > "$LANGUAGE/ql/src/qlpack.yml" | ||
| name: microsoft/$LANGUAGE-queries | ||
| version: $NEXT_VERSION | ||
| extractor: $LANGUAGE | ||
| groups: | ||
| - $LANGUAGE | ||
| - queries | ||
| $DEPENDENCIES | ||
| EOF | ||
|
|
||
| # Publish pack | ||
| cat "$LANGUAGE/ql/src/qlpack.yml" | ||
| gh codeql pack publish "$LANGUAGE/ql/src" | ||
| env: | ||
| LANGUAGE: ${{ matrix.language }} | ||
| GITHUB_TOKEN: ${{ secrets.PACKAGE_PUBLISH }} | ||
|
Comment on lines
+98
to
+151
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| name: PowerShell PR Check | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| powershell-pr-check: | ||
| name: powershell-pr-check | ||
| runs-on: windows-latest | ||
| if: github.repository == 'microsoft/codeql' | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v3 | ||
| with: | ||
| fetch-depth: 0 | ||
| token: ${{ github.token }} | ||
| - name: Setup CodeQL | ||
| uses: ./.github/actions/fetch-codeql | ||
| with: | ||
| channel: release | ||
| - name: Install PowerShell | ||
| run: | | ||
| $path = Split-Path (Get-Command codeql).Source | ||
| ./powershell/build-win64.ps1 $path | ||
| - name: Run QL tests | ||
| run: | | ||
| codeql test run --threads=0 powershell/ql/test |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| name: Sync Main Tags | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: | ||
| - closed | ||
| branches: | ||
| - main | ||
|
|
||
| jobs: | ||
| sync-main-tags: | ||
| name: Sync Main Tags | ||
| runs-on: ubuntu-latest | ||
| if: github.repository == 'microsoft/codeql' && github.event.pull_request.merged == true && github.event.pull_request.head.ref == 'auto/sync-main-pr' | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v3 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Push Tags | ||
| run: | | ||
| git remote add upstream https://github.com/github/codeql.git | ||
| git fetch upstream --tags --force | ||
| git push --force origin --tags | ||
| env: | ||
| GH_TOKEN: ${{ secrets.WORKFLOW_TOKEN }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| name: Sync Main | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| paths: | ||
| - .github/workflows/sync-main.yml | ||
| schedule: | ||
| - cron: '55 * * * *' | ||
|
|
||
| jobs: | ||
| sync-main: | ||
| name: Sync-main | ||
| runs-on: ubuntu-latest | ||
| if: github.repository == 'microsoft/codeql' | ||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v3 | ||
| with: | ||
| fetch-depth: 0 | ||
| token: ${{ secrets.WORKFLOW_TOKEN }} | ||
| - name: Git config | ||
| shell: bash | ||
| run: | | ||
| git config user.name "dilanbhalla" | ||
| git config user.email "dilanbhalla@microsoft.com" | ||
| - name: Git checkout auto/sync-main-pr | ||
| shell: bash | ||
| run: | | ||
| git fetch origin | ||
| if git ls-remote --exit-code --heads origin auto/sync-main-pr > /dev/null; then | ||
| echo "Branch exists remotely. Checking it out." | ||
| git checkout -B auto/sync-main-pr origin/auto/sync-main-pr | ||
| else | ||
| echo "Branch does not exist remotely. Creating from main." | ||
| git checkout -B auto/sync-main-pr origin/main | ||
| git push -u origin auto/sync-main-pr | ||
| fi | ||
| - name: Sync origin/main | ||
| shell: bash | ||
| run: | | ||
| echo "::group::Sync with main branch" | ||
| git pull origin auto/sync-main-pr; exitCode=$?; if [ $exitCode -ne 0 ]; then exitCode=0; fi | ||
| git pull origin main --no-rebase | ||
| git push --force origin auto/sync-main-pr | ||
| echo "::endgroup::" | ||
| - name: Sync upstream/codeql-cli/latest | ||
| shell: bash | ||
| run: | | ||
| echo "::group::Set up remote" | ||
| git remote add upstream https://github.com/github/codeql.git | ||
| git fetch upstream --tags --force | ||
| echo "::endgroup::" | ||
| echo "::group::Merge codeql-cli/latest" | ||
| set -x | ||
| git merge codeql-cli/latest | ||
| set +x | ||
| echo "::endgroup::" | ||
| - name: Push sync branch | ||
| run: | | ||
| git push origin auto/sync-main-pr | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.WORKFLOW_TOKEN }} | ||
| GH_TOKEN: ${{ secrets.WORKFLOW_TOKEN }} | ||
| - name: Create PR if it doesn't exist | ||
| shell: bash | ||
| run: | | ||
| pr_number=$(gh pr list --repo microsoft/codeql --head auto/sync-main-pr --base main --json number --jq '.[0].number') | ||
| if [ -n "$pr_number" ]; then | ||
| echo "PR from auto/sync-main-pr to main already exists (PR #$pr_number). Exiting gracefully." | ||
| else | ||
| if git fetch origin main auto/sync-main-pr && [ -n "$(git rev-list origin/main..origin/auto/sync-main-pr)" ]; then | ||
| echo "PR does not exist. Creating one..." | ||
| gh pr create --repo microsoft/codeql --fill -B main -H auto/sync-main-pr \ | ||
| --label 'autogenerated' \ | ||
| --title 'Sync Main (autogenerated)' \ | ||
| --body "This PR syncs the latest changes from \`codeql-cli/latest\` into \`main\`." \ | ||
| --reviewer 'MathiasVP' \ | ||
| --reviewer 'ropwareJB' | ||
| else | ||
| echo "No changes to sync from auto/sync-main-pr to main. Exiting gracefully." | ||
| fi | ||
| fi | ||
| env: | ||
| GH_TOKEN: ${{ secrets.WORKFLOW_TOKEN }} | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| [submodule "iac"] | ||
| path = iac | ||
| url = https://github.com/advanced-security/codeql-extractor-iac |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| <!-- BEGIN MICROSOFT SECURITY.MD V0.0.8 BLOCK --> | ||
|
|
||
| ## Security | ||
|
|
||
| Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/). | ||
|
|
||
| If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below. | ||
|
|
||
| ## Reporting Security Issues | ||
|
|
||
| **Please do not report security vulnerabilities through public GitHub issues.** | ||
|
|
||
| Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report). | ||
|
|
||
| If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey). | ||
|
|
||
| You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc). | ||
|
|
||
| Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: | ||
|
|
||
| * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.) | ||
| * Full paths of source file(s) related to the manifestation of the issue | ||
| * The location of the affected source code (tag/branch/commit or direct URL) | ||
| * Any special configuration required to reproduce the issue | ||
| * Step-by-step instructions to reproduce the issue | ||
| * Proof-of-concept or exploit code (if possible) | ||
| * Impact of the issue, including how an attacker might exploit the issue | ||
|
|
||
| This information will help us triage your report more quickly. | ||
|
|
||
| If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs. | ||
|
|
||
| ## Preferred Languages | ||
|
|
||
| We prefer all communications to be in English. | ||
|
|
||
| ## Policy | ||
|
|
||
| Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd). | ||
|
|
||
| <!-- END MICROSOFT SECURITY.MD BLOCK --> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| --- | ||
| category: feature | ||
| --- | ||
| * Added a new class `AdditionalCallTarget` for specifying additional call targets. |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium