Skip to content

Document how CodeQL alerts are handled in this repo - #43

Merged
kgrizz-git merged 3 commits into
mainfrom
docs/codeql-alert-handling
Nov 18, 2026
Merged

kgrizz-git merged 3 commits into
mainfrom
docs/codeql-alert-handling

Conversation

@kgrizz-git

@kgrizz-git kgrizz-git commented Nov 18, 2026 •

Copy link
Copy Markdown
Owner

Why

PR #42 moved the repo's # codeql[...] suppression comments onto the documented line (alone, immediately above the flagged line). The first scan of the merged commit created 4 new alerts on lines with correctly placed comments (report_sources.py:28,30, report_products.py:94,96), which settles the question the PR left open: under code scanning default setup, in-source suppression is not applied — the alerts are still created.

That knowledge is worth keeping, but TO_DO.md is a work list, not a reference, and this isn't work anyone needs to queue. It belongs with the other CI/security conventions in docs/repo-harness-guidance.md.

Change

New "CodeQL alert handling" block under CI, Hooks, Security, And Hygiene:

  • Default setup, no checked-in CodeQL workflow.
  • In-source codeql[...] comments do not stop an alert being created — keep them as intent markers for CLI/IDE readers, don't expect suppression.
  • A dismissal does persist while the code location is unchanged, and can come back as a new alert when a nearby edit shifts the line: occasional re-dismissal, not a one-time cleanup (corrected after Sourcery's review).
  • Dismissal recipe: Security tab or PATCH /repos/{owner}/{repo}/code-scanning/alerts/{n} with state=dismissed, dismissed_reason=won't fix, dismissed_comment (≤280 chars). Classic tokens with repo are accepted even though the REST docs list security_events.
  • The standing decision on py/clear-text-logging-sensitive-data: dismiss as won't fix, because the print helpers emit derived billing figures to the terminal of whoever ran the report — no credentials, tokens, or raw API payloads. Carries the condition that output stays local, with the two current safeguards named and an instruction to revisit the dismissal if that changes.
  • What real suppression would take: advanced-security/dismiss-alerts against a SARIF artifact, i.e. advanced setup rather than default. Not adopted; revisit only if volume becomes unmanageable.

State after this

  • Alerts 187–190 dismissed with a corrected rationale (the earlier comment claimed the in-source comments handle it, which is false). Repo now: 0 open, 36 dismissed, 64 fixed.
  • Code comments kept, per your call — they're valid CodeQL syntax and correct for CLI/IDE readers.

Docs-only; ./scripts/docs-check passes. No changelog entry (maintainer guidance, not user-visible behavior).

Summary by Sourcery

Document the repository’s CodeQL alert-handling conventions and security decisions.

Enhancements:

  • Document the repository’s CodeQL alert behavior, dismissal process, standing rationale for local report output findings, and conditions for revisiting those decisions.

Documentation:

  • Add CodeQL alert-handling guidance covering default setup, ineffective in-source suppression comments, alert dismissal persistence, REST and UI dismissal procedures, and the boundary for adopting advanced setup.

Summary by CodeRabbit

  • Documentation
    • Added guidance on handling CodeQL alerts, including dismissal options, recurring alerts, and when existing dismissals should be reconsidered.
    • Clarified that in-source suppression comments do not prevent alerts under the current CodeQL setup.

In-source codeql[...] comments do not suppress alerts under code
scanning default setup: after PR #42 landed, four alerts reappeared at
lines with correctly placed comments. Record that in the harness
guidance so the next person does not repeat the investigation, along
with the dismissal convention and what adopting advanced setup would
take.
@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The repository guidance now describes CodeQL default setup, explains how in-source suppression comments and code-location shifts affect alerts, and documents dismissal through GitHub or the REST API.

Changes: CodeQL alert guidance

Layer / File(s) Summary
CodeQL alert handling
docs/repo-harness-guidance.md
The guidance describes alert behavior under default setup, dismissal through GitHub or the REST API, the rationale for dismissing specified alerts, and the conditions for revisiting that rationale. It also notes that advanced setup is not adopted.

Estimated code review effort: 1 (Trivial) | ~4 minutes

Change: Other

Possibly related PRs

  • kgrizz-git/github-usage#42: Adds in-source CodeQL suppression comments. This PR documents that those comments do not prevent alerts under the repository’s default setup.
Merge Risk: Minimal · up to 97e79

This change adds documentation on how CodeQL alerts are handled and dismissed. It does not alter runtime behavior, so merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "Document how CodeQL alerts are handled in this repo" matches the main change. The PR adds a CodeQL alert-handling section to docs/repo-harness-guidance.md covering default setup, dismissal …
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.
Full details: Title check

Explanation

The title "Document how CodeQL alerts are handled in this repo" matches the main change. The PR adds a CodeQL alert-handling section to docs/repo-harness-guidance.md covering default setup, dismissal through the Security tab or REST API, and the py/clear-text-logging-sensitive-data dismissal rationale. The title is specific and concise, and it does not describe anything absent from the changeset.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 044a07b and 97e79a2.

Files selected for processing: 1

  • docs/repo-harness-guidance.md

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@sourcery-ai

sourcery-ai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Documentation

Document the repo’s CodeQL alert behavior, dismissal guidance, and conditions for revisiting the standing decision.

  • docs/repo-harness-guidance.md L131-139

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@greptile-apps

greptile-apps Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] This documentation change appears safe to merge.

Summary

Adds maintainer guidance for handling CodeQL alerts without changing application code or CI workflows.

  • The maintainer guide explains what to do with CodeQL alerts.

No actionable issues found.

Reviews (1) · Last reviewed commit: "Document how CodeQL alerts are handled i..." · Reviewed by Greptile

@deepsource-io

deepsource-io Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in 044a07b...97e79a2 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
Secrets Nov 18, 2026 5:34p.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

@sourcery-ai sourcery-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.

Hey - I've found 2 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="docs/repo-harness-guidance.md" line_range="136" />
<code_context>
+- `py/clear-text-logging-sensitive-data` fires on the report print helpers (`report_sources.py`, `report_products.py`, `report_summary.py`). They print derived billing figures for a local terminal report — no credentials, tokens, or raw API payloads — so the standing decision is to dismiss as `won't fix` with that rationale on the alert.
</code_context>
<issue_to_address>
**Sensitive billing output goes unreviewed**

When a maintainer follows the standing dismissal and a report's stdout is captured in shared CI or build logs, the dismissal policy hides `py/clear-text-logging-sensitive-data` alerts even though the report helpers print billing amounts and usage figures; when stdout is captured in shared build logs, those details can be exposed without the alert prompting review or redaction.

Qualify the dismissal as safe only for strictly local output and preserve or re-evaluate the alert when report output can reach shared logs.
</issue_to_address>

### Comment 2
<location path="docs/repo-harness-guidance.md" line_range="134" />
<code_context>
+- In-source `# codeql[query-id]` comments are **not applied** by GitHub code scanning here. A correctly placed comment (alone on the line immediately above the flagged line, which is the documented shape) still produces an open alert on every analysis — verified on `main` after PR #42. Keep the comments: they record intent for CLI/IDE readers and are correct CodeQL syntax, but do not expect them to close an alert.
</code_context>
<issue_to_address>
**Persistent dismissals misdescribed**

When a maintainer dismisses an alert while the finding remains in analyzed code, gitHub retains a dismissed alert's state across analyses while the finding remains unchanged, so saying each analysis produces an open alert implies that the documented dismissal workflow does not stick and misleads maintainers about what they will see.

Clarify that the comment does not suppress the finding from analysis, but dismissing the alert persists its dismissed state unless a relevant code change causes it to reopen.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread docs/repo-harness-guidance.md Resolved
Comment thread docs/repo-harness-guidance.md Resolved
Sourcery on PR #43, both fair:
- 'an open alert on every analysis' overstated it. The comment does not
  stop the alert being created, but a dismissal persists while the code
  location is unchanged and only reappears when a nearby edit shifts the
  line. Confirmed by the 17:01 analysis, which re-found the six dismissed
  alerts without reopening them and only filed four new ones.
- The blanket 'safe to dismiss because it is local output' rule needs a
  condition: it holds only while report stdout stays local. Name the
  current CI safeguards and say to revisit the dismissal if that changes.
Muse Spark review of PR #43: the 'output stays local' justification
listed the two CI safeguards but implied nothing else runs the report
with --dry-run. scripts/smoke does, with a fake token, writing to /tmp,
and is not part of CI. Also mark the 280-character dismissal-comment
limit as API-enforced, which it is (a 310-character comment was
rejected earlier).
@sonarqubecloud

Copy link
Copy Markdown

@kgrizz-git

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@kgrizz-git
kgrizz-git merged commit f73ce57 into main Nov 18, 2026
16 checks passed
@kgrizz-git
kgrizz-git deleted the docs/codeql-alert-handling branch November 18, 2026 17:53
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