Skip to content

ci: add a codeql workflow#1148

Merged
clementb49 merged 15 commits into
masterfrom
customCodeql
Apr 12, 2026
Merged

ci: add a codeql workflow#1148
clementb49 merged 15 commits into
masterfrom
customCodeql

Conversation

@clementb49

@clementb49 clementb49 commented Apr 11, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features

    • Added an advanced CodeQL workflow for deeper, scheduled security and quality scanning across languages and platforms.
  • Chores

    • Hardened CI by pinning external action references to fixed commits.
    • Added an explicit Python bytecode compilation step during CI.
    • Adjusted CI runners and setup steps (switched a job to Windows and removed unneeded Linux package installs).

Comment thread .github/workflows/codeql.yml Fixed
Comment thread .github/workflows/codeql.yml Fixed
Comment thread .github/workflows/build_app.yml Fixed
Comment thread .github/workflows/codeql.yml Fixed
Comment thread .github/workflows/copilot-setup-steps.yml Fixed
Comment thread .github/workflows/localization.yml Fixed
Comment thread .github/workflows/ruff.yml Fixed
@clementb49
clementb49 marked this pull request as ready for review April 12, 2026 10:13
@coderabbitai

coderabbitai Bot commented Apr 12, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 1d3ace87-7e87-40e8-b1af-f1fa70224787

📥 Commits

Reviewing files that changed from the base of the PR and between 5e6bebb and 79b7f54.

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

Walkthrough

Pins several GitHub Actions to specific commit SHAs, adds a new CodeQL Advanced workflow, switches the copilot-setup job runner to Windows, and inserts explicit Python bytecode compilation steps into CI workflows.

Changes

Cohort / File(s) Summary
CI action pinning
.github/workflows/ruff.yml, .github/workflows/localization.yml, .github/workflows/update_localization.yml, .github/workflows/create_release.yml, .github/workflows/build_app.yml
Replaced floating action tags with pinned commit SHAs for multiple uses: steps (e.g., actions/checkout, astral-sh/*, actions/upload-artifact, actions/download-artifact, crowdin/github-action, softprops/action-gh-release).
Copilot job & runner
.github/workflows/copilot-setup-steps.yml
Changed runner from ubuntu-latest to windows-latest; removed Ubuntu-specific wxPython apt install steps; pinned actions/checkout and astral-sh/setup-uv to SHAs.
CodeQL (new)
.github/workflows/codeql.yml
Added new "CodeQL Advanced" workflow with a language/OS matrix (actions on Ubuntu, python on Windows), explicit permissions, CodeQL init/analyze steps, enabled query packs, and a guard for manual build-mode.
Python bytecode compile step
.github/workflows/build_app.yml, .github/workflows/codeql.yml
Inserted step to compile Python bytecode via uv run -m compileall -f -o 1 for .\basilisk and .\tests after dependency installation (also run in CodeQL Python matrix entry).

Sequence Diagram(s)

sequenceDiagram
    participant Repo as Repo (checkout)
    participant Runner as Runner (ubuntu/windows)
    participant UV as UV (astral-sh/setup-uv)
    participant Compile as Compile (python -m compileall)
    participant CodeQLInit as CodeQL Init (github/codeql-action/init)
    participant CodeQLAn as CodeQL Analyze (github/codeql-action/analyze)

    Note over Repo,Runner: CodeQL Advanced workflow (matrix: actions/python)
    Repo->>Runner: checkout repository
    Runner->>UV: setup uv & uv sync (install deps)
    Runner->>Compile: uv run -m compileall (.\basilisk, .\tests)
    Runner->>CodeQLInit: init CodeQL (query packs & analysis-kinds)
    Runner->>CodeQLAn: run CodeQL analyze
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

dependencies

🚥 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 PR title 'ci: add a codeql workflow' accurately describes the primary change - adding a new CodeQL workflow file (.github/workflows/codeql.yml), though it doesn't mention that multiple other workflows were also updated with pinned GitHub Actions versions.
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
  • Commit unit tests in branch customCodeql

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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:
- Line 56: Replace mutable action tags with immutable commit SHAs: find the
three usages actions/checkout@v4, github/codeql-action/init@v4, and
github/codeql-action/analyze@v4 in the CodeQL workflow and pin each to the
corresponding full commit SHA for that action (the same pattern used for
astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57). For each
identifier (actions/checkout, github/codeql-action/init,
github/codeql-action/analyze) look up the latest stable release commit on the
action's GitHub repo, replace the `@v4` tag with @<full-commit-sha>, and run a
workflow lint/quick test to ensure the pinned refs are valid.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: e804c75d-8dd6-4974-97d0-b29e84c0cd31

📥 Commits

Reviewing files that changed from the base of the PR and between a00dfda and e285008.

📒 Files selected for processing (5)
  • .github/workflows/build_app.yml
  • .github/workflows/codeql.yml
  • .github/workflows/copilot-setup-steps.yml
  • .github/workflows/localization.yml
  • .github/workflows/ruff.yml

Comment thread .github/workflows/codeql.yml Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

♻️ Duplicate comments (1)
.github/workflows/codeql.yml (1)

77-77: ⚠️ Potential issue | 🟠 Major

Pin github/codeql-action refs to immutable SHAs.

This workflow still uses mutable @v4 tags for init and analyze in a security-critical pipeline.

#!/bin/bash
# Verify mutable refs still present in CodeQL workflow.
rg -n 'uses:\s*github/codeql-action/(init|analyze)@v[0-9]+' .github/workflows/codeql.yml
# Expected after fix: no matches

Also applies to: 107-107

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/codeql.yml at line 77, The workflow is using mutable tags
github/codeql-action/init@v4 and github/codeql-action/analyze@v4; replace both
uses entries with the corresponding immutable commit SHAs for the v4 release
(i.e., change github/codeql-action/init@v4 → github/codeql-action/init@<SHA> and
github/codeql-action/analyze@v4 → github/codeql-action/analyze@<SHA>), ensuring
you pick the canonical commit SHA from the CodeQL Action repo for the v4 release
so the workflow is pinned to immutable refs.
🤖 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 5-7: The YAML branch lists under the keys "branches" for both the
workflow and pull_request entries have spacing that violates the linter; update
them to use proper YAML sequence formatting by replacing bracketed inline lists
like branches: [ "master" ] with either a plain sequence (branches: - master) or
a compact, lint-acceptable inline form without extra spaces (branches:
["master"]); modify the entries associated with the "branches" keys in the
workflow definition to use one of these valid formats so the YAML linter passes.

In @.github/workflows/localization.yml:
- Around line 26-28: The upload_on_crowdin job is using the mutable
actions/checkout@v6 which can drift; update the workflow to pin it to the same
commit used elsewhere by replacing the actions/checkout reference in the
upload_on_crowdin job with the commit SHA
de0fac2e4500dabe0009e67214ff5f5447ce83dd so both generate_pot and
upload_on_crowdin use the identical pinned action; locate the upload_on_crowdin
job and change its uses value for actions/checkout accordingly.

---

Duplicate comments:
In @.github/workflows/codeql.yml:
- Line 77: The workflow is using mutable tags github/codeql-action/init@v4 and
github/codeql-action/analyze@v4; replace both uses entries with the
corresponding immutable commit SHAs for the v4 release (i.e., change
github/codeql-action/init@v4 → github/codeql-action/init@<SHA> and
github/codeql-action/analyze@v4 → github/codeql-action/analyze@<SHA>), ensuring
you pick the canonical commit SHA from the CodeQL Action repo for the v4 release
so the workflow is pinned to immutable refs.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 39c59a5f-6efc-4639-875a-9383f9cd357f

📥 Commits

Reviewing files that changed from the base of the PR and between e285008 and f62f543.

📒 Files selected for processing (6)
  • .github/workflows/build_app.yml
  • .github/workflows/codeql.yml
  • .github/workflows/copilot-setup-steps.yml
  • .github/workflows/localization.yml
  • .github/workflows/ruff.yml
  • .github/workflows/update_localization.yml

Comment thread .github/workflows/codeql.yml Outdated
Comment thread .github/workflows/localization.yml

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
.github/workflows/codeql.yml (1)

5-7: ⚠️ Potential issue | 🟡 Minor

Fix inline branch list spacing to satisfy YAML lint.

At Line 5 and Line 7, [ "master" ] violates the bracket-spacing rule.

Proposed fix
-    branches: [ "master" ]
+    branches: ["master"]
@@
-    branches: [ "master" ]
+    branches: ["master"]
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/codeql.yml around lines 5 - 7, The YAML linter flags
bracket spacing for the branches arrays in the CodeQL workflow; update both
occurrences of the branches entries (the top-level branches key and the
pull_request.branches key) to use proper YAML array spacing (e.g., remove tight
brackets or add spaces around elements) so they conform to the bracket-spacing
rule and pass linting; locate the branches arrays in
.github/workflows/codeql.yml (the lines defining branches: [ "master" ]) and
replace them with the correctly spaced YAML array form.
🤖 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/ruff.yml:
- Line 15: The workflow currently uses astral-sh/ruff-action without an explicit
patch pin ("uses: astral-sh/ruff-action@4919ec5c...") which defers to
pyproject.toml's ruff range; if you want strict patch-level reproducibility, add
the action input with.version set to the desired pinned patch (e.g.,
with.version: "0.15.10") in the same job step that references the action (the
step using astral-sh/ruff-action) so the runner always uses that exact ruff
patch instead of any newer patch within the pyproject.toml range.

---

Duplicate comments:
In @.github/workflows/codeql.yml:
- Around line 5-7: The YAML linter flags bracket spacing for the branches arrays
in the CodeQL workflow; update both occurrences of the branches entries (the
top-level branches key and the pull_request.branches key) to use proper YAML
array spacing (e.g., remove tight brackets or add spaces around elements) so
they conform to the bracket-spacing rule and pass linting; locate the branches
arrays in .github/workflows/codeql.yml (the lines defining branches: [ "master"
]) and replace them with the correctly spaced YAML array form.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 83c9cfde-3c37-45de-b09d-a1199a10b92e

📥 Commits

Reviewing files that changed from the base of the PR and between f62f543 and 5e6bebb.

📒 Files selected for processing (7)
  • .github/workflows/build_app.yml
  • .github/workflows/codeql.yml
  • .github/workflows/copilot-setup-steps.yml
  • .github/workflows/create_release.yml
  • .github/workflows/localization.yml
  • .github/workflows/ruff.yml
  • .github/workflows/update_localization.yml

Comment thread .github/workflows/ruff.yml
@clementb49
clementb49 merged commit 110b612 into master Apr 12, 2026
10 of 11 checks passed
@clementb49
clementb49 deleted the customCodeql branch April 12, 2026 11:32
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