Skip to content

fix: making codeql explicit so that we hopefully get rid of the CI errors#77

Open
constantinius wants to merge 1 commit intomainfrom
constantinius/fix/explicit-codeql
Open

fix: making codeql explicit so that we hopefully get rid of the CI errors#77
constantinius wants to merge 1 commit intomainfrom
constantinius/fix/explicit-codeql

Conversation

@constantinius
Copy link
Collaborator

No description provided.

Comment on lines +23 to +65
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

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}

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: read

No additional imports, methods, or definitions are required because this is purely a configuration change in the workflow YAML.

Suggested changeset 1
.github/workflows/codeql-analysis.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
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
@@ -22,6 +22,8 @@
   analyze:
     name: Analyze
     runs-on: ubuntu-latest
+    permissions:
+      contents: read
 
     strategy:
       fail-fast: false
EOF
@@ -22,6 +22,8 @@
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
contents: read

strategy:
fail-fast: false
Copilot is powered by AI and may make mistakes. Always verify output.
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Create PR

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
This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

strategy:
fail-fast: false
matrix:
language: ["javascript"]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

@github-actions
Copy link

github-actions bot commented Mar 3, 2026

🟡 AI SDK Integration Test Results

Status: 210 tests failing (no regressions)

Summary

Metric main PR Change
Total Tests 372 372
Passed 149 149
Failed 210 210

Test Matrix

SDK Basic Agent Test Basic Agent Test (async) Basic Agent Test (blocking) Basic Agent Test (streaming) Basic Agent Test (sync) Basic Embeddings Test (async, blocking) Basic Embeddings Test (blocking) Basic Embeddings Test (sync, blocking) Basic Error LLM Test (async, blocking) Basic Error LLM Test (async, streaming) Basic Error LLM Test (blocking) Basic Error LLM Test (streaming) Basic Error LLM Test (sync, blocking) Basic Error LLM Test (sync, streaming) Basic LLM Test (async, blocking) Basic LLM Test (async, streaming) Basic LLM Test (blocking) Basic LLM Test (streaming) Basic LLM Test (sync, blocking) Basic LLM Test (sync, streaming) Conversation ID Agent Test Conversation ID Agent Test (async) Conversation ID Agent Test (blocking) Conversation ID Agent Test (streaming) Conversation ID Agent Test (sync) Conversation ID LLM Test (async, blocking) Conversation ID LLM Test (async, streaming) Conversation ID LLM Test (blocking) Conversation ID LLM Test (streaming) Conversation ID LLM Test (sync, blocking) Conversation ID LLM Test (sync, streaming) Long Input Agent Test Long Input Agent Test (async) Long Input Agent Test (blocking) Long Input Agent Test (streaming) Long Input Agent Test (sync) Long Input LLM Test (async, blocking) Long Input LLM Test (async, streaming) Long Input LLM Test (blocking) Long Input LLM Test (streaming) Long Input LLM Test (sync, blocking) Long Input LLM Test (sync, streaming) Multi-Turn LLM Test (async, blocking) Multi-Turn LLM Test (async, streaming) Multi-Turn LLM Test (blocking) Multi-Turn LLM Test (streaming) Multi-Turn LLM Test (sync, blocking) Multi-Turn LLM Test (sync, streaming) Tool Call Agent Test Tool Call Agent Test (async) Tool Call Agent Test (blocking) Tool Call Agent Test (streaming) Tool Call Agent Test (sync) Tool Error Agent Test Tool Error Agent Test (async) Tool Error Agent Test (blocking) Tool Error Agent Test (streaming) Tool Error Agent Test (sync) Vision Agent Test Vision Agent Test (async) Vision Agent Test (blocking) Vision Agent Test (streaming) Vision Agent Test (sync) Vision LLM Test (async, blocking) Vision LLM Test (async, streaming) Vision LLM Test (blocking) Vision LLM Test (streaming) Vision LLM Test (sync, blocking) Vision LLM Test (sync, streaming)
browser/anthropic
browser/google-genai
browser/langchain
browser/openai
nextjs/anthropic
nextjs/google-genai
nextjs/langchain
nextjs/mastra
nextjs/openai
nextjs/vercel
node/anthropic
node/google-genai
node/langchain
node/manual
node/mastra
node/openai
node/vercel
php/laravel
python/anthropic
python/google-genai
python/langchain
python/langgraph
python/litellm
python/manual
python/openai
python/openai-agents
python/pydantic-ai

Legend: ✅ Pass | ❌ Fail | ✅🔧 Fixed | ❌📉 Regressed | ✅🆕 New (pass) | ❌🆕 New (fail) | 🗑️ Removed


Generated by AI SDK Integration Tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant