From ec8996dfa68302a73e3bb74d3ff9020a2e5741dc Mon Sep 17 00:00:00 2001 From: kgrizz-git <216068303+kgrizz-git@users.noreply.github.com> Date: Wed, 18 Nov 2026 12:10:25 -0500 Subject: [PATCH 1/3] Document how CodeQL alerts are handled in this repo 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. --- docs/repo-harness-guidance.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/repo-harness-guidance.md b/docs/repo-harness-guidance.md index fe21a8f..d467847 100644 --- a/docs/repo-harness-guidance.md +++ b/docs/repo-harness-guidance.md @@ -128,6 +128,14 @@ Security workflow: - Add Dependabot config for both Python dependencies and GitHub Actions. - Consider an Actions workflow linter such as `zizmor` once workflows become non-trivial. +CodeQL alert handling: + +- This repo uses code scanning **default setup**; there is no checked-in CodeQL workflow. +- 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. +- Dismiss alerts from the Security tab, or via the REST API: `PATCH /repos/{owner}/{repo}/code-scanning/alerts/{n}` with `state=dismissed`, `dismissed_reason=won't fix`, and `dismissed_comment` (max 280 characters). A classic token with `repo` is accepted by this endpoint even though the REST docs list `security_events`. +- `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. +- Making in-source suppression effective would require the `advanced-security/dismiss-alerts` action reading a SARIF artifact, which in turn means advanced setup instead of default setup. Not adopted; revisit only if the alert volume becomes unmanageable. + Suggested `scripts/security` contents: ```sh From e40f3bdbfdf2f467f8555ecb6b1cfb6da4c175a4 Mon Sep 17 00:00:00 2001 From: kgrizz-git <216068303+kgrizz-git@users.noreply.github.com> Date: Wed, 18 Nov 2026 12:27:08 -0500 Subject: [PATCH 2/3] Correct the CodeQL note on dismissal persistence and local output 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. --- docs/repo-harness-guidance.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/repo-harness-guidance.md b/docs/repo-harness-guidance.md index d467847..5863756 100644 --- a/docs/repo-harness-guidance.md +++ b/docs/repo-harness-guidance.md @@ -131,9 +131,10 @@ Security workflow: CodeQL alert handling: - This repo uses code scanning **default setup**; there is no checked-in CodeQL workflow. -- 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. +- 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, the documented shape) does not stop the alert from being created — verified on `main` after PR #42, where four alerts were filed at commented lines. Keep the comments; they record intent for CLI/IDE readers and are valid CodeQL syntax, but they do not suppress the finding from analysis. +- A dismissal does persist: a dismissed alert stays dismissed across analyses while its code location is unchanged, and can come back as a new alert when a nearby edit shifts the line. Expect occasional re-dismissal, not a one-time cleanup. - Dismiss alerts from the Security tab, or via the REST API: `PATCH /repos/{owner}/{repo}/code-scanning/alerts/{n}` with `state=dismissed`, `dismissed_reason=won't fix`, and `dismissed_comment` (max 280 characters). A classic token with `repo` is accepted by this endpoint even though the REST docs list `security_events`. -- `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. +- `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 to the terminal of the user who ran the 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. That decision assumes output stays local: if any path ever captures report stdout into shared CI or build logs, revisit the dismissal instead of letting it stand. (Today none does: `scripts/check` runs the CLI with `env -u GITHUB_TOKEN` and expects the no-token failure, and the email workflow never uses `--dry-run`.) - Making in-source suppression effective would require the `advanced-security/dismiss-alerts` action reading a SARIF artifact, which in turn means advanced setup instead of default setup. Not adopted; revisit only if the alert volume becomes unmanageable. Suggested `scripts/security` contents: From 97e79a2d5eb061d67957c18218c938917d466b76 Mon Sep 17 00:00:00 2001 From: kgrizz-git <216068303+kgrizz-git@users.noreply.github.com> Date: Wed, 18 Nov 2026 12:32:50 -0500 Subject: [PATCH 3/3] Note the local-only smoke dry-run in the CodeQL guidance 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). --- docs/repo-harness-guidance.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/repo-harness-guidance.md b/docs/repo-harness-guidance.md index 5863756..697611d 100644 --- a/docs/repo-harness-guidance.md +++ b/docs/repo-harness-guidance.md @@ -133,8 +133,8 @@ CodeQL alert handling: - This repo uses code scanning **default setup**; there is no checked-in CodeQL workflow. - 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, the documented shape) does not stop the alert from being created — verified on `main` after PR #42, where four alerts were filed at commented lines. Keep the comments; they record intent for CLI/IDE readers and are valid CodeQL syntax, but they do not suppress the finding from analysis. - A dismissal does persist: a dismissed alert stays dismissed across analyses while its code location is unchanged, and can come back as a new alert when a nearby edit shifts the line. Expect occasional re-dismissal, not a one-time cleanup. -- Dismiss alerts from the Security tab, or via the REST API: `PATCH /repos/{owner}/{repo}/code-scanning/alerts/{n}` with `state=dismissed`, `dismissed_reason=won't fix`, and `dismissed_comment` (max 280 characters). A classic token with `repo` is accepted by this endpoint even though the REST docs list `security_events`. -- `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 to the terminal of the user who ran the 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. That decision assumes output stays local: if any path ever captures report stdout into shared CI or build logs, revisit the dismissal instead of letting it stand. (Today none does: `scripts/check` runs the CLI with `env -u GITHUB_TOKEN` and expects the no-token failure, and the email workflow never uses `--dry-run`.) +- Dismiss alerts from the Security tab, or via the REST API: `PATCH /repos/{owner}/{repo}/code-scanning/alerts/{n}` with `state=dismissed`, `dismissed_reason=won't fix`, and `dismissed_comment` (max 280 characters, enforced by the API). A classic token with `repo` is accepted by this endpoint even though the REST docs list `security_events`. +- `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 to the terminal of the user who ran the 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. That decision assumes output stays local: if any path ever captures report stdout into shared CI or build logs, revisit the dismissal instead of letting it stand. In CI none does today — `scripts/check` runs the CLI with `env -u GITHUB_TOKEN` and expects the no-token failure, and the email workflow never uses `--dry-run`. `scripts/smoke` does exercise `--dry-run`, but only locally, with a fake token, writing to `/tmp`, and it is not wired into CI. - Making in-source suppression effective would require the `advanced-security/dismiss-alerts` action reading a SARIF artifact, which in turn means advanced setup instead of default setup. Not adopted; revisit only if the alert volume becomes unmanageable. Suggested `scripts/security` contents: