Skip to content

fix(security): judge the 52 open Trivy-config alerts #4409

Done
0 of 1 issue completed
Done

Description

@devops-cli-service

Update 2026-11-26 (infra move): many alert files left or leave this repository.


Split from #4401.

The problem: 52 Trivy-config code scanning alerts are open on main, and no fix, dismissal or ignore names them. Their severities are 1 critical, 10 high, 19 medium and 22 low. The critical alert is AZU-0041 in tf/azure/main.tf. The high alerts include KSV-0017 (privileged) in k8s/gpu-feature-discovery/daemonset.yaml and DS-0002 (image user is root) in .devcontainer/Dockerfile and 5 alerts in the main.tf of tf/aws, tf/azure and tf/gcp (1, 1 and 3). Their places are k8s/coredns (12), tf/gcp (10), tf/azure (7), k8s/llm (5), k8s/devops (4), k8s/gpu-feature-discovery (4), tf/aws (4), .devcontainer/Dockerfile (3) and 3 other files. Nothing judges an alert, so each one waits with no owner and the oldest is 13 days old. Why this part is deferred: SECURITY.md makes a CRITICAL finding the decision of the owner, and only a person's verdict confirms a finding. The item that files this issue adds the rule and the filer. This issue applies them to the alerts that are open now. Acceptance criteria: - [ ] Each open Trivy-config alert holds a fix, a dismissal with a reason, or an entry of .trivyignore.yaml with a statement and an expired_at date. - [ ] AZU-0041 needs no decision here: tf/azure is removed (#6767). - [ ] GPU feature discovery needs no change: dan-petty/homelab removed the workload, and step 17 (#7290) deletes the file. - [ ] devops gh api 'repos/dan-petty/devops-cli/code-scanning/alerts?state=open' --paginate --jq '[.[] | select(.tool.name==Trivy-config)] | length' prints 0. - [ ] A follow-up comment on this issue names the alert that each change, dismissal or ignore closes.

Proposed design

Problem statement

The infra move has already taken the files out of this repository: tf/ lives in dan-petty/infra, and #7290 deleted every file under k8s/ outside k8s/devops, including k8s/coredns, k8s/llm and k8s/gpu-feature-discovery. The Trivy-config alerts at those paths close on the next scan and get no ignore entry. The alerts whose files remain are judged here: the file is fixed when a safe edit removes the result, and otherwise a dated .trivyignore.yaml entry with a statement and an expired_at date hides it, within the 3-day and 14-day limits of SECURITY.md. The change renews each existing entry whose date has passed or is about to pass, because an expired entry reports its finding again. No entry hides a CRITICAL result, no agent dismisses an alert, and a live trivy-config scan plus the live code-scanning alert count prove the outcome.

Acceptance criteria

Requirement: Each remaining alert is fixed or hidden by a live entry

The change SHALL leave no Trivy-config finding of LOW or higher severity in the tree: each finding is fixed in its file, or a .trivyignore.yaml entry that names its rule id and its path, with a statement and an unexpired expired_at, hides it.

Scenario: The IaC scan reports no remaining finding

  • WHEN uv run devops scan report --scanner trivy-config --fail-on low runs on the change from the repository root
  • THEN it exits 0 and reports no finding at LOW or higher severity.

Requirement: No alert stays open at a path that the tree lacks

After the merge, the repository MUST hold no open Trivy-config alert at a path that this tree no longer holds, so the change adds no .trivyignore.yaml entry for tf/, k8s/coredns, k8s/llm or k8s/gpu-feature-discovery.

Scenario: The live alert query filters the paths that left the repository

  • WHEN devops gh api 'repos/dan-petty/devops-cli/code-scanning/alerts?state=open' --paginate --jq '[.[] | select(.tool.name=="Trivy-config") | .most_recent_instance.location.path | select(startswith("tf/") or startswith("k8s/coredns/") or startswith("k8s/llm/") or startswith("k8s/gpu-feature-discovery/"))] | length' runs after the merge
  • THEN it prints 0.

Requirement: Pending a person after the merge

After the merge, the repository MUST have no open Trivy-config code scanning alert.

Scenario: The live code-scanning query returns no alert

  • WHEN devops gh api 'repos/dan-petty/devops-cli/code-scanning/alerts?state=open' --paginate --jq '[.[] | select(.tool.name=="Trivy-config")] | length' runs after the merge
  • THEN it prints 0.

Requirement: The follow-up comment names each closed alert

The change MUST leave a follow-up comment on #4409 that names the rule id and the path of each Trivy-config alert that it closes.

Scenario: The comment lists each closed alert

  • WHEN devops gh api 'repos/dan-petty/devops-cli/issues/4409/comments' --paginate --jq '[.[].body] | join("\n")' runs after the merge
  • THEN the output names the rule id and the path of each alert that the change closes.

Existing Tool Considered

No alternatives check has run. Trivy (aquasecurity/trivy, pinned by the repository) is the open, maintained tool that runs the trivy config scan and reads .trivyignore.yaml with id, paths, statement and expired_at; the repository already runs it through TrivyConfigScanner and the trivy-config registry scanner. It lacks a verdict on a finding and it cannot dismiss a GitHub alert, which SECURITY.md leaves to a person. The change builds no scanner and no scan engine, so it has no build cost.

Key questions

  • Which alerts does this issue judge after the infra move?: Only the alerts whose files remain in the tree at this commit: the DS-0002 alerts in .devcontainer/Dockerfile, the alerts in k8s/devops, and each finding that the five existing misconfigurations entries still cover (the prompt-adversary fixture and the harbor .venv Dockerfiles) whose entry has expired or expires within days. tf/ is in dan-petty/infra, and refactor(k8s): delete the environment files from devops-cli #7290 deleted every file under k8s/ outside k8s/devops, so the alerts at tf/, k8s/coredns, k8s/llm and k8s/gpu-feature-discovery close on the next scan and get no entry. [sources: README.md:50, k8s/README.md:3, CHANGELOG.md:23, docs/HOMELAB_REPO_SWITCH.md:5, .trivyignore.yaml:2]
  • How does the change handle the GPU feature discovery alert?: It adds no entry. k8s/gpu-feature-discovery/daemonset.yaml is gone at this commit, because refactor(k8s): delete the environment files from devops-cli #7290 deleted every environment file under k8s/ outside k8s/devops, so the next scan reports no result there and the KSV-0017 alert closes. The dated GPU entry of the earlier design is not written, and privileged: true needs no decision. [sources: k8s/README.md:3, CHANGELOG.md:23, docs/HOMELAB_REPO_SWITCH.md:5]
  • Which file format holds a Trivy ignore entry with a path, a statement and an expiry date?: .trivyignore.yaml holds id, paths, statement and expired_at, and the config scan names it with --ignorefile when it exists. The plain .trivyignore text file has no path field. [sources: .trivyignore.yaml:1, src/devops_cli/security/trivy.py:231, SECURITY.md:131]
  • Which severity may an ignore entry hide?: None of severity CRITICAL. SECURITY.md gives the owner the decision on a CRITICAL finding and forbids an agent to ignore one, so this change adds no entry for a CRITICAL result; AZU-0041 needs no decision because tf/azure is gone. [sources: SECURITY.md:92, SECURITY.md:127, SECURITY.md:131]
  • How long may an ignore entry last?: An entry gets an expired_at 3 days after the day of the entry, and the first entry with its renewals lasts at most 14 days in all. A longer date is the owner's decision, and the statement names that decision. [sources: SECURITY.md:85, SECURITY.md:89, SECURITY.md:131]
  • Who dismisses a code scanning alert?: A person dismisses the alert in code scanning with a reason. An agent does not dismiss an alert, so this change fixes the file or adds a dated ignore entry. [sources: SECURITY.md:132]
  • How does the change judge a remaining alert?: Fix the file first. Add a dated .trivyignore.yaml entry only when the fix breaks the workload or needs an unreleased change. Never dismiss a GitHub alert. An entry that is expired or about to expire is renewed within the 3-day and 14-day limits. (best practice) [sources: SECURITY.md:129, SECURITY.md:130, SECURITY.md:131, .trivyignore.yaml:1]
    • Chosen: Fix when safe, renew or add a dated entry otherwise. This follows the order of SECURITY.md: the fix is the first choice, and the dated entry is the recorded fallback where a safe edit does not exist.
    • Rejected: Ignore every remaining alert. This hides a result that a safe edit can remove and leaves unnecessary debt.
    • Rejected: Fix every remaining alert. Some alerts are in files whose fix breaks the build or the workload, such as the build stages of the devcontainer image.
    • Rejected: Dismiss every alert on GitHub. Only a person may dismiss an alert, and a dismissal leaves no reproducible record in the repository.
  • Which command proves that every remaining alert is judged?: uv run devops scan report --scanner trivy-config --fail-on low runs the registry's TrivyConfigScanner, which names .trivyignore.yaml of the scan directory, and it exits 0 only when no finding at LOW or higher survives the entries; a requested scanner that did not run also fails it. The live code-scanning count proves the state of GitHub after the merge. There is no trivy gate row, so uv run devops ci --check --only trivy is replaced by these two checks. (best practice) [sources: src/devops_cli/config/constants.py:6108, src/devops_cli/security/registry.py:44, src/devops_cli/security/trivy.py:231, src/devops_cli/commands/scan.py:1042, docs/commands/scan.md:259]
    • Chosen: Live IaC scan and live code-scanning count. The scan applies the ignore file with the real scanner and fails on a finding or a scanner that did not run; the live count proves the state of GitHub.
    • Rejected: A new trivy row of devops ci. No such row exists, and adding a gate row is new code that this alert-judging change does not need.
    • Rejected: A test that reads .trivyignore.yaml. The project rule requires a validator command or a live check for a config file, and a test asserts no value of it.
    • Rejected: A fixture of the open alerts and a scan test. The fixture copies GitHub state and becomes stale; the live count already proves the state.
  • How does the change clear the DS-0002 alerts in .devcontainer/Dockerfile?: Add one dated DS-0002 entry for the path .devcontainer/Dockerfile. The image already runs as vscode in its runtime stages (USER vscode at lines 46 and 83); the stages without a USER line are build stages that need root, and a USER line in them breaks the build or is inherited by builder, which installs into /opt as root. The statement names that reason and fix(security): judge the 52 open Trivy-config alerts #4409, and expired_at is 3 days after the entry. (best practice) [sources: SECURITY.md:131]
    • Chosen: Dated entry for DS-0002 at .devcontainer/Dockerfile. The runtime stages already set USER vscode; the reported stages are build-only and need root, so no safe edit removes the result and the entry records the reason with an expiry.
    • Rejected: Add USER vscode to every stage. builder starts FROM venv, so a trailing USER vscode in venv makes its uv pip install into /opt run as vscode, and USER root in builder names a root user.
    • Rejected: Rewrite the build stages to run as vscode with chown. This is a rework of the devcontainer build and its smoke test, not a safe edit for an alert-judging change.
  • What does the change do with the existing .trivyignore.yaml entries that expire now?: Renew each entry whose finding the live scan still reports to 3 days after the renewal day, and no later than the 14th day after its first entry: the prompt-adversary KSV-0014 entry expired on 2026-11-21 (first entry 2026-11-18, limit 2026-12-02), the DS-0029 harbor entry ends 2026-11-26 (first entry 2026-11-16, limit 2026-11-30), and the three DS-0002 harbor entries end 2026-11-26 to 2026-11-28 (first entries 2026-11-23 to 2026-11-25, limits 2026-12-07 to 2026-12-09). A date past a limit is the owner's decision and the statement names it. (best practice) [sources: .trivyignore.yaml:2, .trivyignore.yaml:7, .trivyignore.yaml:12, .trivyignore.yaml:17, .trivyignore.yaml:22, SECURITY.md:89, SECURITY.md:131, openspec/changes/archive/2026-11-16-5947-judge-trivy-ds0029-task-template-dockerfile/proposal.md:14]
    • Chosen: Renew each entry within its 14-day limit. An expired entry stops hiding its finding, so the next scan reports it and the alert reopens; a renewal keeps the record dated and inside the policy.
    • Rejected: Let the entries expire. The live scan then fails and the code-scanning alert reopens, which is the state this issue removes.
    • Rejected: Ask the owner now for a longer date. The 14-day limit is not reached for any of the entries, so no owner decision is needed yet.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Sub-issues

Sub-issues

0 of 1 Issues completed
Loading 1 sub-issues

Activity

  1. added
    source/agent
    type/bug
    scope/security
    status/new
    value/medium
    effort/high
    on Nov 10, 2026
  2. devops-cli-service commented on Nov 10, 2026

    @devops-cli-service
    ContributorAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/bug. The fix prefix of the title gives the type.
    • Scope: scope/security. The (security) scope of the title gives the scope.
    • Priority: P2-Medium. The item judges open security alerts, but it waits on #4401 and on the owner's verdict for the critical alert.
    • Value: Medium. It clears 52 unjudged alerts and makes the code scanning count reach 0, but it adds no user-facing function.
    • Effort: High. Each of the 52 alerts needs a fix, a reasoned dismissal or an ignore entry, plus a follow-up comment.
    • Related: fix(security): 52 Trivy-config alerts stay open, none judged #4401, which asks for a different change. Both cover the same 52 open Trivy-config alerts, but #4401 adds the rule and the filer while this item applies them to the alerts open now.
  3. dan-petty commented on Nov 10, 2026

    @dan-petty
    Owner

    This item cannot be built as written. First, this item waits for #4401 to merge. The .trivyignore.yaml format and triage rules do not exist in the codebase yet. Second, acceptance criterion 2 requires the owner to record the decision on AZU-0041 in tf/azure/main.tf. AZU-0041 is a CRITICAL finding. Per SECURITY.md, only the owner can decide on a CRITICAL finding. Third, criterion 4 requires open code scanning alerts on main to reach 0. A pull request cannot close alerts on main before merge.

  4. devops-cli-service commented on Nov 10, 2026

    @devops-cli-service
    ContributorAuthor

    Refine cannot set this item to Ready at e590fa3 until a person answers the questions below. Reply in a comment or edit the body, and the next refine round looks at the item again.

    • Who decides the CRITICAL alert AZU-0041? (a person decides)
    • How does the project confirm that the open Trivy-config alerts on main reach 0? (a person decides)
  5. devops-cli-service commented on Nov 11, 2026

    @devops-cli-service
    ContributorAuthor

    Refine cannot set this item to Ready at 5c71ad4 until a person answers the questions below. Reply in a comment or edit the body, and the next refine round looks at the item again.

    • Who confirms that the open Trivy-config alerts on main reach 0, and comments the alert that each change, dismissal or ignore closes? (a person decides)
  6. devops-cli-service commented on Nov 20, 2026

    @devops-cli-service
    ContributorAuthor

    Owner question: See the first point of Open questions in the section Proposed design of the body.

    Options

    1. Decide the question: The job refines the item with your answer.
    2. Leave it to the job: The job records the best-practice answer and goes on.

    Recommendation: Decide the question: only a person can answer it.

    Evidence

  7. devops-cli-service commented on Nov 21, 2026

    @devops-cli-service
    ContributorAuthor

    Next step: the alternatives check records a verdict. See the section Proposed design of the body.

  8. added
    owner/agent
    status/in-progress
    and removed
    status/new
    on Nov 30, 2026
  9. dan-petty commented on Nov 30, 2026

    @dan-petty
    Owner

    Pull request #7876 closes each open Trivy-config alert of 2026-11-30 as follows. The scan of main after the merge closes the alerts.

    Alert Rule Severity Path of the alert Action
    240 DS-0026 LOW .devcontainer/Dockerfile Fix: HEALTHCHECK NONE in .devcontainer/Dockerfile, Dockerfile, smoke.Dockerfile and the harbor task Dockerfile
    263 KSV-0013 MEDIUM k8s/devops/cronjob-runner.yaml Ignore entry for 6 workloads, expires 2026-12-03
    264 KSV-0036 MEDIUM k8s/devops/roadmap-service/deployment.yaml Ignore entry, expires 2026-12-03
    265 KSV-0048 MEDIUM k8s/devops/roadmap-service/role.yaml Ignore entry, expires 2026-12-03
    1384 KSV-0125 MEDIUM k8s/devops/cronjob-openrouter-reconcile.yaml Ignore entry for 8 workloads, expires 2026-12-03
    1385 KSV-0020 LOW k8s/devops/cronjob-openrouter-reconcile.yaml Ignore entry for 8 workloads, expires 2026-12-03
    1386 KSV-0021 LOW k8s/devops/cronjob-openrouter-reconcile.yaml Ignore entry for 8 workloads, expires 2026-12-03
    1387 KSV-01010 MEDIUM k8s/devops/configmap-sandbox.yaml Ignore entry for 2 ConfigMaps, expires 2026-12-03

    Each alert stands for all the files that hold its rule, because the scan keeps one result for each rule (#7875). So each entry names every path that trivy config reports for the rule: 46 results in 14 files before the change, 0 after it. The tracking issue of each entry is #4409. Alerts 240, 263, 264 and 265 are older than 14 days, so the owner confirms their entries (SECURITY.md, "Judging a Trivy-config Alert").

  10. removed
    status/in-progress
    owner/agent
    on Nov 30, 2026
  11. devops-cli-service commented on Nov 30, 2026

    @devops-cli-service
    ContributorAuthor

    Live since 2026-11-30 20:54 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/highpriority/p2-mediumscope/securitysource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions