How do you find leaked secrets in images?
IntermediateProductionImage Security & Hardening
Answer
trivy image --scanners secret app:1.4.2
docker history --no-trunc app:1.4.2 | grep -iE 'password|token|key'
Also run gitleaks/trufflehog on the repo and context. If one leaked, rotating the secret is mandatory; deleting the layer or tag does not help because registries and caches may keep the blob.
More on Image Security & Hardening
Why should containers not run as root, and how do you enforce it?BeginnerWhat is a distroless image and what are the trade-offs?BeginnerHow do you scan an image with Trivy and fail a CI build on serious findings?BeginnerHow do you manage Trivy false positives and accepted risks?IntermediateWhich `docker run` flags make up a hardened runtime baseline?BeginnerWhat does `no-new-privileges` protect against?Beginner