Skip to content

fix(security): Judge Trivy-config DS-0029 in the Dockerfile #7393

Not planned

Description

@github-actions

Trivy reports a misconfiguration that no issue names.

  • Rule: DS-0029
  • Path: .venv/lib/python3.14/site-packages/harbor/cli/template-adapter/task-template/environment/Dockerfile
  • Severity: HIGH

Open alerts:

Judge it under "Judging a Trivy-config Alert" in SECURITY.md: fix the file, dismiss the alert with a reason, or add a time-limited entry to .trivyignore.yaml. The owner judges a CRITICAL alert within 24 hours. An agent judges any other alert within 14 days.

Proposed design

Problem statement

Trivy reports DS-0029 at .venv/lib/python3.14/site-packages/harbor/cli/template-adapter/task-template/environment/Dockerfile, a template file of the locked harbor package inside the local virtual environment. The path is not repository source and no image build copies it, so the file cannot be fixed here, and the time-limited .trivyignore.yaml entry expired on 2026-11-26 and the alert returned. The change makes the trivy-config scan skip .venv, drops the expired .venv entries, and lets code-scanning alert 281 close when the scan on main no longer reports it.

Acceptance criteria

Requirement: The config scan skips the virtual environment

The trivy-config command SHALL name --skip-dirs .venv so the scan reads no file of the local virtual environment.

Scenario: Command of the config scan

  • WHEN uv run devops ci test tests/config/test_command_builders.py runs the test of build_trivy_scan_cmd for the config scan type
  • THEN The command passes and the test asserts that the config command holds --skip-dirs followed by .venv.

Requirement: Only the config scan skips the virtual environment

The fs scan of build_trivy_scan_cmd MUST build the same command as today, with no --skip-dirs.

Scenario: Command of the filesystem scan

  • WHEN uv run devops ci test tests/config/test_command_builders.py runs the test of build_trivy_scan_cmd for the fs scan type
  • THEN The command passes and the test asserts that the fs command holds no --skip-dirs.

Requirement: The Security Scan reports no virtual-environment finding

The trivy-config scan of the repository MUST report no finding for a file under .venv without an ignore entry for that path.

Scenario: Config scan with the installed Harbor package and no virtual-environment ignore

  • WHEN uv run devops scan report --scanner trivy-config . --format json runs at the repository root after uv sync installed harbor 0.27.0 into .venv and the four .venv entries have left .trivyignore.yaml
  • THEN The command reports no finding whose location is under .venv.

Requirement: Pending a person after the merge

Code-scanning alert 281 SHALL close as fixed after the first Security Scan on main that skips .venv.

Scenario: Alert 281 after the merge

  • WHEN After the merge, uv run devops gh api repos/dan-petty/devops-cli/code-scanning/alerts/281 --jq '.state' runs once the Security Scan on main has uploaded its SARIF
  • THEN The command prints fixed.

Existing Tool Considered

Trivy is the open, maintained tool that covers the need: the pinned ghcr.io/aquasecurity/trivy:0.76.2 (.github/actions/image-scan/action.yml:54) runs trivy config, and its --skip-dirs option leaves a directory out of a scan (openspec/changes/archive/2026-11-20-4361-runner-from-devtools/design.md:25). It lacks the knowledge that .venv holds installed packages rather than project source, so the change names .venv in the exclusion. No alternatives check has run.

Key questions

  • Is the reported Dockerfile part of the repository or a built image?: Neither. The path is .venv/lib/python3.14/site-packages/harbor/cli/template-adapter/task-template/environment/Dockerfile, a template file of the locked harbor 0.27.0 package that uv sync installs into the gitignored local virtual environment; .dockerignore leaves .venv out of every image build context, so no repository file and no built image holds it. [sources: uv.lock:1589, .trivyignore.yaml:9]
  • Which judgment does SECURITY.md require for a Trivy-config alert at a path inside .venv?: Make the trivy-config scan skip .venv and drop the expired .venv entries from .trivyignore.yaml, so the finding no longer exists and code-scanning alert 281 closes as fixed. An agent must not dismiss the alert (SECURITY.md:132), and a time-limited ignore lets the same alert return when it expires, as the DS-0029 entry that expired on 2026-11-26 shows. If alert 281 is still open after the scan on main no longer reports it, a person dismisses it under SECURITY.md:132; an agent does not. (best practice) [sources: SECURITY.md:129, SECURITY.md:131, SECURITY.md:132, .trivyignore.yaml:7, CHANGELOG.md:5910]
    • Rejected: Fix the Harbor template Dockerfile. The file is in the installed harbor package inside .venv, not in this repository, and no image build copies it.
    • Chosen: Exclude .venv from the config scan. The scan stops reading files that are never project source, and the alert closes when the next analysis no longer reports it.
    • Rejected: Renew the .trivyignore.yaml entry. The entry expired on 2026-11-26 and the alert returned; another date repeats the cycle.
    • Rejected: Dismiss alert 281 as a false positive. An agent does not dismiss an alert; only a person does, and the false positive would stay in the scan.
  • How should the config scan exclude .venv?: Add --skip-dirs .venv to the config command that build_trivy_scan_cmd builds (src/devops_cli/config/commands.py:77), so the exclusion applies only to the config scan and a unit test covers the command. Do not add a root trivy.yaml: Trivy reads that file for every scan that starts in the workspace, including the image scans whose runner uses the workspace as its working directory, so a scan.skip-dirs entry could also hide findings inside an image. (best practice) [sources: src/devops_cli/config/commands.py:77, src/devops_cli/security/trivy.py:147, .github/actions/image-scan/action.yml:50, openspec/changes/archive/2026-11-20-4361-runner-from-devtools/design.md:25]
    • Chosen: Pass --skip-dirs .venv on the config command. It uses Trivy's own path exclusion, changes no other scan, and the command builder is covered by an offline test.
    • Rejected: Add a root trivy.yaml with scan.skip-dirs. Trivy reads it for every scan in the workspace, the image scans included, so the exclusion is wider than this finding.
    • Rejected: Filter the .venv findings in devops-cli code. It hides the finding after the scan instead of stopping the scan from reading a directory that is never source, and it keeps project code to maintain.
  • Should the exclusion of .venv be permanent or time-limited?: Permanent, and the four .venv entries leave .trivyignore.yaml. .venv is a gitignored directory that uv sync fills with installed packages, so it is never project source; an ignore entry expires and the finding returns, which is how this alert recurred. (best practice) [sources: .trivyignore.yaml:7, SECURITY.md:131, docs/ROUTINE_TASKS.md:46]
    • Chosen: Permanent exclusion and drop the .venv entries. The directory is never source, and dropping the entries follows the routine that renews or drops an ignore before its date.
    • Rejected: Time-limited ignore entry. The entry expires and the alert returns, as it did after 2026-11-26.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    type/bug
    scope/security
    on Nov 27, 2026
  2. added
    status/new
    value/medium
    effort/low
    on Nov 27, 2026
  3. devops-cli-service commented on Nov 27, 2026

    @devops-cli-service
    Contributor
    • Priority: A live HIGH severity security misconfiguration that must be judged within 14 days.
    • Possible duplicate: fix(security): Judge Trivy-config DS-0029 in the Dockerfile #7276, which may ask for the same change. The model names Judge Trivy-config alert DS-0029 (alert 281) in the task-template Dockerfile by fixing the file, dismissing the alert, or adding a time-limited entry to .trivyignore.yaml as the change that both ask for. Same rule DS-0029, same file path, same alert 281, same severity, and same acceptance criteria as open item 7276. A person closes one of the two if that is so.
  4. added
    priority/p1-high
    on Nov 27, 2026
  5. changed the title [-]fix(security): judge Trivy-config DS-0029 in .venv/lib/python3.14/site-packages/harbor/cli/template-adapter/task-template/environment/Dockerfile[/-] [+]fix(security): Judge Trivy-config DS-0029 in the Dockerfile[/+] on Nov 27, 2026
  6. devops-cli-service commented on Nov 27, 2026

    @devops-cli-service
    Contributor

    The job shortened the title of this item. The summary had 129 characters, and the limit is 60. The type and the scope stay.

    • Before: fix(security): judge Trivy-config DS-0029 in .venv/lib/python3.14/site-packages/harbor/cli/template-adapter/task-template/environment/Dockerfile
    • Source of the summary: the background model
  7. devops-cli-service commented on Nov 27, 2026

    @devops-cli-service
    Contributor

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

  8. dan-petty commented on Nov 28, 2026

    @dan-petty
    Owner

    Closing as a duplicate of #7559 (Alert 281, DS-0029 on .venv/lib/python3.14/site-packages/harbor/cli/template-adapter/task-template/environment/Dockerfile). PR #7570 skips .venv and **/.venv in TrivyConfigScanner and removes the obsolete .venv/ .trivyignore.yaml entries.

  9. removed
    status/new
    on Nov 28, 2026
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/lowpriority/p1-highscope/securitytype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions