Skip to content

CICD-185 · Scan exact built image for high findings ​

Encyclopedia · Workflow security fundamentals · All snippets

Previous · CICD-184 · Next · CICD-186

1. Where it fits ​

  • Placement Bash run step following checkout, or equivalent lab terminal.
  • Prerequisites trusted repository, verified inputs and read-only default access.
  • Platforms local-linux, github-actions, gitea-actions.
  • Parameters IMAGE_REF.

2. Copy the snippet ​

bash
trivy image --severity HIGH,CRITICAL --exit-code 1 "${IMAGE_REF:?}"

3. How it works ​

The image scanner evaluates the supplied image reference with a severity policy. Use the digest tested by the pipeline to bind findings to the deployed bytes.

4. Verify the result ​

Compare the reported target identity to the digest tested in CI.

Validation syntax-validated (Bash parse). Status definitions.