fix: making codeql explicit so that we hopefully get rid of the CI errors#77
fix: making codeql explicit so that we hopefully get rid of the CI errors#77constantinius wants to merge 1 commit intomainfrom
Conversation
| name: Analyze | ||
| runs-on: ubuntu-latest | ||
|
|
||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| language: ["javascript"] | ||
| # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] | ||
| # Learn more: | ||
| # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v3 | ||
|
|
||
| # Initializes the CodeQL tools for scanning. | ||
| - name: Initialize CodeQL | ||
| uses: github/codeql-action/init@v3 | ||
| with: | ||
| languages: ${{ matrix.language }} | ||
| # If you wish to specify custom queries, you can do so here or in a config file. | ||
| # By default, queries listed here will override any specified in a config file. | ||
| # Prefix the list here with "+" to use these queries and those in the config file. | ||
| # queries: ./path/to/local/query, your-org/your-repo/queries@main | ||
|
|
||
| # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). | ||
| # If this step fails, then you should remove it and run the build manually (see below) | ||
| - name: Autobuild | ||
| uses: github/codeql-action/autobuild@v3 | ||
|
|
||
| # ℹ️ Command-line programs to run using the OS shell. | ||
| # 📚 https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions | ||
|
|
||
| # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines | ||
| # and modify them (or add more) to build your code if your project | ||
| # uses a compiled language | ||
|
|
||
| #- run: | | ||
| # make bootstrap | ||
| # make release | ||
|
|
||
| - name: Perform CodeQL Analysis | ||
| uses: github/codeql-action/analyze@v3 |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 7 days ago
In general, the fix is to explicitly declare permissions for the GITHUB_TOKEN in the workflow, restricting them to the least privileges required. For a CodeQL analysis workflow that only needs to checkout the code and run analysis, contents: read is typically sufficient. Adding permissions at the job level (jobs.analyze.permissions) ensures only this job is affected and keeps behavior clear.
The single best fix here is to add a permissions block under jobs.analyze alongside runs-on, strategy, etc. This leaves existing functionality unchanged, since CodeQL and actions/checkout work fine with read-only contents. Concretely, in .github/workflows/codeql-analysis.yml, after the runs-on: ubuntu-latest line (line 24), insert:
permissions:
contents: readNo additional imports, methods, or definitions are required because this is purely a configuration change in the workflow YAML.
| @@ -22,6 +22,8 @@ | ||
| analyze: | ||
| name: Analyze | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
|
|
||
| strategy: | ||
| fail-fast: false |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Missing required permissions for CodeQL analysis upload
- Added the workflow-level permissions block with actions: read, contents: read, and security-events: write so CodeQL can upload SARIF results successfully.
Or push these changes by commenting:
@cursor push 1c757ef919
Preview (1c757ef919)
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -18,6 +18,11 @@
# The branches below must be a subset of the branches above
branches: [main]
+permissions:
+ actions: read
+ contents: read
+ security-events: write
+
jobs:
analyze:
name: Analyze| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| language: ["javascript"] |
There was a problem hiding this comment.
Missing required permissions for CodeQL analysis upload
High Severity
The workflow is missing a permissions block. The Perform CodeQL Analysis step needs security-events: write to upload SARIF results to GitHub's security tab, and contents: read / actions: read are also conventionally required. Without security-events: write, the analyze step will fail with a permissions error, which directly contradicts the PR's goal of fixing CI errors. The existing daily-tests.yml shows the repo already uses explicit permissions blocks.
🟡 AI SDK Integration Test ResultsStatus: 210 tests failing (no regressions) Summary
Test Matrix
Legend: ✅ Pass | ❌ Fail | ✅🔧 Fixed | ❌📉 Regressed | ✅🆕 New (pass) | ❌🆕 New (fail) | 🗑️ Removed Generated by AI SDK Integration Tests |



No description provided.