Interview Prep/Jenkins/Credentials & security

Why is running builds as root, or with the Docker socket mounted, a Jenkins security problem?

IntermediateConceptCredentials & security
Answer

Builds run untrusted-ish code: dependencies, test suites, PR changes. With the host Docker socket, any build can start a privileged container that mounts the host filesystem, read other builds' workspaces and credentials, and pivot to the node. On Kubernetes, prefer rootless builders, runAsNonRoot tool containers, dedicated builder nodes, NetworkPolicies, and separate agents for trusted (main branch, deploy) vs untrusted (PRs) builds.

All Jenkins questions Roadmap: Jenkins

More on Credentials & security