Skip to content

ci(github): use CodeQL security-and-quality suite - #1859

Merged
trollixx merged 1 commit into
zealdocs:mainfrom
trollixx:ci-codeql-quality-queries
May 10, 2026
Merged

trollixx merged 1 commit into
zealdocs:mainfrom
trollixx:ci-codeql-quality-queries

Conversation

@trollixx

@trollixx trollixx commented May 10, 2026 •

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • Chores
    • Added CodeQL configuration to adjust scanning behavior and exclude specific paths.
    • Updated the CodeQL workflow to refine initialization and analysis settings for C/C++ and caching.
    • Added a minor internal test constant (no user-facing changes).

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 10, 2026 •

Copy link
Copy Markdown

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds a CodeQL configuration excluding src/contrib, updates the CodeQL GitHub Actions init step to configure languages, build mode, query suite, config file, and caching, and inserts an [[maybe_unused]] test URL constant in searchquery.cpp.

Changes

CodeQL Analysis Configuration

Layer / File(s) Summary
CodeQL Configuration
.github/codeql/config.yml
New configuration file specifies the analysis name and excludes src/contrib from CodeQL path scanning.
Workflow Integration
.github/workflows/analyze-codeql.yaml
The CodeQL init action is configured with c-cpp languages, manual build mode, security-and-quality query suite plus C/C++ experimental pack, references .github/codeql/config.yml, and enables trap and dependency caching.

SearchQuery Local Constant

Layer / File(s) Summary
Local Constant Addition
src/libs/registry/searchquery.cpp
Adds an [[maybe_unused]] const char * named kCodeQLTestUrl with value http://example.org/test inside an unnamed namespace.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately describes the main change: configuring CodeQL to use the security-and-quality suite in the GitHub workflow and related configuration files.
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.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@codacy-production

codacy-production Bot commented May 10, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@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/codeql/config.yml:
- Around line 3-4: The CodeQL config uses paths-ignore to exclude src/contrib
but with build-mode: manual that has no effect because CodeQL analyzes whatever
the build compiles; update the setup by either modifying your manual build steps
to stop compiling files under src/contrib (adjust your build
scripts/Makefile/CMakeLists so src/contrib is not built) or remove the
paths-ignore and add a post-processing SARIF filter (filter-sarif) to drop
alerts from src/contrib; reference the keys and values in the config
(paths-ignore, build-mode: manual, src/contrib, filter-sarif) when making the
change.
🪄 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: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: fb88e928-82b8-49b6-874d-fea9d6bb356d

📥 Commits

Reviewing files that changed from the base of the PR and between 07b87d9 and 23b44bc.

📒 Files selected for processing (2)
  • .github/codeql/config.yml
  • .github/workflows/analyze-codeql.yaml

Comment thread .github/codeql/config.yml
@trollixx
trollixx force-pushed the ci-codeql-quality-queries branch from 65b803e to 0ea0747 Compare May 10, 2026 17:05

@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

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

3-4: ⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

paths-ignore will not exclude src/contrib in this C/C++ manual-build setup.

With compiled-language extraction, CodeQL analyzes files that the build compiles. Excluding src/contrib here won’t be effective unless build steps stop compiling that directory (or SARIF is post-filtered).

For github/codeql-action/init@v4 with language c-cpp and build-mode manual, does paths-ignore in a CodeQL config file exclude compiled directories from analysis?
🤖 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/codeql/config.yml around lines 3 - 4, The config uses paths-ignore
for src/contrib which does not prevent compiled C/C++ files from being analyzed
in manual build mode; remove or stop relying on paths-ignore in
.github/codeql/config.yml and instead change the workflow/build to avoid
compiling src/contrib (or post-filter uploaded SARIF results) so CodeQL never
sees those object files; reference the paths-ignore setting and the manual-build
codeql action invocation when making the change.
🤖 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 `@src/libs/registry/searchquery.cpp`:
- Around line 119-121: Remove the test-only dead constant kCodeQLTestUrl from
the anonymous namespace in searchquery.cpp: delete the declaration
[[maybe_unused]] const char *kCodeQLTestUrl = "http://example.org/test"; and any
references to it, leaving no test-only artifacts in production runtime code
(ensure builds/tests still pass after removal).

---

Duplicate comments:
In @.github/codeql/config.yml:
- Around line 3-4: The config uses paths-ignore for src/contrib which does not
prevent compiled C/C++ files from being analyzed in manual build mode; remove or
stop relying on paths-ignore in .github/codeql/config.yml and instead change the
workflow/build to avoid compiling src/contrib (or post-filter uploaded SARIF
results) so CodeQL never sees those object files; reference the paths-ignore
setting and the manual-build codeql action invocation when making the change.
🪄 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: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 1bdd2ac7-0a52-4d4a-ac3f-ffc6252d65d6

📥 Commits

Reviewing files that changed from the base of the PR and between 65b803e and 0ea0747.

📒 Files selected for processing (3)
  • .github/codeql/config.yml
  • .github/workflows/analyze-codeql.yaml
  • src/libs/registry/searchquery.cpp

Comment thread src/libs/registry/searchquery.cpp Outdated
@trollixx
trollixx force-pushed the ci-codeql-quality-queries branch from 0ea0747 to 5e90464 Compare May 10, 2026 17:09

@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: 2

♻️ Duplicate comments (2)
src/libs/registry/searchquery.cpp (1)

119-121: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Remove test-only dead code from production source.

This issue was previously flagged and remains unresolved. The [[maybe_unused]] constant kCodeQLTestUrl serves no functional purpose in production runtime code and should be removed. Test artifacts belong in test files, not in production modules.

🤖 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 `@src/libs/registry/searchquery.cpp` around lines 119 - 121, Remove the
test-only dead constant kCodeQLTestUrl from production code: delete the
[[maybe_unused]] const char *const kCodeQLTestUrl declaration inside the
anonymous namespace in searchquery.cpp; if that makes the anonymous namespace
empty, remove the namespace block entirely to avoid leaving unused scaffolding,
then rebuild/run tests to ensure no references remain to kCodeQLTestUrl.
.github/codeql/config.yml (1)

3-4: ⚠️ Potential issue | 🟠 Major | ⚖️ Poor tradeoff

paths-ignore will not exclude src/contrib from CodeQL analysis with manual build mode.

This issue was previously flagged and remains unresolved. When using build-mode: manual for C/C++ (as configured in the workflow), CodeQL analyzes whatever your build compiles—paths-ignore has no effect. To exclude src/contrib, you must either modify your build configuration to skip compiling those files, or post-process results with filter-sarif.

🤖 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/codeql/config.yml around lines 3 - 4, The CodeQL config's
paths-ignore entry ("paths-ignore: - src/contrib") won't prevent analysis when
C/C++ is run in build-mode: manual; either update the build to avoid compiling
src/contrib (e.g., remove or conditionally skip those files in your C/C++ build
system so CodeQL's manual compilation step never sees them) or add a SARIF
post-processing step using filter-sarif to drop findings under src/contrib after
analysis; choose one approach and implement it consistently with the workflow
that sets build-mode: manual.
🤖 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/analyze-codeql.yaml:
- Line 37: The packs entry is using a file path instead of a pack reference;
update the packs parameter value from the path-style string to the pack
reference "codeql/cpp-queries" (i.e., remove
":codeql-suites/cpp-security-experimental.qls") in the workflow step that sets
packs so the CodeQL Action v4 receives scope/name[`@version`] only, and if you
need the experimental suite include the .qls via a CodeQL configuration file or
suite definition rather than appending the .qls path to the packs parameter.
- Around line 33-41: Remove the experimental analysis-kinds parameter by
deleting the line "analysis-kinds: code-scanning,code-quality" from the CodeQL
init block; then review the query selection composed of "queries:
security-and-quality" and "packs:
codeql/cpp-queries:codeql-suites/cpp-security-experimental.qls" and either
remove the experimental pack or the queries entry so you don't select
overlapping/conflicting query sets (replace the experimental pack with a stable
pack if needed), keeping the "languages", "build-mode", "config-file", and
caching settings unchanged.

---

Duplicate comments:
In @.github/codeql/config.yml:
- Around line 3-4: The CodeQL config's paths-ignore entry ("paths-ignore: -
src/contrib") won't prevent analysis when C/C++ is run in build-mode: manual;
either update the build to avoid compiling src/contrib (e.g., remove or
conditionally skip those files in your C/C++ build system so CodeQL's manual
compilation step never sees them) or add a SARIF post-processing step using
filter-sarif to drop findings under src/contrib after analysis; choose one
approach and implement it consistently with the workflow that sets build-mode:
manual.

In `@src/libs/registry/searchquery.cpp`:
- Around line 119-121: Remove the test-only dead constant kCodeQLTestUrl from
production code: delete the [[maybe_unused]] const char *const kCodeQLTestUrl
declaration inside the anonymous namespace in searchquery.cpp; if that makes the
anonymous namespace empty, remove the namespace block entirely to avoid leaving
unused scaffolding, then rebuild/run tests to ensure no references remain to
kCodeQLTestUrl.
🪄 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: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: ad76667d-ab45-4556-a1b3-bd586f984f4f

📥 Commits

Reviewing files that changed from the base of the PR and between 0ea0747 and 5e90464.

📒 Files selected for processing (3)
  • .github/codeql/config.yml
  • .github/workflows/analyze-codeql.yaml
  • src/libs/registry/searchquery.cpp

Comment thread .github/workflows/analyze-codeql.yaml
Comment thread .github/workflows/analyze-codeql.yaml Outdated
@trollixx
trollixx force-pushed the ci-codeql-quality-queries branch from 5e90464 to b48f305 Compare May 10, 2026 17:38
Comment thread src/libs/registry/searchquery.cpp Fixed
@trollixx
trollixx force-pushed the ci-codeql-quality-queries branch from b48f305 to dd428d6 Compare May 10, 2026 17:46
@trollixx
trollixx force-pushed the ci-codeql-quality-queries branch from dd428d6 to 7a3b1da Compare May 10, 2026 18:01
@trollixx
trollixx merged commit 8c36f29 into zealdocs:main May 10, 2026
14 checks passed
@trollixx
trollixx deleted the ci-codeql-quality-queries branch May 10, 2026 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants