Free browser-based DevOps audit tools โ no signup, nothing leaves your browser
Move passwords to .env files before they end up in git history
services:
db:
image: postgres:15
environment:
- POSTGRES_PASSWORD=mysecretpassword123
- POSTGRES_USER=admin
redis:
image: redis:7
command: redis-server --requirepass myredispassword
app:
environment:
- SECRET_KEY=sk-prod-abc123xyz456
- DATABASE_URL=postgres://admin:mysecretpassword123@db:5432/myapp
POSTGRES_PASSWORD=mysecretpassword123 POSTGRES_USER=admin REDIS_PASSWORD=myredispassword SECRET_KEY=sk-prod-abc123xyz456 DATABASE_URL=postgres://admin:mysecretpassword123@db:5432/myapp
echo ".env" >> .gitignore echo ".env.local" >> .gitignore git add .gitignore && git commit -m "ignore .env files"
services:
db:
image: postgres:15
environment:
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_USER=${POSTGRES_USER}
app:
environment:
- SECRET_KEY=${SECRET_KEY}
- DATABASE_URL=${DATABASE_URL}
POSTGRES_PASSWORD=change_this POSTGRES_USER=myapp REDIS_PASSWORD=change_this SECRET_KEY=change_this DATABASE_URL=postgres://myapp:change_this@db:5432/myapp
Hardcoded secrets are credentials, API keys, and passwords written directly into docker-compose.yml or .env files that get committed to version control. When your repo is public โ or gets breached โ every hardcoded credential is immediately exposed. The fix is to use environment variable references and keep actual values out of version-controlled files.
services:
db:
image: postgres:15
environment:
- POSTGRES_PASSWORD_FILE=/run/secrets/db_password
secrets:
- db_password
secrets:
db_password:
file: ./secrets/db_password.txt
The Docker Auditor detects literal values in environment blocks and flags sensitive key names (PASSWORD, SECRET, API_KEY, TOKEN).
Open Docker Auditor โUse git filter-branch or BFG Repo Cleaner to rewrite history. But first, rotate the compromised secret immediately โ assume it has been seen. Then clean git history, and force-push. If the repo is on GitHub, contact their security team to remove cached views.
Yes. Docker Compose automatically loads a file named .env in the same directory as docker-compose.yml. You can specify a different file with docker compose --env-file .env.production up.
environment: sets variables directly (can use ${VAR} references from .env). env_file: loads an entire file of KEY=VALUE pairs into the container's environment. Both are valid โ use whichever keeps your compose file cleaner.