-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: Trivy doesn't check COPY instructions when scanning image history #5370
Comments
@simar7 @DmitriyLewen Scanning the Dockefile with the trivy conf .
2023-10-12T21:23:33.794+0700 INFO Misconfiguration scanning is enabled
2023-10-12T21:23:34.348+0700 INFO Detected config files: 1
Dockerfile (dockerfile)
Tests: 26 (SUCCESSES: 23, FAILURES: 3, EXCEPTIONS: 0)
Failures: 3 (UNKNOWN: 0, LOW: 1, MEDIUM: 0, HIGH: 1, CRITICAL: 1)
HIGH: Specify at least 1 USER command in Dockerfile with non-root user as argument
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
Running containers with 'root' user can lead to a container escape situation. It is a best practice to run containers as non-root users, which can be done by adding a 'USER' statement to the Dockerfile.
See https://avd.aquasec.com/misconfig/ds002
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
CRITICAL: Slash is expected at the end of COPY command argument '/bin/hello'
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
When a COPY command has more than two arguments, the last one should end with a slash.
See https://avd.aquasec.com/misconfig/ds011
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Dockerfile:16
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
16 [ COPY --from=builder /src/test /bin/hello /bin/hello
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
LOW: Add HEALTHCHECK instruction in your Dockerfile
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
You should add HEALTHCHECK instruction in your docker container images to perform the health check on running containers.
See https://avd.aquasec.com/misconfig/ds026
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── |
It is an interesting point but as per my understanding during image scanning the final layer is the one that gets evaluated (correct me if I'm wrong though). |
No, it should be detected if the image history contains the layer. It's okay not to detect misconfiguration in the first stage because it cannot be seen in the image history (e.g. |
Dockefile:
Trivy output:
Image history:
I found that a similar problem has already occurred:
What did I expect?
The text was updated successfully, but these errors were encountered: