Skip to content

LS-IAC-001: Dockerfile Secret

Severity HIGH
Blast radius Depends on the credential; treat as exposed
Rotate at https://vasishta03.github.io/leakscan/rules/
Applies to files matching (?:^|/)(?:[\w.-]*Dockerfile[\w.-]*|Containerfile)$

If this leaks

A literal credential was found in a Dockerfile ENV or ARG instruction (it ends up in every image layer and in docker history). Anyone with read access to the file, the image or its history can reuse it. Move it to a secret store and inject it at runtime.

What to do

  1. Rotate or revoke the credential at https://vasishta03.github.io/leakscan/rules/.
  2. Check the provider's audit logs for use you don't recognise.
  3. Remove it from git history (leakscan purge --help) and load it from an environment variable or secret manager instead.

Pattern

(?im)^\s*(?:ENV|ARG)\s+\w*(?:PASSWORD|PASSWD|SECRET|TOKEN|API_?KEY|ACCESS_?KEY|PRIVATE_?KEY|CREDENTIALS?)\w*(?:\s*=\s*|\s+)['\"]?([^\s'\"$]{6,})

Suppress

On one line: # leakscan:ignore LS-IAC-001. For the whole project:

disable_rules: [LS-IAC-001]