đ ONBUILD COPY . /var/www/pwned/
All good titles should contain context. This one goes the extra mile and broadcasts it too!
If you didnât have enough good reasons to never build and push from your local repo, hereâs another:
A Dockerfileâs ONBUILD lines are executed when building containers that depend
on it.
This means a rogue Docker image isnât just a runtime risk to all of its
downstream dependencies, it can ransack your build dir while youâre building
it, adding files that arenât in your .dockerignore to the image that you then
publish, and it can serve them back to the attacker.
That sort of deliberate attack is quite unlikely, but it opens the avenue to accidental leaks too. Unless youâre sure youâve ignored everything important, building locally could expose your .env files, .git/config, core dumps, log files, and that customers.dat~ file you were messing with too.
đâ