Repository navigation
Description
Context & Rationale
devops scan already normalizes Trivy, Gitleaks, Semgrep, Checkov and Kubeconform output and writes SARIF 2.1.0 (src/devops_cli/security/sarif.py:write_sarif, called from commands/scan.py:839). Nothing uploads it. security-events: write appears in exactly one workflow — codeql.yml — so the only findings that reach a pull request are CodeQL's, and five scanners' results terminate in a CI log or a local file. A log is where a finding goes to be ignored: nobody opens it unless the build is already red, and an advisory finding never turns it red.
Scope & Deliverables
- Context & Rationale*:
devops scanalready normalizes Trivy, Gitleaks, Semgrep, Checkov and Kubeconform output and writes SARIF 2.1.0 (src/devops_cli/security/sarif.py:write_sarif, called fromcommands/scan.py:839). Nothing uploads it.security-events: writeappears in exactly one workflow —codeql.yml— so the only findings that reach a pull request are CodeQL's, and five scanners' results terminate in a CI log or a local file. A log is where a finding goes to be ignored: nobody opens it unless the build is already red, and an advisory finding never turns it red. - Deliverable*: Upload the scan SARIF from CI under its own
category, so each scanner's alerts are attributed and de-duplicated across runs. The emitter exists; this is the publication step alone. - Constraint*: A run that finds nothing must still be uploaded. Code scanning resolves an alert only when the tool that raised it reports again without it, so a scanner that stops appearing leaves every alert it ever raised open indefinitely. Fingerprints must also exclude the line number, or an unrelated edit above a finding re-alerts it.
Strategic Alignment
- Milestone:
v0.2.23(Foundational Architectural Guardrails & Project Hygiene) - Roadmap Reference:
docs/ROADMAP.md
Proposed design
Problem statement
devops scan already normalizes findings from Trivy, Gitleaks, Semgrep, Checkov and Kubeconform into SARIF 2.1.0 and writes the file to disk, but nothing uploads it to GitHub code scanning. Only CodeQL findings reach a pull request, because security-events: write is granted to exactly one workflow (codeql.yml). The five scanners' results terminate in a CI log or a local file where they go unnoticed. This issue adds the publication step: uploading the scan SARIF from CI under its own category so each scanner's alerts are attributed, de-duplicated across runs, and visible on pull requests.
Acceptance criteria
- Criterion 1: The CI workflow that runs devops scan uploads the resulting SARIF file to GitHub code scanning with a category parameter distinct from CodeQL's /language:* categories.
Verification: Inspect the modified workflow file: it contains a step using github/codeql-action/upload-sarif (or equivalent) with a category value such as /devops-scan, and the job's permissions block includes security-events: write. - Criterion 2: The upload step runs unconditionally, so a scan that finds zero findings still produces an upload and GitHub can resolve previously-open alerts for that category.
Verification: The workflow step has no conditional guard on the number of findings or the existence of a non-empty SARIF file; the SARIF emitter's to_sarif already produces a valid document with an empty run when findings are empty (verified by the existing round-trip tests in the test suite). - Criterion 3: The SARIF partialFingerprints for each finding do not include the line number, so an unrelated edit above a finding does not cause a re-alert.
Verification: Run devops scan on a fixture that produces a finding, then add a blank line above the finding and re-scan; the uploaded SARIF's partialFingerprints for that finding are identical across both runs. This is already guaranteed by fix(security): each finding keeps its own fingerprint across unrelated edits, and deduplication and correlation give one result in every input order, in devops scan and in reviews #1141 (Done in v0.2.31). - Criterion 4: Each scanner's findings are attributed to their own tool name in the SARIF runs, so GitHub code scanning de-duplicates per-scanner across runs.
Verification: Inspect the SARIF document produced by to_sarif: each scanner that ran has its own run with its own driver name, and findings are grouped under the correct run. The existing _runs_for_outcomes function and round-trip tests cover this.
Key questions
- Does the SARIF emitter already produce a valid document when findings are empty?: Yes. The to_sarif docstring states: 'An empty list still produces a valid document with a single empty run. Emitting nothing would be read by a consumer as the scan did not happen rather than the scan found nothing.' The _runs_for_outcomes function appends a devops-cli run when no scanner ran, and to_sarif falls back to a single empty devops-cli run when runs is empty. [sources: src/devops_cli/security/sarif.py]
- What category string should the scan SARIF use in the upload step?: A dedicated category such as /devops-scan, distinct from CodeQL's /language:* categories (seen in codeql.yml:107), so the five scanners' alerts are grouped together and de-duplicated independently of CodeQL findings. (proposed) [sources: .github/workflows/codeql.yml:107]
- Does the finding fingerprint already exclude the line number?: Issue fix(security): each finding keeps its own fingerprint across unrelated edits, and deduplication and correlation give one result in every input order, in devops scan and in reviews #1141 ('each finding keeps its own fingerprint across unrelated edits, and deduplication and correlation give one result in every input order') is marked Done in the current release v0.2.31, indicating the fingerprint is stable across unrelated edits including line shifts. The constraint in this issue is satisfied by that prior work. [sources: docs/ROADMAP.md]
- Which workflow file needs the upload step and the security-events: write permission?: The workflow that invokes devops scan in CI (the call site is commands/scan.py:839). It is not codeql.yml, which is dedicated to CodeQL. The issue states that security-events: write appears in exactly one workflow (codeql.yml), so the scan workflow must have that permission added to its job-level permissions block. [sources: src/devops_cli/security/sarif.py, .github/workflows/codeql.yml:107]
- Is the SARIF file path known to the CI workflow for the upload step?: write_sarif accepts a destination Path, creates parent directories, and returns the path written. The devops scan command (commands/scan.py:839) calls write_sarif with a specific output path. The CI step that runs devops scan must pass or discover that path to the upload action's sarif_file input. [sources: src/devops_cli/security/sarif.py]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
[end-marker]
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
dan-petty commentedon Oct 3, 2026
Review redesign (#1137, 2026-10-03): this item is a phase P4 child (P4-2):
review pringests GitHub code-scanning alerts as evidence and uploadsfindings.sarif(#1141's fingerprint without a line number). Conflict for the owner: #861 (v0.2.28) sends zizmor SARIF through this item's upload. Its v0.3.5 milestone is unchanged.dan-petty-bot commentedon Oct 9, 2026
Status set to Ready at 27cf6bd (see proposed design in issue body).
feat(review): publish scanner findings to code scanning (#419) (#1524)
dan-petty-bot commentedon Oct 9, 2026
What changed
#1524, merged into
release/v0.2.33as ec075bd.4 file(s) changed.
How it was verified
Check runs at 99004cd:
Acceptance Criteria of
docs/agent/tasks/task-419-publish-scanner-findings-to-code-scanning.md:No Acceptance Criteria section.
feat(release): v0.2.33 (#1537)