Skip to content

Add CodeQL analysis workflow configuration#83

Closed
Mtze wants to merge 3 commits intomainfrom
Mtze-patch-1
Closed

Add CodeQL analysis workflow configuration#83
Mtze wants to merge 3 commits intomainfrom
Mtze-patch-1

Conversation

@Mtze
Copy link
Copy Markdown

@Mtze Mtze commented Mar 6, 2026

This workflow file sets up CodeQL analysis for the repository, defining triggers for push and pull request events, as well as a scheduled analysis. It includes a matrix for different programming languages and their respective build modes.

Summary by CodeRabbit

  • Chores
    • Introduced automated security code analysis workflow that runs on code changes to main, pull requests, and weekly schedule. Supports multiple programming languages to enhance code quality and security scanning.

This workflow file sets up CodeQL analysis for the repository, defining triggers for push and pull request events, as well as a scheduled analysis. It includes a matrix for different programming languages and their respective build modes.
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 6, 2026

📝 Walkthrough

Walkthrough

Introduces a new CodeQL Advanced GitHub Actions workflow that automatically scans code in the repository for security vulnerabilities across multiple languages (Actions, Java-Kotlin, JavaScript-TypeScript) using a matrix strategy with configurable build modes.

Changes

Cohort / File(s) Summary
CodeQL Workflow Configuration
.github/workflows/codeql.yml
New workflow file defining CodeQL analysis job with multi-language matrix strategy, build-mode configurations, optional manual build steps, and automated scanning triggers for pushes to main, pull requests, and weekly schedules.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 Security scans now hop and bound,
CodeQL guards without a sound,
Three languages watched with care so keen,
The safest code you've ever seen!
🔐✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change—adding a CodeQL analysis workflow configuration file. It is concise, clear, and directly summarizes the primary modification.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch Mtze-patch-1

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
.github/workflows/codeql.yml (1)

14-20: Consider adding workflow_dispatch.

An on-demand trigger makes it easier to rerun CodeQL after query/config changes without pushing a no-op commit.

Suggested change
 on:
+  workflow_dispatch:
   push:
     branches: [ "main" ]
   pull_request:
     branches: [ "main" ]
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/codeql.yml around lines 14 - 20, The workflow triggers
currently include push, pull_request and schedule but lack an on-demand trigger;
add the workflow_dispatch event to the top-level on: block so maintainers can
manually run the CodeQL workflow (update the on: block alongside the existing
push, pull_request and schedule entries to include workflow_dispatch).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/codeql.yml:
- Around line 61-62: Replace floating action tags with the provided immutable
commit SHAs: change uses: actions/checkout@v4 to uses:
actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5, change
github/codeql-action/init@... to
github/codeql-action/init@dd677812177e0c29f9c970a6c58d8607ae1bfefd, and change
github/codeql-action/analyze@... to
github/codeql-action/analyze@dd677812177e0c29f9c970a6c58d8607ae1bfefd so the
workflow references immutable commit SHAs instead of floating tags (locate the
uses entries for actions/checkout and github/codeql-action/init/analyze in the
codeql.yml to apply the changes).
- Around line 35-36: The workflow unnecessarily grants the `packages: read`
permission, widening GITHUB_TOKEN scope; remove the `packages: read` entry from
the permissions block in the CodeQL workflow (the `packages: read` line in
.github/workflows/codeql.yml) so the workflow no longer requests that unused
permission.

---

Nitpick comments:
In @.github/workflows/codeql.yml:
- Around line 14-20: The workflow triggers currently include push, pull_request
and schedule but lack an on-demand trigger; add the workflow_dispatch event to
the top-level on: block so maintainers can manually run the CodeQL workflow
(update the on: block alongside the existing push, pull_request and schedule
entries to include workflow_dispatch).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1fed56c7-2e11-48fb-a61c-f5c96dd02e7e

📥 Commits

Reviewing files that changed from the base of the PR and between 284f544 and e00677a.

📒 Files selected for processing (1)
  • .github/workflows/codeql.yml

Comment on lines +61 to +62
- name: Checkout repository
uses: actions/checkout@v4
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

cat -n .github/workflows/codeql.yml

Repository: EduIDE/EduIDE-Cloud

Length of output: 5666


🏁 Script executed:

#!/bin/bash
# Resolve the exact commits currently behind the tags used here.
git ls-remote https://github.com/actions/checkout refs/tags/v4
git ls-remote https://github.com/github/codeql-action refs/tags/v4

Repository: EduIDE/EduIDE-Cloud

Length of output: 170


🏁 Script executed:

# Also check if there are other floating tags in the workflow
rg "@v[0-9]+" .github/workflows/codeql.yml -o

Repository: EduIDE/EduIDE-Cloud

Length of output: 78


Pin the GitHub Actions to immutable commit SHAs.

Using floating @v4 tags in a security workflow means upstream tag movement can change what runs without a PR in this repo. Replace with commit SHAs:

  • Line 62: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
  • Line 72: github/codeql-action/init@dd677812177e0c29f9c970a6c58d8607ae1bfefd
  • Line 101: github/codeql-action/analyze@dd677812177e0c29f9c970a6c58d8607ae1bfefd
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/codeql.yml around lines 61 - 62, Replace floating action
tags with the provided immutable commit SHAs: change uses: actions/checkout@v4
to uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5, change
github/codeql-action/init@... to
github/codeql-action/init@dd677812177e0c29f9c970a6c58d8607ae1bfefd, and change
github/codeql-action/analyze@... to
github/codeql-action/analyze@dd677812177e0c29f9c970a6c58d8607ae1bfefd so the
workflow references immutable commit SHAs instead of floating tags (locate the
uses entries for actions/checkout and github/codeql-action/init/analyze in the
codeql.yml to apply the changes).

- Remove `actions` and `java-kotlin` from the advanced workflow matrix;
  these languages are already covered by the repository's default CodeQL
  setup (Settings > Security > Code scanning) and uploading SARIF from an
  advanced configuration while the default setup is enabled raises:
  "CodeQL analyses from advanced configurations cannot be processed when
  the default setup is enabled".
- Keep `javascript-typescript`, which is not covered by the default setup
  and was already succeeding.
- Add `workflow_dispatch` trigger so the workflow can be re-run manually.
- Drop unused `packages: read` permission.
- Simplify `runs-on` (swift matrix entry removed, always ubuntu-latest).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 6, 2026 13:15
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a GitHub Actions workflow to run CodeQL “advanced” code scanning on pushes to main, PRs targeting main, manual dispatch, and a weekly schedule.

Changes:

  • Introduces .github/workflows/codeql.yml to run CodeQL analysis on repository events and a cron schedule.
  • Configures a matrix to analyze javascript-typescript with build-mode: none.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +25 to +26
- language: javascript-typescript
build-mode: none
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

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

YAML indentation under strategy.matrix.include is invalid: list items must be indented beneath include:. As written, - language: ... is at the same level as include:, which will break parsing and prevent the matrix from being created (making matrix.language/matrix.build-mode undefined).

Suggested change
- language: javascript-typescript
build-mode: none
- language: javascript-typescript
build-mode: none

Copilot uses AI. Check for mistakes.
Comment on lines +32 to +44
- name: Checkout repository
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v4
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4
with:
category: "/language:${{matrix.language}}"
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

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

steps: and the step entries are not indented under the analyze job. They need to be nested beneath jobs.analyze (e.g., steps: aligned with strategy: and each - name: indented under steps:), otherwise the workflow YAML will be invalid.

Suggested change
- name: Checkout repository
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v4
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4
with:
category: "/language:${{matrix.language}}"
- name: Checkout repository
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v4
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4
with:
category: "/language:${{matrix.language}}"

Copilot uses AI. Check for mistakes.
The repository's default CodeQL setup (Settings > Security > Code scanning)
already runs all three languages — actions, java-kotlin, and
javascript-typescript — successfully on every push and PR.

Running the advanced workflow on top of the default setup causes a hard
conflict for every language:
  "CodeQL analyses from advanced configurations cannot be processed
   when the default setup is enabled"

Since the advanced workflow provides no additional configuration (no custom
queries, same build modes), it is fully redundant. Removing it avoids the
failing checks while retaining equivalent CodeQL coverage via the default
setup.

To switch to the advanced setup in the future, first disable the default
setup under Settings > Security > Code scanning.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Mtze Mtze closed this Mar 6, 2026
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.

2 participants