-
Notifications
You must be signed in to change notification settings - Fork 489
Description
Context
Our Helm chart for Kubernetes deployment (PR #3852) sets security contexts with runAsNonRoot: true, allowPrivilegeEscalation: false, and capabilities.drop: [ALL]. These are Kubernetes security best practices.
However, our Docker images currently run as root by default (Config.User is empty). This causes CreateContainerConfigError when runAsNonRoot: true is set.
As a workaround, the chart defaults to runAsNonRoot: false. This works but is not ideal for production environments.
What needs to change
-
Add a non-root user to Dockerfiles for
agenta-api,agenta-web, andagenta-services:RUN addgroup --system --gid 10001 agenta && \ adduser --system --uid 10001 --ingroup agenta agenta USER 10001
-
Ensure writable directories are owned by the new user (
/tmp, any cache/log dirs). -
Change
agenta-servicescontainer port from80to a high port like8080. Non-root users cannot bind to ports below 1024. The Kubernetes Service can still expose port 80 viatargetPort: 8080. -
Add a CI check that fails if published images run as root.
-
Update the Helm chart to set
runAsNonRoot: trueonce images support it.
Why this matters
Running containers as root is a security risk. If an attacker gains code execution inside the container, they have root access to the container filesystem and can potentially escape to the host. The Kubernetes "restricted" Pod Security Standard requires non-root containers.