Skip to content

refactor(security): replace the Trivy alert filer with code scanning #7502

Done

Description

@dan-petty

Problem

devops-cli copies each Trivy-config code scanning alert into an issue.

  • src/devops_cli/security/alert_filer.py (207 lines, 10 tests) and the workflow .github/workflows/trivy-config-alerts.yml file one issue for each rule and file.
  • It finds duplicates only by the titles of open issues (:132-136 and :163-170, lines at commit d0bc3dffa).
  • SECURITY.md:125 describes this workflow.

Breakage in 30 days:

  • 85 "Judge ..." triage issues were filed, and 40 of them were closed as not planned.
  • 12 of them have the title of this filer. Agents filed the rest by the same pattern.
  • Each alert then has two trackers, the alert and the issue, and they drift apart.

Change

Use the code scanning alert itself as the tracker.

  • Standard: GitHub code scanning alerts (https://docs.github.com/en/code-security/code-scanning). Each alert has a state, a rule, a file and a history. The Trivy SARIF upload already makes them.
  • To accept a finding, dismiss the alert with a reason and a comment through the REST API: PATCH /repos/{owner}/{repo}/code-scanning/alerts/{alert_number} with state, dismissed_reason and dismissed_comment.
  • To accept a finding for a limited time, add a dated entry to .trivyignore.yaml with expired_at. The project already does this.
  • To fix a finding, change the file. The alert closes on the next scan.

Delete:

  • alert_filer.py, its 10 tests and trivy-config-alerts.yml.
  • The text in SECURITY.md that describes the filer. It describes the alert flow instead.

The open "Judge" issues that copy an alert close as not planned, each with a link to its alert. The alert stays the tracker.

Existing tool considered

  • GitHub code scanning with the Trivy SARIF upload (already used). It covers the list, the state, the dismissal with a reason and the history of each alert. It gives no priority label and no roadmap item. A person or an agent reads the open alerts instead.
  • Trivy .trivyignore.yaml with expired_at (already used). It covers an acceptance for a limited time.

Done when

  • alert_filer.py, its tests and trivy-config-alerts.yml are deleted.
  • No workflow or job files an issue for a code scanning alert.
  • SECURITY.md tells how to fix, dismiss or ignore an alert, with the REST call.
  • The open "Judge Trivy-config" issues are closed, each with a link to its alert.

Source

Source: https://github.com/dan-petty/devops-cli/blob/d0bc3dffa781951f7b49935ba545cad82b2ecfaf/src/devops_cli/security/alert_filer.py

Alternatives check of 2026-11-28: not-applicable.
Class: refactor, no model call.
Tool: none found.

Proposed design

Problem statement

Delete the Trivy-config alert filer and use the code scanning alert as the tracker. devops-cli files one issue for each alert group, so each alert has two trackers that drift apart. In 30 days, agents filed 85 Judge issues, and 40 closed as not planned. The change deletes the filer, its tests and its workflow, and it updates SECURITY.md.

Acceptance criteria

Requirement: Alert filer module removed

The security package SHALL no longer hold the Trivy-config alert filer module.

Scenario: The filer module is absent

  • WHEN a test asks importlib.util.find_spec for devops_cli.security.alert_filer
  • THEN the call returns None

Requirement: Alert filer tests removed

The security test suite SHALL no longer hold a test of the alert filer.

Scenario: The filer tests are absent

  • WHEN uv run pytest tests/security --collect-only -q runs
  • THEN the output holds no test from the alert filer test module

Requirement: Scan alerts command removed

The CLI SHALL no longer run the scan alerts command that files an issue for a code scanning alert.

Scenario: The removed command is invoked

  • WHEN a test invokes the CLI with scan alerts --repo example/repo
  • THEN the CLI exits non-zero and prints an unknown-command message

Requirement: Alert workflow removed

The repository SHALL hold no workflow that files an issue for a code scanning alert.

Scenario: The workflow checks run

  • WHEN uv run devops ci --check --only actionlint,zizmor runs
  • THEN the check passes and reports no finding for trivy-config-alerts.yml

Requirement: Security guide describes the alert flow

SECURITY.md SHALL tell how to fix, dismiss or ignore a Trivy-config alert and give the REST call.

Scenario: The security guide is read

  • WHEN a test reads SECURITY.md
  • THEN the text names PATCH /repos/{owner}/{repo}/code-scanning/alerts/{alert_number} and holds no trivy-config-alerts.yml

Requirement: Pending a person after the merge

Each open issue titled fix(security): judge Trivy-config ... SHALL close as not planned with a link to its alert after the merge.

Scenario: The cleanup runs after the merge

  • WHEN uv run devops gh issue list --search 'in:title "judge Trivy-config"' --state open runs
  • THEN the command lists no open issue

Existing Tool Considered

Use GitHub code scanning alerts; the alternatives check of 2026-11-28 records not-applicable for this refactor, with no model call and no tool (see the issue body). The Trivy SARIF upload already creates the alerts. Each alert holds its state, rule, file and history. The alert gives no priority label and no roadmap item, so a person or an agent reads the open alerts. .trivyignore.yaml with expired_at covers a time-limited acceptance. The change builds no new code. It deletes code.

Key questions

  • Which tracker holds a Trivy-config finding after the filer is removed?: The GitHub code scanning alert. It holds the state, the rule, the file and the history, and the Trivy SARIF upload already creates it. (best practice) [sources: src/devops_cli/security/alert_filer.py]
    • Chosen: GitHub code scanning alert. The Trivy SARIF upload already creates it, and it holds the state, rule, file and history.
    • Rejected: Keep the issue filer. It makes a second tracker that drifts from the alert.
    • Rejected: A new database. It builds and keeps code that the alert already gives.
  • How does a person accept a finding?: Dismiss the alert through the REST API with state, dismissed_reason and dismissed_comment at PATCH /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}. (best practice) [sources: SECURITY.md]
    • Chosen: Dismiss the alert through the REST API. The alert holds the state, the reason and the comment.
    • Rejected: Close an issue. The issue is no longer the tracker.
    • Rejected: Edit .trivyignore.yaml. It gives only a time-limited acceptance.
  • How does a person accept a finding for a limited time?: Add a dated entry to .trivyignore.yaml with expired_at. The project already reads that field. (best practice) [sources: .trivyignore.yaml, src/devops_cli/security/trivy.py, tests/security/test_trivy_config_ignore.py]
    • Chosen: Add a dated .trivyignore.yaml entry. The project already reads expired_at from it.
    • Rejected: Dismiss the alert with a comment. The dismissal has no expiry.
    • Rejected: Add a new suppression file. It duplicates the existing file.
  • Which code and workflow go with the filer?: Delete alert_filer.py, its tests and .github/workflows/trivy-config-alerts.yml. The workflow is the caller of devops scan alerts, so the command goes too. (best practice) [sources: .github/workflows/trivy-config-alerts.yml, src/devops_cli/security/alert_filer.py]
    • Chosen: Delete the filer, its tests, the workflow and the command. The workflow is the caller of devops scan alerts, so the command has no caller.
    • Rejected: Keep the command. It files no issue and has no caller.
  • What happens to the open Judge Trivy-config issues?: Close each as not planned with a link to its alert. The alert stays the tracker. (best practice) [sources: src/devops_cli/security/alert_filer.py, SECURITY.md]
    • Chosen: Close each as not planned with a link to its alert. The alert stays the tracker, and the issue stops a second tracker.
    • Rejected: Leave them open. They keep a second tracker that drifts from the alert.
    • Rejected: Convert them to discussions. A discussion is no tracker for a finding.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    type/refactor
    on Nov 28, 2026
  2. dan-petty commented on Nov 28, 2026

    @dan-petty
    OwnerAuthor
  3. added
    scope/security
    source/agent
    status/new
    value/medium
    effort/medium
    priority/p2-medium
    on Nov 28, 2026
  4. added
    status/ready
    and removed
    status/new
    on Nov 28, 2026
  5. devops-cli-service commented on Nov 28, 2026

    @devops-cli-service
    Contributor

    Next step: the stage job writes the plan of the item. See the section Proposed design of the body.

  6. added
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 29, 2026
  7. removed
    status/in-review
    owner/agent
    on Nov 29, 2026
  8. devops-cli-service commented on Nov 29, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-29 05:10 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p2-mediumscope/securitysource/agenttype/refactorvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions