Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
0e887d8b40a43703e671aa2d4c20db7119c4dfa8862186fef10a88638ef8210126ddf98aa10998ef818c46455860d11efc064487858acb6025fb1aa3d84e5a077549d9521d06766817564bc3edb8a78f77bfefefb88ed68ed8cc6adae05828e09d96f882af9229914f56977c73ba3b119ed32b1f69cfdcae83d56ebc167cb79f36686648429be1f2df513259a38d57fc50b0c62d045ea31fbb6f86cc09bb82bd2cc18db910912cc325d94fa05a7cfd72178f01ff04d914862009032d86cb896956ab05cd52f5ac5849e0b441222830585c2f7d07773eec092c2a26c438aa8ddebd90435766cf82654bf2f52ff5d32731983f7c98994e524a1b6b4df5d4571f51d64a7928de6ed398d27b3101cc81816356d1988778cd58aa81f9e8887e0b084dfa5d23606679866977b5fb45c84c5945fb1b08926d496eef39d08e75d37dc5f07641670ad74205d2e572af8005fde177ef3654fcb8496b6ac93543f4a1692541bcd6ab6279a95f3b3b72af2703a7d3d1149d3392667136d62e872e93ec53b90949d78280ec9613404e0ea04482fda7a0dbf937c83d9d95926cb3ba87997991eb4ae4b3e8e795630f9c3bde71fec263880d9fe3b3f0bb66c99b7b4d2a9ffc53d7eb15e3bcb63c6ab0d6192f8bdfa438295281bd93b99b5897ce96e464337132bf39c1140936531c6ab941627ee85214ca2a05dbec65231a1f1f79f383840d921bdd366218f79f6501d12b5fb6b5cfbde9ab47587197170eea5a632fb3dbe205e0ef929b6eddbbf7ebcc5a90fc4e66ae6872f868044ed048c8b2fda2403ce60a06da004872b7bd3f77442104ecf2f18fe2e290d2f87f72084c3df27a96fecbc99894bce32b46df032db85c1767f9930e9af1306e8df3cca512b5a6a955159681711e1efae5e566145c8eb73490999b33ab33c72cb9f801990cf8d1f1807805e6c61f775b99916bbb8d3f6b8869c613ca2cf5e831f25d2ec78ed4276405e39d9f95692eb093a3833ca20eb554226ecc83268f3332f706530fac4e690b74f215867d9a77ad7a4063abf320ba13022412107ec5e8514fa1bd3a5bfb10a2786db34a0ab6c44ab6f5c8ab8e679bc74bdaa8106097f11a137591581e1e4c62fba40f294af546a7c1e90e3913976ddb4083b8f8913ef7792a0a312ab8130e641d379a20e093d6adad8ced775a18ff8d27eef5bacfa09c6635b32df0ffcd012969ddb1797344bf43635087c8da26da74File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Diff view
Diff view
Uh oh!
There was an error while loading. Please reload this page.
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. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium