Skip to content

Create codeql.yml - #199

Merged
marlon-costa-dc merged 2 commits into
developfrom
marlon-costa-dc-patch-1
Aug 11, 2026
Merged

Create codeql.yml#199
marlon-costa-dc merged 2 commits into
developfrom
marlon-costa-dc-patch-1

Conversation

@marlon-costa-dc

@marlon-costa-dc marlon-costa-dc commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Summary by cubic

Adds a CodeQL Advanced workflow to scan Actions, JS/TS, Python, and Rust on pushes and PRs to develop, plus a weekly run. Pins actions/checkout@v7.0.1 and sets explicit permissions to support private packs.

  • New Features
    • Adds .github/workflows/codeql.yml with a language matrix (actions, javascript-typescript, python, rust) using build-mode none.
    • Triggers on push/PR to develop and a weekly cron (20 8 * * 6).
    • Uses github/codeql-action@v4, runs on ubuntu-latest (or macos-latest for swift), pins actions/checkout@v7.0.1, and sets security-events: write, packages: read, actions: read, contents: read.

Written for commit fcf9393. Summary will update on new commits.

Review in cubic

@marlon-costa-dc
marlon-costa-dc enabled auto-merge (squash) August 10, 2026 23:29
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • Chores
    • Added automated security analysis for GitHub Actions, JavaScript/TypeScript, Python, and Rust code.
    • Security checks run automatically when changes are pushed or submitted for review against the development branch.
    • Analysis also runs weekly to help identify newly discovered security issues.
    • Supports optional build steps before analysis for projects that require them.

Walkthrough

Adds a GitHub Actions CodeQL workflow. The workflow runs for selected repository events and weekly. It analyzes Actions, JavaScript/TypeScript, Python, and Rust.

Changes

CodeQL workflow

Layer / File(s) Summary
Workflow triggers and analysis matrix
.github/workflows/codeql.yml
The workflow runs on pushes, pull requests targeting develop, and a weekly schedule. The matrix covers Actions, JavaScript/TypeScript, Python, and Rust with build modes, runner settings, and permissions.
CodeQL analysis execution
.github/workflows/codeql.yml
The job checks out the repository and initializes CodeQL. Manual build entries run a placeholder command that exits with failure. The workflow then runs CodeQL analysis with a language-specific category.

Estimated code review effort: 2 (Simple) | ~10 minutes

Poem

A rabbit checks the code at night,
Four languages hop into sight.
The workflow runs on schedule true,
Scans each branch the whole week through.
“No bugs in my burrow!” says Bunny.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The description clearly explains the new CodeQL workflow, its triggers, languages, permissions, and actions.
Title check ✅ Passed The title identifies the main change by naming the new CodeQL workflow file.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch marlon-costa-dc-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.

@github-advanced-security

Copy link
Copy Markdown
Contributor

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@qodo-code-review

qodo-code-review Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

PR Summary by Qodo

Add CodeQL Advanced workflow for multi-language security scanning

⚙️ Configuration changes ✨ Enhancement 🕐 10-20 Minutes

Grey Divider

AI Description

• Add CodeQL Advanced GitHub Actions workflow for code scanning.
• Run scans on push/PR to develop plus a weekly scheduled job.
• Analyze Actions, JS/TS, Python, and Rust via a matrix job.
Diagram

graph TD
  A["Push/PR/Schedule trigger"] --> B["Workflow: codeql.yml"] --> C["Matrix job (4 languages)"] --> D["codeql-action/init"] --> E["codeql-action/analyze"] --> F[("Code scanning alerts")]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Set Rust to autobuild/manual instead of build-mode: none
  • ➕ More reliable extraction for compiled Rust targets (avoids empty/failed analysis)
  • ➕ Enables deeper findings for Rust code paths
  • ➖ Requires toolchain/setup steps and possibly longer CI time
  • ➖ May need repo-specific build commands (workspace/features)
2. Add a CodeQL config file + query suites
  • ➕ Centralizes exclusions (generated code, vendor dirs) and enables security-extended/security-and-quality packs
  • ➕ More consistent scanning across future workflow edits
  • ➖ Slightly more upfront configuration/maintenance
  • ➖ Requires agreement on exclusions to avoid missing issues
3. Add workflow_dispatch and/or path filters
  • ➕ Allows on-demand scans (e.g., after dependency bumps)
  • ➕ Reduces noise/cost by skipping scans for docs-only changes
  • ➖ More trigger complexity
  • ➖ Path filters can accidentally skip relevant security changes if misconfigured

Recommendation: The current workflow is a good baseline, but verify Rust scanning works with build-mode: none in this repo. For a Rust-heavy codebase, switch Rust to autobuild (or manual with explicit cargo build) and add any needed toolchain setup; keep none for Actions/JS/Python if appropriate. Consider adding workflow_dispatch for on-demand scans and a CodeQL config file if you need consistent exclusions/query suites.

Files changed (1) +105 / -0

Other (1) +105 / -0
codeql.ymlAdd CodeQL Advanced scanning workflow with a multi-language matrix +105/-0

Add CodeQL Advanced scanning workflow with a multi-language matrix

• Introduces a new GitHub Actions workflow that runs CodeQL Advanced on pushes and PRs targeting 'develop', plus a weekly cron schedule. Configures a matrix to analyze Actions, JavaScript/TypeScript, Python, and Rust using 'github/codeql-action' init/analyze steps with code-scanning permissions.

.github/workflows/codeql.yml

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/codeql.yml:
- Line 64: Pin all GitHub Actions references in .github/workflows/codeql.yml at
lines 64, 74, and 103 to the specified full commit SHAs: use the checkout SHA
for actions/checkout and the provided CodeQL SHA for both
github/codeql-action/init and github/codeql-action/analyze.
🪄 Autofix

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: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 5897b173-80ca-4e92-be5f-990a775de165

📥 Commits

Reviewing files that changed from the base of the PR and between 04ed185 and 55c9ada.

📒 Files selected for processing (1)
  • .github/workflows/codeql.yml
📜 Review details
⏰ Context from checks skipped due to timeout. (7)
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: Analyze (python)
  • GitHub Check: Analyze (actions)
  • GitHub Check: Analyze (rust)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: ci
🧰 Additional context used
🪛 zizmor (1.29.0)
.github/workflows/codeql.yml

[warning] 63-72: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false

(artipacked)


[error] 64-64: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)


[error] 74-74: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)


[error] 103-103: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)


[warning] 33-33: permissions without explanatory comments (undocumented-permissions): needs an explanatory comment

(undocumented-permissions)


[warning] 14-20: insufficient job-level concurrency limits (concurrency-limits): workflow is missing concurrency setting

(concurrency-limits)

Comment thread .github/workflows/codeql.yml Outdated
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
steps:
- name: Checkout repository
uses: actions/checkout@v7

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

for action in \
  'actions/checkout@v7' \
  'github/codeql-action/init@v4' \
  'github/codeql-action/analyze@v4'
do
  repository="${action%@*}"
  ref="${action#*@}"
  sha="$(gh api "repos/${repository}/commits/${ref}" --jq '.sha')"
  printf '%s@%s\n' "$repository" "$sha"
done

Repository: marlonsc/mcb

Length of output: 233


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

printf '%s\n' '--- workflow references ---'
cat -n .github/workflows/codeql.yml | sed -n '55,110p'

resolve_tag() {
  local repository="$1" tag="$2" ref_json object_type object_sha commit_sha
  ref_json="$(gh api "repos/${repository}/git/ref/tags/${tag}")"
  object_type="$(jq -r '.object.type' <<<"$ref_json")"
  object_sha="$(jq -r '.object.sha' <<<"$ref_json")"

  if [[ "$object_type" == tag ]]; then
    commit_sha="$(gh api "repos/${repository}/git/tags/${object_sha}" --jq '.object.sha')"
  elif [[ "$object_type" == commit ]]; then
    commit_sha="$object_sha"
  else
    printf 'unexpected tag object type: %s\n' "$object_type" >&2
    return 1
  fi

  gh api "repos/${repository}/commits/${commit_sha}" --jq \
    '"\(.sha) \(.commit.message | split("\n")[0])"'
}

printf '%s\n' '--- actions/checkout v7 ---'
resolve_tag actions/checkout v7

printf '%s\n' '--- github/codeql-action v4 ---'
resolve_tag github/codeql-action v4

Repository: marlonsc/mcb

Length of output: 3731


Pin the GitHub Actions to full commit SHAs.

  • actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
  • github/codeql-action/init@5595ccaf912efad79be6eef63a5619ff05969be3
  • github/codeql-action/analyze@5595ccaf912efad79be6eef63a5619ff05969be3
🧰 Tools
🪛 zizmor (1.29.0)

[error] 64-64: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)

📍 Affects 1 file
  • .github/workflows/codeql.yml#L64-L64 (this comment)
  • .github/workflows/codeql.yml#L74-L74
  • .github/workflows/codeql.yml#L103-L103
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/codeql.yml at line 64, Pin all GitHub Actions references
in .github/workflows/codeql.yml at lines 64, 74, and 103 to the specified full
commit SHAs: use the checkout SHA for actions/checkout and the provided CodeQL
SHA for both github/codeql-action/init and github/codeql-action/analyze.

Source: Linters/SAST tools

@qodo-code-review

qodo-code-review Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (3) 📘 Rule violations (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Scheduled scan wrong branch 🐞 Bug ☼ Reliability
Description
The weekly schedule run will execute from the repository’s default branch workflow context, but
this workflow’s event-driven triggers are scoped to develop, so the scheduled CodeQL run may
analyze the default branch rather than develop. In this repo, other workflows gate deploy behavior
on refs/heads/main, so without an explicit checkout ref for scheduled events, the weekly scan can
diverge from the develop branch you’re targeting on push/PR.
Code

.github/workflows/codeql.yml[R17-20]

+  pull_request:
+    branches: [ "develop" ]
+  schedule:
+    - cron: '20 8 * * 6'
Relevance

●●● Strong

Repo prefers explicitly pinning workflow branch refs; likely to add ref: develop to align
scheduled scans.

PR-#90
PR-#189

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The workflow defines schedule alongside push/PR triggers restricted to develop, and the
repository has workflows that explicitly gate deploy behavior on refs/heads/main, indicating that
scheduled scans may not align with develop unless checkout is pinned for scheduled events.

.github/workflows/codeql.yml[14-20]
.github/workflows/docs.yml[142-159]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
The CodeQL workflow runs on a weekly schedule, but scheduled runs use the default-branch workflow context and your checkout step does not pin a ref. This can result in the scheduled scan analyzing the default branch instead of `develop`, while push/PR scans are limited to `develop`.

### Issue Context
This repo appears to treat `main` as a primary branch for deployments (docs workflow gates Pages operations on `refs/heads/main`), so it’s important the scheduled scan matches the intended target branch.

### Fix Focus Areas
- .github/workflows/codeql.yml[14-20]

### Suggested change
Conditionally pin checkout to `develop` for scheduled runs only, leaving push/PR behavior unchanged. For example:

```yml
- name: Checkout repository
 uses: actions/checkout@v7
 with:
   ref: ${{ github.event_name == 'schedule' && 'develop' || github.ref }}
```

(Alternatively, if you want weekly scanning on the default branch, clarify that intention and consider aligning push/PR branch filters accordingly.)

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Unpinned actions used ✓ Resolved 🐞 Bug ⛨ Security
Description
The new workflow uses mutable action tags (e.g., actions/checkout@v7 and github/codeql-action/*@v4)
and does not disable checkout credential persistence, diverging from the repo’s existing pinned-SHA
+ persist-credentials:false hardening. This increases supply-chain risk and leaves the GITHUB_TOKEN
credentials persisted in .git/config for later steps in the job.
Code

.github/workflows/codeql.yml[R63-65]

+    - name: Checkout repository
+      uses: actions/checkout@v7
+
Relevance

●●● Strong

Repo shows security-hardening tendency in workflows; likely to align with pinned SHAs and disable
persisted credentials.

PR-#105
PR-#90

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new workflow uses tag-based actions and omits persist-credentials: false, while other repo
workflows pin actions/checkout to a commit SHA and explicitly disable credential persistence.

.github/workflows/codeql.yml[62-65]
.github/workflows/codeql.yml[73-77]
.github/workflows/ci.yml[49-55]
.github/workflows/ci-matrix.yml[52-58]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The CodeQL workflow uses tag-based GitHub Actions and leaves checkout credentials persisted by default.

## Issue Context
Other workflows in this repo pin `actions/checkout` to a commit SHA and set `persist-credentials: false` to avoid leaving the token in `.git/config`.

## Fix Focus Areas
- .github/workflows/codeql.yml[63-65]
- .github/workflows/codeql.yml[73-75]
- .github/workflows/codeql.yml[102-103]

## Suggested change
1. Replace `actions/checkout@v7` with the same pinned SHA used elsewhere in the repo (or another reviewed SHA).
2. Add `with: persist-credentials: false` (and optionally `fetch-depth: 0` if needed for analysis).
3. Pin `github/codeql-action/init@v4` and `github/codeql-action/analyze@v4` to reviewed commit SHAs as well.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. CodeQL config unused 🐞 Bug ⚙ Maintainability
Description
The repo contains a CodeQL configuration file that constrains paths and query behavior, but the new
workflow does not reference it and instead selects languages via a matrix. This makes CodeQL results
inconsistent with the repo’s existing CodeQL configuration and can expand scanning scope beyond what
the config defines.
Code

.github/workflows/codeql.yml[R74-77]

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

●● Moderate

Using existing codeql-config vs matrix languages is a workflow design choice; no clear
accepted/rejected precedent found.

PR-#105

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The workflow’s matrix enables multiple languages and the init step does not pass a config file,
while the repo already has a dedicated .github/codeql-config.yml defining scanning scope and query
filters.

.github/codeql-config.yml[1-30]
.github/workflows/codeql.yml[44-53]
.github/workflows/codeql.yml[73-78]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The workflow initializes CodeQL without using the repo’s existing `.github/codeql-config.yml`, so the configured paths/query-filters are not applied.

## Issue Context
`.github/codeql-config.yml` defines `paths`, `paths-ignore`, query pack usage, and filters. The workflow currently provides `languages` via a matrix and does not supply any `config-file` input.

## Fix Focus Areas
- .github/workflows/codeql.yml[44-53]
- .github/workflows/codeql.yml[73-78]
- .github/codeql-config.yml[1-30]

## Suggested change
1. In the `github/codeql-action/init` step, add `config-file: ./.github/codeql-config.yml`.
2. Decide on a single source of truth for languages:
  - If the repo intends Rust-only scanning, reduce the matrix to just Rust.
  - If the repo intends multi-language scanning, update `.github/codeql-config.yml` accordingly (paths/ignores/queries per language) so the workflow and config remain consistent.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View review recommended (1)
4. Develop-only event scanning 🐞 Bug ◔ Observability
Description
The CodeQL workflow only runs on push/PR events for the develop branch, so changes targeting other
branches used by repo CI (e.g., main/dev) won’t get event-driven CodeQL results. This reduces timely
security feedback on those branches (even though the scheduled run still provides periodic
scanning).
Code

.github/workflows/codeql.yml[R15-18]

+  push:
+    branches: [ "develop" ]
+  pull_request:
+    branches: [ "develop" ]
Relevance

●● Moderate

Branch-limited CodeQL triggers are policy/intent dependent; no close precedent on trigger-branch
coverage found.

PR-#90

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new workflow limits push/PR triggers to develop, while the existing CI workflow is configured
to run on multiple branches including main and dev, indicating broader branch coverage in repo
automation.

.github/workflows/codeql.yml[14-20]
.github/workflows/ci.yml[12-25]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
CodeQL is only triggered for `develop` on `push` and `pull_request`, while the repo’s CI runs on additional branches.

## Issue Context
If changes are merged to `main`/`dev` (or PRs target them), this workflow won’t run on those events, reducing near-real-time scanning coverage.

## Fix Focus Areas
- .github/workflows/codeql.yml[14-20]
- .github/workflows/ci.yml[12-25]

## Suggested change
Update `on.push.branches` and `on.pull_request.branches` to include the same branch set as CI (or otherwise explicitly document/encode the intended security-scanning branch policy).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context used
✅ Compliance rules (platform): 13 rules
✅ Skills: flext-law

Grey Divider

Tip of the day
💡 Did you know, you can group findings by type and pick your Finding display, from Minimal to Full

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Previous review results

Review updated until commit fcf9393 ⚖️ Balanced

Results up to commit 55c9ada ⚖️ Balanced


🐞 Bugs (1) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Remediation recommended
1. Scheduled scan wrong branch 🐞 Bug ☼ Reliability
Description
The weekly schedule run will execute from the repository’s default branch workflow context, but
this workflow’s event-driven triggers are scoped to develop, so the scheduled CodeQL run may
analyze the default branch rather than develop. In this repo, other workflows gate deploy behavior
on refs/heads/main, so without an explicit checkout ref for scheduled events, the weekly scan can
diverge from the develop branch you’re targeting on push/PR.
Code

.github/workflows/codeql.yml[R17-20]

+  pull_request:
+    branches: [ "develop" ]
+  schedule:
+    - cron: '20 8 * * 6'
Relevance

●●● Strong

Repo prefers explicitly pinning workflow branch refs; likely to add ref: develop to align
scheduled scans.

PR-#90
PR-#189

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The workflow defines schedule alongside push/PR triggers restricted to develop, and the
repository has workflows that explicitly gate deploy behavior on refs/heads/main, indicating that
scheduled scans may not align with develop unless checkout is pinned for scheduled events.

.github/workflows/codeql.yml[14-20]
.github/workflows/docs.yml[142-159]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
The CodeQL workflow runs on a weekly schedule, but scheduled runs use the default-branch workflow context and your checkout step does not pin a ref. This can result in the scheduled scan analyzing the default branch instead of `develop`, while push/PR scans are limited to `develop`.

### Issue Context
This repo appears to treat `main` as a primary branch for deployments (docs workflow gates Pages operations on `refs/heads/main`), so it’s important the scheduled scan matches the intended target branch.

### Fix Focus Areas
- .github/workflows/codeql.yml[14-20]

### Suggested change
Conditionally pin checkout to `develop` for scheduled runs only, leaving push/PR behavior unchanged. For example:

```yml
- name: Checkout repository
 uses: actions/checkout@v7
 with:
   ref: ${{ github.event_name == 'schedule' && 'develop' || github.ref }}
```

(Alternatively, if you want weekly scanning on the default branch, clarify that intention and consider aligning push/PR branch filters accordingly.)

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Qodo Logo

Comment thread .github/workflows/codeql.yml
Comment on lines +74 to +77
uses: github/codeql-action/init@v4
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}

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.

Remediation recommended

2. Codeql config unused 🐞 Bug ⚙ Maintainability

The repo contains a CodeQL configuration file that constrains paths and query behavior, but the new
workflow does not reference it and instead selects languages via a matrix. This makes CodeQL results
inconsistent with the repo’s existing CodeQL configuration and can expand scanning scope beyond what
the config defines.
Agent Prompt
## Issue description
The workflow initializes CodeQL without using the repo’s existing `.github/codeql-config.yml`, so the configured paths/query-filters are not applied.

## Issue Context
`.github/codeql-config.yml` defines `paths`, `paths-ignore`, query pack usage, and filters. The workflow currently provides `languages` via a matrix and does not supply any `config-file` input.

## Fix Focus Areas
- .github/workflows/codeql.yml[44-53]
- .github/workflows/codeql.yml[73-78]
- .github/codeql-config.yml[1-30]

## Suggested change
1. In the `github/codeql-action/init` step, add `config-file: ./.github/codeql-config.yml`.
2. Decide on a single source of truth for languages:
   - If the repo intends Rust-only scanning, reduce the matrix to just Rust.
   - If the repo intends multi-language scanning, update `.github/codeql-config.yml` accordingly (paths/ignores/queries per language) so the workflow and config remain consistent.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +15 to +18
push:
branches: [ "develop" ]
pull_request:
branches: [ "develop" ]

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.

Remediation recommended

3. Develop-only event scanning 🐞 Bug ◔ Observability

The CodeQL workflow only runs on push/PR events for the develop branch, so changes targeting other
branches used by repo CI (e.g., main/dev) won’t get event-driven CodeQL results. This reduces timely
security feedback on those branches (even though the scheduled run still provides periodic
scanning).
Agent Prompt
## Issue description
CodeQL is only triggered for `develop` on `push` and `pull_request`, while the repo’s CI runs on additional branches.

## Issue Context
If changes are merged to `main`/`dev` (or PRs target them), this workflow won’t run on those events, reducing near-real-time scanning coverage.

## Fix Focus Areas
- .github/workflows/codeql.yml[14-20]
- .github/workflows/ci.yml[12-25]

## Suggested change
Update `on.push.branches` and `on.pull_request.branches` to include the same branch set as CI (or otherwise explicitly document/encode the intended security-scanning branch policy).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +17 to +20
pull_request:
branches: [ "develop" ]
schedule:
- cron: '20 8 * * 6'

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.

Remediation recommended

1. Scheduled scan wrong branch 🐞 Bug ☼ Reliability

The weekly schedule run will execute from the repository’s default branch workflow context, but
this workflow’s event-driven triggers are scoped to develop, so the scheduled CodeQL run may
analyze the default branch rather than develop. In this repo, other workflows gate deploy behavior
on refs/heads/main, so without an explicit checkout ref for scheduled events, the weekly scan can
diverge from the develop branch you’re targeting on push/PR.
Agent Prompt
### Issue description
The CodeQL workflow runs on a weekly schedule, but scheduled runs use the default-branch workflow context and your checkout step does not pin a ref. This can result in the scheduled scan analyzing the default branch instead of `develop`, while push/PR scans are limited to `develop`.

### Issue Context
This repo appears to treat `main` as a primary branch for deployments (docs workflow gates Pages operations on `refs/heads/main`), so it’s important the scheduled scan matches the intended target branch.

### Fix Focus Areas
- .github/workflows/codeql.yml[14-20]

### Suggested change
Conditionally pin checkout to `develop` for scheduled runs only, leaving push/PR behavior unchanged. For example:

```yml
- name: Checkout repository
  uses: actions/checkout@v7
  with:
    ref: ${{ github.event_name == 'schedule' && 'develop' || github.ref }}
```

(Alternatively, if you want weekly scanning on the default branch, clarify that intention and consider aligning push/PR branch filters accordingly.)

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

@qodo-code-review

Copy link
Copy Markdown
Contributor

Code review by qodo was updated up to the latest commit 55c9ada

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

4 issues found across 1 file

Confidence score: 3/5

  • In .github/workflows/codeql.yml, using mutable action tags (actions/checkout@v7, github/codeql-action/*@v4) and leaving checkout credentials persisted increases supply-chain and token-exposure risk if an upstream tag changes unexpectedly — pin each action to a commit SHA and set persist-credentials: false on checkout.
  • In .github/workflows/codeql.yml, the CodeQL init step does not pass the repository’s .github/codeql-config.yml, so intended query sets and path exclusions may be skipped, reducing scan accuracy and potentially missing findings — wire config-file into init.
  • In .github/workflows/codeql.yml, triggers are limited to develop even though the default branch is main, which can leave key branches under-scanned and delay security feedback — align push/PR branch filters with the branches used by the repo’s other CI workflows.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name=".github/workflows/codeql.yml">

<violation number="1" location=".github/workflows/codeql.yml:16">
P2: This workflow is gated to trigger only on the `develop` branch for both push and pull_request, but the repository's default branch is `main` and the existing CI workflows run on `dev`, `develop`, `0.12.0-dev`, and `main` (see ci.yml). Because of that, code merged or opened as a PR against `main` — where releases happen — will bypass CodeQL scanning entirely. Consider widening the trigger branches to match the CI workflow (e.g. include `main`, `dev`, `0.12.0-dev`) so the default/release branch is covered too.</violation>

<violation number="2" location=".github/workflows/codeql.yml:64">
P2: This new workflow references third-party actions by mutable major-version tags (`actions/checkout@v7`, `github/codeql-action/init@v4`, `github/codeql-action/analyze@v4`), while every other workflow in this repository pins actions to full commit SHAs with a version comment (e.g. `actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1`). Floating tags are unverifiable and can be silently retargeted, which weakens the repo's supply-chain hardening. Consider pinning these three `uses` lines to the specific release SHAs (mirroring the convention used in ci.yml/docs.yml) to stay consistent and auditable.</violation>

<violation number="3" location=".github/workflows/codeql.yml:64">
P2: This workflow references actions/checkout@v7 and github/codeql-action/init@v4 / analyze@v4 by mutable version tags instead of pinning to a commit SHA, and does not set persist-credentials: false on checkout. This diverges from the pinned-SHA + persist-credentials:false hardening used elsewhere in the repo's workflows and increases supply-chain risk since tags can be moved to point at different code.</violation>

<violation number="4" location=".github/workflows/codeql.yml:77">
P2: The `init` step never passes `config-file`, so the repository's existing `.github/codeql-config.yml` is not applied by this workflow — its `security-and-quality` queries and `paths`/`paths-ignore` exclusions will be ignored, and analysis falls back to the default query set with default paths. Add `config-file: .github/codeql-config.yml` under `with:`.</violation>
</file>

Shadow auto-approve: would not auto-approve because issues were found.

Re-trigger cubic


on:
push:
branches: [ "develop" ]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: This workflow is gated to trigger only on the develop branch for both push and pull_request, but the repository's default branch is main and the existing CI workflows run on dev, develop, 0.12.0-dev, and main (see ci.yml). Because of that, code merged or opened as a PR against main — where releases happen — will bypass CodeQL scanning entirely. Consider widening the trigger branches to match the CI workflow (e.g. include main, dev, 0.12.0-dev) so the default/release branch is covered too.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/workflows/codeql.yml, line 16:

<comment>This workflow is gated to trigger only on the `develop` branch for both push and pull_request, but the repository's default branch is `main` and the existing CI workflows run on `dev`, `develop`, `0.12.0-dev`, and `main` (see ci.yml). Because of that, code merged or opened as a PR against `main` — where releases happen — will bypass CodeQL scanning entirely. Consider widening the trigger branches to match the CI workflow (e.g. include `main`, `dev`, `0.12.0-dev`) so the default/release branch is covered too.</comment>

<file context>
@@ -0,0 +1,105 @@
+
+on:
+  push:
+    branches: [ "develop" ]
+  pull_request:
+    branches: [ "develop" ]
</file context>

Comment thread .github/workflows/codeql.yml Outdated
uses: github/codeql-action/init@v4
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: The init step never passes config-file, so the repository's existing .github/codeql-config.yml is not applied by this workflow — its security-and-quality queries and paths/paths-ignore exclusions will be ignored, and analysis falls back to the default query set with default paths. Add config-file: .github/codeql-config.yml under with:.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/workflows/codeql.yml, line 77:

<comment>The `init` step never passes `config-file`, so the repository's existing `.github/codeql-config.yml` is not applied by this workflow — its `security-and-quality` queries and `paths`/`paths-ignore` exclusions will be ignored, and analysis falls back to the default query set with default paths. Add `config-file: .github/codeql-config.yml` under `with:`.</comment>

<file context>
@@ -0,0 +1,105 @@
+      uses: github/codeql-action/init@v4
+      with:
+        languages: ${{ matrix.language }}
+        build-mode: ${{ matrix.build-mode }}
+        # 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.
</file context>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

placeholder

Comment thread .github/workflows/codeql.yml Outdated
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
steps:
- name: Checkout repository
uses: actions/checkout@v7

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: This workflow references actions/checkout@v7 and github/codeql-action/init@v4 / analyze@v4 by mutable version tags instead of pinning to a commit SHA, and does not set persist-credentials: false on checkout. This diverges from the pinned-SHA + persist-credentials:false hardening used elsewhere in the repo's workflows and increases supply-chain risk since tags can be moved to point at different code.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/workflows/codeql.yml, line 64:

<comment>This workflow references actions/checkout@v7 and github/codeql-action/init@v4 / analyze@v4 by mutable version tags instead of pinning to a commit SHA, and does not set persist-credentials: false on checkout. This diverges from the pinned-SHA + persist-credentials:false hardening used elsewhere in the repo's workflows and increases supply-chain risk since tags can be moved to point at different code.</comment>

<file context>
@@ -0,0 +1,105 @@
+        # your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
+    steps:
+    - name: Checkout repository
+      uses: actions/checkout@v7
+
+    # Add any setup steps before running the `github/codeql-action/init` action.
</file context>

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
@marlon-costa-dc
marlon-costa-dc merged commit 168e9ab into develop Aug 11, 2026
7 of 9 checks passed
@marlon-costa-dc
marlon-costa-dc deleted the marlon-costa-dc-patch-1 branch August 11, 2026 00:01
@qodo-code-review

Copy link
Copy Markdown
Contributor

Code review by qodo was updated up to the latest commit fcf9393

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/codeql.yml (1)

64-77: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Load .github/codeql-config.yml in the CodeQL init step.

The workflow does not load this tracked configuration. Add config-file: ./.github/codeql-config.yml; otherwise its paths, security-and-quality queries, and Rust query filters have no effect. The workflow matrix still controls the analyzed languages, so languages: ["rust"] does not override it. Ensure the src/crates path scope is intentional for all four matrix jobs.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/codeql.yml around lines 64 - 77, Update the “Initialize
CodeQL” step using github/codeql-action/init to load the tracked configuration
via the config-file setting pointing to ./.github/codeql-config.yml. Preserve
the matrix.language value as the languages input and verify the configuration’s
src/crates path scope applies intentionally across all four matrix jobs.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/codeql.yml:
- Line 64: Update the github/codeql-action/init and github/codeql-action/analyze
references in the CodeQL workflow to verified full commit SHAs instead of the v4
tags, and update each adjacent release comment to match the pinned version.

---

Outside diff comments:
In @.github/workflows/codeql.yml:
- Around line 64-77: Update the “Initialize CodeQL” step using
github/codeql-action/init to load the tracked configuration via the config-file
setting pointing to ./.github/codeql-config.yml. Preserve the matrix.language
value as the languages input and verify the configuration’s src/crates path
scope applies intentionally across all four matrix jobs.
🪄 Autofix

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: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 9ecbc236-5291-4934-bb57-1d4a9dd6b581

📥 Commits

Reviewing files that changed from the base of the PR and between 55c9ada and fcf9393.

📒 Files selected for processing (1)
  • .github/workflows/codeql.yml
📜 Review details
⏰ Context from checks skipped due to timeout. (7)
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: ci
  • GitHub Check: Analyze (actions)
  • GitHub Check: Analyze (rust)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Analyze (python)
🔇 Additional comments (2)
.github/workflows/codeql.yml (2)

1-21: LGTM!

Also applies to: 23-61


85-100: LGTM!

# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major

Pin the remaining CodeQL actions to full commit SHAs.

This change pins actions/checkout, but github/codeql-action/init@v4 and github/codeql-action/analyze@v4 remain tag-based. Pin both actions to verified commit SHAs and keep the release comments current.

#!/usr/bin/env bash
set -euo pipefail

for action in \
  'github/codeql-action/init@v4' \
  'github/codeql-action/analyze@v4'
do
  repository="${action%@*}"
  ref="${action#*@}"
  gh api "repos/${repository}/commits/${ref}" \
    --jq '"\(.sha) \(.commit.message | split("\n")[0])"'
done

rg -n 'uses: github/codeql-action/(init|analyze)@' .github/workflows/codeql.yml
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/codeql.yml at line 64, Update the
github/codeql-action/init and github/codeql-action/analyze references in the
CodeQL workflow to verified full commit SHAs instead of the v4 tags, and update
each adjacent release comment to match the pinned version.

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.

4 participants