OWASP / Docker-Security

Getting a handle on container security
https://owasp.org/www-project-docker-top-10/
Other
625 stars 130 forks source link

[D01] Issues with relying on (or advertising) Docker instruction "USER <user>[:<group>]" #20

Open hartwork opened 4 years ago

hartwork commented 4 years ago

The current text mentions:

Then, before you start the microservice, the USER <username> [3] switches to this user.

While that is true and might be of help while building an image, it is my understanding that it would be a mistake to let the image tell the operator what user to use unless we have full control over the the image we run. E.g. you could drop line USER node from Dockerfile and when I rebuild or pull the image again next time, I'd start running the image as user root. (If I had a line in docker-compose.yml or my Docker command line running the image, I would be safe against that kind of change.)

What do you think?