Skip to content

Commit 9ba76a1

Browse files
author
Paulo Gomes
committed
Enforce runAsNonRoot
BREAKING CHANGE: the controller container is now executed under 65534:65534 (userid:groupid). This change may break deployments that hard-coded the user name 'controller' in their PodSecurityPolicy. Signed-off-by: Paulo Gomes <[email protected]>
1 parent 7b04b44 commit 9ba76a1

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

Dockerfile

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,6 @@ FROM debian:bookworm-slim as controller
9090
# Link repo to the GitHub Container Registry image
9191
LABEL org.opencontainers.image.source="https://github.com/fluxcd/source-controller"
9292

93-
# Configure user
94-
RUN addgroup --gid 65532 controller && \
95-
useradd -u 65532 -s /sbin/nologin -g controller controller
96-
9793
ARG TARGETPLATFORM
9894
RUN apt update && apt install -y ca-certificates
9995

@@ -102,5 +98,5 @@ COPY --from=build /workspace/source-controller /usr/local/bin/
10298
COPY --from=libgit2-bullseye /libgit2/built-on-glibc-version /
10399
COPY ATTRIBUTIONS.md /
104100

105-
USER controller
101+
USER 65534:65534
106102
ENTRYPOINT [ "source-controller" ]

config/manager/deployment.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ spec:
3131
securityContext:
3232
allowPrivilegeEscalation: false
3333
readOnlyRootFilesystem: true
34+
runAsNonRoot: true
3435
capabilities:
3536
drop: [ "ALL" ]
3637
seccompProfile:

0 commit comments

Comments
 (0)