Solutions · Containers
mi-app: a .env inside the container
With example names (mi-app, /ruta/al/proyecto). In GoTool, in 🛡 Security, this page shows your project's: your container, your compose file, your WordPress folder.
What's happening
Container mi-app has /ruta/al/proyecto/.env mounted at /app/.env: the .env, with its keys, is inside.
Why it matters
Any process inside can read it, and whoever gets in through the application takes every key at once.
What to do
- In the compose file (/ruta/al/proyecto/compose.yaml), in service app, remove that volume and pass the variables at startup with env_file (the file stays outside; only the variables get in):
env_file: - ./.env - Better still, passwords as secrets: a file in /run/secrets that the application reads (MYSQL_PASSWORD_FILE=/run/secrets/…).
- Recreate it with the change (whatever isn't in a volume is lost: that's the point):
docker compose -f /ruta/al/proyecto/compose.yaml up -d --force-recreate app
How to know it's fixed
- The .env must not show up:
docker inspect -f '{{range .Mounts}}{{.Source}} {{end}}' mi-app - gotool checks your Docker again on its next pass: once it's gone, it stops showing up.
If you can't do it that way
- If the application can only read a .env, have it read it from /run/secrets, mounted read-only and with only what that service needs.
More
CWE-538 · MITRE ATT&CK T1552.001
In GoTool, the file with the issue (the Dockerfile, the compose file) is also shown with the solution next to it, and the question for Claude comes ready, with your project's details and without your keys, to paste into your claude.ai.