Skip to content

Suppress CodeQL false positives for billing report output - #21

Merged
kgrizz-git merged 2 commits into
mainfrom
fix/codeql-false-positives-suppressions
Sep 9, 2026
Merged

kgrizz-git merged 2 commits into
mainfrom
fix/codeql-false-positives-suppressions

Conversation

@kgrizz-git

@kgrizz-git kgrizz-git commented Sep 9, 2026

Copy link
Copy Markdown
Owner

Add inline CodeQL suppression comments for false-positive clear-text logging/storage alerts on intentional billing-report output.

These are false positives: the code prints aggregate billing data (totals, discounts, repo usage breakdowns), not secrets or credentials.

Changes:

  • src/github_usage/cli.py:303
  • src/github_usage/export_text.py:37
  • src/github_usage/report_products.py:213
  • src/github_usage/report_summary.py:177
  • src/github_usage/report_summary_insights.py:305

Next step: manually dismiss the 6 open CodeQL alerts as "False positive" in the GitHub Security tab, referencing these suppressions. Automatic dismissal via workflow is not recommended for this repo because the default CodeQL setup does not emit SARIF suppressions, and a correct auto-dismiss workflow would require Advanced setup.

@sourcery-ai

sourcery-ai Bot commented Sep 9, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds inline CodeQL suppressions matching the existing project pattern for billing-report data that is intentionally printed or written as report output, without changing report content or control flow.

File-Level Changes

Change Details Files
Suppress CodeQL clear-text logging alerts on intentional billing-report output.
  • Added inline logging suppressions to dry-run email report output and report text rendering.
  • Marked intentional cost, discount, and insight findings printed to stdout as non-sensitive report output.
src/github_usage/cli.py
src/github_usage/report_products.py
src/github_usage/report_summary.py
src/github_usage/report_summary_insights.py
Suppress CodeQL logging and storage alerts when writing billing reports.
  • Added inline logging and storage suppressions to the text report write operation.
src/github_usage/export_text.py
Updated the lockfile.
  • Applied the associated uv.lock change; details are not shown in the supplied diff.
uv.lock

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

@coderabbitai

coderabbitai Bot commented Sep 9, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 59a1aee5-34ee-4f01-b74b-2db6090b356a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@deepsource-io

deepsource-io Bot commented Sep 9, 2026

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in 3cf879b...5922cb5 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 Sep 9, 2026 9:09p.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 1 issue

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

## Individual Comments

### Comment 1
<location path="src/github_usage/cli.py" line_range="303-305" />
<code_context>
         )
         if args.dry_run:
-            print(html_body if html_body is not None else body, end="")
+            print(
+                html_body if html_body is not None else body, end=""
+            )  # codeql[py/clear-text-logging-sensitive-data]
             return 0
         recipient = (getattr(args, "to", None) or "").strip() or os.environ.get(
</code_context>
<issue_to_address>
**issue:** The CodeQL suppression comments are attached to the closing-parenthesis lines instead of the lines containing the flagged `print`/`write` sink or its sensitive argument. CodeQL therefore does not associate these suppressions with the alerts, so the clear-text findings remain reported.

**Triggers:** When CodeQL reports the multiline calls at their opening call or argument line, as it does for Python AST locations.

**Suggested fix:** Place each `codeql[...]` comment on the sink or argument line that CodeQL reports, or use the exact suppression placement from the working precedent.

```suggestion
            print(  # codeql[py/clear-text-logging-sensitive-data]
                html_body if html_body is not None else body, end=""
            )
```
</issue_to_address>

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

Comment thread src/github_usage/cli.py Outdated
@greptile-apps

greptile-apps Bot commented Sep 9, 2026

Copy link
Copy Markdown

Greptile Summary

Adds inline CodeQL suppression annotations to intentional billing-report console and file output without changing report behavior.

  • Annotates dry-run email output and plain-text export writes.
  • Annotates selected billing summary and insight output.
  • Refreshes the locked pip version from 26.1.2 to 26.2.

Confidence Score: 5/5

The PR appears safe to merge because the source changes only annotate existing intentional output and no actionable regression was identified.

The suppression comments and associated formatting preserve runtime behavior, while the lockfile change only refreshes pip; the reported pypdf advisories concern an unchanged, test-only dependency with no attacker-controlled affected call path.

Important Files Changed

Filename Overview
src/github_usage/cli.py Reformats the existing dry-run print and adds a targeted CodeQL suppression without behavioral change.
src/github_usage/export_text.py Reformats the existing report write and suppresses clear-text logging and storage findings without changing output.
src/github_usage/report_products.py Adds a CodeQL suppression to an existing billing-savings print statement.
src/github_usage/report_summary.py Reformats an existing discount summary print and adds a CodeQL suppression.
src/github_usage/report_summary_insights.py Adds a CodeQL suppression to existing impactful-finding output.
uv.lock Updates the locked pip artifact from 26.1.2 to 26.2 with corresponding hashes.

Reviews (1): Last reviewed commit: "Suppress CodeQL false positives for bill..." | Re-trigger Greptile

@sonarqubecloud

sonarqubecloud Bot commented Sep 9, 2026

Copy link
Copy Markdown

@kgrizz-git
kgrizz-git merged commit ce931a8 into main Sep 9, 2026
15 checks passed
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