The principle of least privilege (PoLP) grants only the permissions needed for current work, elevates access when necessary, and restores the original level afterward. Avoiding default root or administrator access limits both attacker impact and accidental damage from mistakes such as deleting files in the wrong directory. section 3.5
Apply the principle in containerized applications by narrowing access and limiting what a compromised process can do:
- Use Docker's no-new-privileges setting to prevent an application from gaining additional privileges, including root privileges. section 3.5
- Constrain container memory and CPU so one container cannot consume resources needed by the wider system. section 3.5
- Configure API access narrowly: allow only required origins, HTTP methods, headers, and credentials instead of relying on broad wildcards. section 3.4
- Combine least privilege with defense in depth, including application security, data protection, authentication, authorization, and vulnerability scanning. section 3.5 section 3.9
Narrowing API permissions
An API serving a local frontend allows only the required frontend origin and the GET method. Keeping those settings narrow avoids granting future or unused callers access before the application needs it. section 3.4
















