Skip to content

ci(security): scan the devcontainer image and rescan images daily #6406

Done

Description

@dan-petty

Problem

The devcontainer image is published, attested and tagged at each release with no vulnerability scan: not in the PR, not at release and not on a schedule. grep -ci trivy returns 0 for devcontainer-image.yml, the devcontainer-smoke action and release.yml:147-311. The service, runner and mcp-server images are scanned only when a new build is made. Nothing scans the published digests again, so a CVE that is published after a release stays unseen until the next release, and nothing records it.

Change

Owner decision of 2026-11-19: the devcontainer image scan and a daily scan of the published images start report-only (exit-code 0, SARIF). A later owner decision makes them a gate.

  1. In the read-only devcontainer-smoke job of release.yml, after the smoke test, run the image-scan action of ci(security): scan each image with one Trivy action and SARIF #6405 on the pushed digest with exit-code 0 and SARIF category trivy-image-devcontainer. Add the same step to devcontainer-image.yml, so its daily run also scans.
  2. Add a daily scheduled job: a matrix over service, runner, mcp-server and devcontainer that scans ghcr.io/dan-petty/devops-cli/<name>:latest with exit-code 0. It uploads SARIF in the same category as the release scan, so the alerts open and close by themselves.
  3. Third-party images stay with Trivy Operator (feat(k8s): scan running third-party images with Trivy Operator #4998). Comment on feat(k8s): scan running third-party images with Trivy Operator #4998 that step 2 covers the own images.
  4. The devtools repository has its own release gate and daily scan for its image (feat: build and publish the devtools image from debian sid devtools#1).

Renovate. No new pin. The scheduled job scans :latest tags.

Risk. The devcontainer binaries hold about 440 fixed HIGH and CRITICAL findings (measured in the devcontainer /usr/local/bin), so a gate with exit-code 1 would fail each release at once. Report-only gives the record first. Trivy drops ignored findings before it writes SARIF.

Proof

  • After the first release and the first scheduled run, the code-scanning analyses API lists trivy-image-devcontainer and the three other categories.
  • The release and devcontainer-image runs stay green when the scan has findings (exit-code 0).

Depends on: #6405

Alternatives check of 2026-11-19: not-applicable.
Class: ci, no search.
Tool: none found.

Proposed design

Problem statement

Nothing scans the published devcontainer image at release or on a schedule. Nothing rescans the published service, runner and mcp-server images after a release. A CVE published after a release stays unseen, and no record exists. The change adds the #6405 image scan to the release and daily devcontainer runs. It adds a daily scan of the four :latest images. Both scans stay report-only with SARIF, so GitHub code scanning records each finding.

Acceptance criteria

Requirement: Release devcontainer image scan

The devcontainer-smoke job of .github/workflows/release.yml SHALL scan the pushed devcontainer digest with the #6405 image-scan action at exit-code 0 after the smoke test and keep contents: read and packages: read with no other permission.

Scenario: Release workflow lint

  • WHEN the change to .github/workflows/release.yml runs uv run devops ci --check --only actionlint,zizmor
  • THEN the command passes and reports no finding for .github/workflows/release.yml.

Requirement: Release devcontainer SARIF upload

The devcontainer job of .github/workflows/release.yml MUST download the scan SARIF artifact, gain security-events: write, and upload the SARIF with github/codeql-action/upload-sarif under category trivy-image-devcontainer.

Scenario: Release workflow upload lint

  • WHEN the change to .github/workflows/release.yml runs uv run devops ci --check --only actionlint,zizmor
  • THEN the command passes and reports no finding for .github/workflows/release.yml.

Requirement: Daily devcontainer image scan and upload

The devcontainer job of .github/workflows/devcontainer-image.yml SHALL scan the image it built at exit-code 0 after the smoke test and upload the SARIF as an artifact, and a new scan-upload job MUST upload it under category trivy-image-devcontainer.

Scenario: Daily devcontainer workflow lint

  • WHEN the change to .github/workflows/devcontainer-image.yml runs uv run devops ci --check --only actionlint,zizmor
  • THEN the command passes and reports no finding for .github/workflows/devcontainer-image.yml.

Requirement: Daily rescan of the published images

A new daily workflow .github/workflows/image-rescan.yml MUST scan ghcr.io/dan-petty/devops-cli/<name>:latest for service, runner, mcp-server and devcontainer with the #6405 image-scan action at exit-code 0, and MUST upload one SARIF category per image with security-events: write and packages: read.

Scenario: Rescan workflow lint

  • WHEN the new workflow runs uv run devops ci --check --only actionlint,zizmor
  • THEN the command passes and reports no finding for .github/workflows/image-rescan.yml.

Requirement: Code-scanning record

Each scan MUST upload its SARIF so GitHub code scanning holds an analysis for each of trivy-image-devcontainer, trivy-image-service, trivy-image-runner and trivy-image-mcp-server.

Scenario: Analyses after the first release and schedule run

  • WHEN the first release and the first scheduled run finish and uv run devops gh api 'repos/dan-petty/devops-cli/code-scanning/analyses?per_page=100' --paginate runs
  • THEN the output lists an analysis for each of the four categories.

Requirement: Third-party scope note

The change MUST comment on #4998 that the daily scan covers only the project's own images and that third-party images stay with Trivy Operator.

Scenario: Scope comment on #4998

  • WHEN the pull request merges and uv run devops gh api 'repos/dan-petty/devops-cli/issues/4998/comments' --paginate runs
  • THEN the output lists a comment that names the four own images and leaves third-party images with Trivy Operator.

Existing Tool Considered

The alternatives check in the issue body records not-applicable for class ci. It names no alternative tool. The open, maintained tool that covers the need is Trivy (aquasecurity/trivy, Apache-2.0). The repository already uses Trivy through the local image-scan action. It also pins aquasecurity/trivy-action in .github/workflows/third-party-image-scan.yml. Trivy scans a container image for CVEs and writes SARIF. It lacks a schedule: it never rescans a published digest by itself. The new schedule: trigger and the daily devcontainer run give the rescan. It also lacks run-time coverage of third-party cluster images, which Trivy Operator holds (#4998). The change builds no scanner code. It adds workflow steps and uses the #6405 action.

Key questions

  • Which open, maintained tool scans the images, and which action uploads the SARIF?: Use Trivy through the ci(security): scan each image with one Trivy action and SARIF #6405 image-scan action. Upload with github/codeql-action/upload-sarif in a job that holds security-events: write. The repository already runs ./.github/actions/image-scan for the service image with category trivy-image-service. It pins aquasecurity/trivy-action in third-party-image-scan.yml. The only SARIF upload today is github/codeql-action/upload-sarif in ci.yml. The change reuses it and adds image categories. (best practice) [sources: .github/workflows/release.yml, .github/workflows/third-party-image-scan.yml, .github/workflows/ci.yml, .github/actions/image-scan/action.yml]
    • Chosen: Trivy through the ci(security): scan each image with one Trivy action and SARIF #6405 image-scan action and upload-sarif. It reuses the scanner and upload action already pinned and run in the repository, and adds no new scanner.
    • Rejected: Grype. It adds a second scanner, licence and pin set for no new coverage.
    • Rejected: Own scanner code. It costs far more than workflow steps and needs its own CVE feed.
  • Do the scans start as a gate or report-only?: Report-only: exit-code 0 with a SARIF upload. The owner decision of 2026-11-19 in the body says this. A later owner decision makes them a gate. A gate now fails each release at once. The devcontainer binaries hold about 440 fixed HIGH and CRITICAL findings. The project already ships an image scan report-only when a finding is not the merge's to fix. (best practice) [sources: .github/workflows/third-party-image-scan.yml, docs/SDLC.md]
    • Chosen: Report-only first, gate after a later owner decision. It records each finding with no failure of the release or daily run, and matches the owner decision.
    • Rejected: Gate at once with exit-code 1. About 440 fixed HIGH and CRITICAL findings in the devcontainer binaries fail each release at once.
    • Rejected: No scan. A CVE published after a release stays unseen and nothing records it.
  • How does the read-only devcontainer smoke job upload SARIF?: The scan runs in the job that starts the image, after the smoke test. It writes its SARIF to a file. actions/upload-artifact passes that file to a job that starts no container. That job holds security-events: write and uploads the SARIF with github/codeql-action/upload-sarif. In release.yml, devcontainer-smoke keeps contents: read and packages: read. The devcontainer job gains security-events: write. In devcontainer-image.yml, the devcontainer job scans and uploads the artifact. A new scan-upload job uploads the SARIF. actions/upload-artifact and actions/download-artifact need no actions permission. (best practice) [sources: .github/actions/devcontainer-smoke/action.yml, .github/workflows/release.yml, .github/workflows/devcontainer-image.yml, .github/workflows/ci.yml]
    • Chosen: Scan where the image is, upload in a job with no container. It keeps the no-write-scope property of the privileged-container jobs and still records each scan.
    • Rejected: Scan and upload in the same job with security-events: write. It gives a code-scanning write token to the job that starts a privileged container, which the action description rules out.
    • Rejected: Scan in a new job that pulls the digest from GHCR. The daily devcontainer image exists only on its runner's local registry, so the same design cannot serve both workflows.
  • Which files hold the release and daily devcontainer jobs?: .github/workflows/release.yml holds the devcontainer-image build job, the devcontainer-smoke job and the devcontainer attest-and-tag job. .github/workflows/devcontainer-image.yml holds the daily devcontainer job. The scan step goes after the smoke step in the job that starts the image. The upload step goes in the job that holds the write scope. [sources: .github/workflows/release.yml, .github/workflows/devcontainer-image.yml]
  • Does each of the four images publish a latest tag?: Yes. Each image metadata step tags type=raw,value=latest beside the release tag. Each image name is ghcr.io/${{ github.repository }}/<name>: devcontainer, service, runner and mcp-server. Thus ghcr.io/dan-petty/devops-cli/<name>:latest exists for each. [sources: .github/workflows/release.yml]
  • How does the project show the end-to-end result of the scans?: Read the code-scanning analyses of the repository after the first release and the first scheduled run. Run uv run devops gh api 'repos/dan-petty/devops-cli/code-scanning/analyses?per_page=100' --paginate. Check that the output lists an analysis for each of the four image categories. The project reads code-scanning endpoints this way as a live check. This is a live check after the merges, not an offline gate. (best practice) [sources: docs/guidelines/production-readiness.md, CHANGELOG.md]
    • Chosen: Read the code-scanning analyses with devops gh api. It is the project's existing live check of a code-scanning endpoint and shows the record that the issue makes the proof.
    • Rejected: Read the workflow run log. The log shows the scan, not the code-scanning record that the issue makes the proof.
    • Rejected: Add a test that reads the workflow file. The project drops tests that assert values of manifests and config, and a test cannot show a live analysis.
  • Where does the daily rescan live, and when does it run?: Use a new workflow .github/workflows/image-rescan.yml. Give it schedule: - cron: '45 4 * * *', a matrix over service, runner, mcp-server and devcontainer, and workflow_dispatch. The repository gives each workflow one concern and one schedule. The dedicated third-party-image-scan.yml is the pattern for a scan that is not a build. 04:45 UTC falls after the devcontainer build at 04:15 and the service image tests at 04:30. It falls before the 05:00 CI run. The workflow scans :latest tags, so it adds no new Renovate pin. (best practice) [sources: .github/workflows/devcontainer-image.yml, .github/workflows/service-image-test.yml, .github/workflows/ci.yml, docs/SDLC.md, .github/workflows/third-party-image-scan.yml]
    • Chosen: A new workflow image-rescan.yml on its own daily schedule. It keeps the rescan off the build workflows and their pull-request filters, and the repository gives each workflow one concern and one schedule.
    • Rejected: Add the matrix job to devcontainer-image.yml. It ties the published-image scan to the devcontainer build's paths filter and its runner-local registry.
    • Rejected: Add the matrix job to ci.yml. It puts a network image scan on the required-check workflow and its daily run, which the rescan does not need.
  • Which SARIF category does each scan use?: Use one stable category for each image. Use trivy-image-devcontainer for the release and daily devcontainer scans. Use trivy-image-service, trivy-image-runner and trivy-image-mcp-server for the daily matrix. The service, runner and mcp-server release scans already use those categories. The devcontainer release and daily scans share trivy-image-devcontainer. A fixed finding closes on the next analysis of the same category. The project already gives a scan a stable category with /devops-scan in ci.yml. (best practice) [sources: .github/workflows/release.yml, .github/workflows/ci.yml]
    • Chosen: One category for each image. An alert belongs to one image, so a fix in one image closes its alert and no other, and the devcontainer release and daily scans update the same record.
    • Rejected: One category for all four images. A matrix job per image uploading to one category overwrites the analyses of the other images, and an alert cannot say which image holds the finding.
    • Rejected: No category. GitHub derives a category for each workflow and job, so the release and daily devcontainer scans would hold separate alert sets that never close each other.
  • Which permission does a job need to upload SARIF?: The upload job needs security-events: write and contents: read. The job that pulls the GHCR image needs packages: read. The project's SARIF upload job holds security-events: write in ci.yml. The devcontainer-smoke job holds contents: read and packages: read in release.yml. [sources: .github/workflows/ci.yml, .github/workflows/release.yml, .github/workflows/devcontainer-image.yml]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#6405

Activity

  1. added
    type/infra
    scope/security
    source/agent
    status/new
    on Nov 19, 2026
  2. dan-petty commented on Nov 19, 2026

    @dan-petty
    OwnerAuthor
  3. added
    value/medium
    effort/medium
    priority/p2-medium
    on Nov 19, 2026
  4. devops-cli-service commented on Nov 19, 2026

    @devops-cli-service
    Contributor

    Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.

  5. added
    status/ready
    and removed
    status/new
    on Nov 20, 2026
  6. devops-cli-service commented on Nov 20, 2026

    @devops-cli-service
    Contributor

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

  7. added
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 23, 2026
  8. removed
    status/in-review
    owner/agent
    on Nov 23, 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/mediumpriority/p2-mediumscope/securitysource/agenttype/infravalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions