Appearance
Why It Matters
Running the final image stage as root expands the blast radius of a container escape, file-write bug, or compromised process. It also makes least-privilege review harder for published build artifacts.
What Triggers
SEC747 tracks FROM stage boundaries and the effective explicit USER in the final stage. It matches only when the last stage ends with an explicit root user such as USER root, USER root:root, USER 0, or USER 0:0.
False Positives
Earlier build stages may legitimately use root while preparing artifacts. This rule intentionally ignores those stages when the final runtime stage drops privileges to a non-root user.
Remediation
Create a dedicated runtime user in the final stage and switch to it with USER app, USER nonroot, or another reviewed non-root account before the image entrypoint runs.