Add vulnerability scanning to CI so critical findings block the merge.
BeginnerScenarioSecurity and scanning
Answer
Situation read → Shift-left gating.
What I'd do →
trivy image --exit-code 1 --severity CRITICAL --ignore-unfixed app:$SHA
# or
grype app:$SHA --fail-on high
# or
docker scout cves --exit-code --only-severity critical,high app:$SHA
Also scan the Dockerfile with hadolint and IaC with trivy config.
Why → Exit code fails the pipeline; scheduled rescans catch newly disclosed CVEs.
Interview tip → A passing scan today does not mean safe tomorrow; rescan deployed images.
More on Security and scanning
A scan reports 300 CVEs in your base image. How do you triage?IntermediateWhy is mounting `/var/run/docker.sock` into a container dangerous?IntermediateA developer asks for `--privileged`. What do you do?IntermediateHarden a container run command for a stateless web API.IntermediateA pentester got root inside a container. How bad is it?AdvancedChoose a base image strategy for security across the company.Advanced