trivy: bug: false positive AVD-DS-0011

Describe the bug Scanning an image for Dockerfile misconfiguration with the command

trivy image --image-config-scanners config ...

with a layered Dockerfile containing a COPY command that copies a file from a builder layer as in:

COPY --from=builder somefile /somepath/somefile

fails with the message

CRITICAL: Slash is expected at the end of COPY command argument '/somepath/somefile'
══════════════════════════════════════════════════════════
When a COPY command has more than two arguments, the last one should end with a slash.

See https://avd.aquasec.com/misconfig/ds

It looks like the rego rule implemented in copy_with_more_than_two_arguments_not_ending_with_slash.rego does not take into account the COPY command flags

To Reproduce

Write a simple Dockerfile that copies a file from a builder image

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16 (7 by maintainers)

Most upvoted comments