This commit is contained in:
Thomas L. Kjeldsen 2025-06-03 21:31:11 +02:00 committed by GitHub
commit fc4fc2e58d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 7 deletions

View File

@ -14,15 +14,15 @@
FROM docker.io/debian:bullseye-slim as base
FROM base as build
COPY ["top1", "/tmp/top1"]
RUN \
set -eu; \
cp /tmp/top1 /usr/local/bin/top1; \
chown root:root /usr/local/bin/top1; \
chmod u=rxs,go=rx /usr/local/bin/top1; \
ls -lh /usr/local/bin/top1
touch /usr/local/bin/myfile; \
chown root:root /usr/local/bin/myfile; \
chmod u=rxs,go=rx /usr/local/bin/myfile; \
ls -lh /usr/local/bin/myfile
FROM base as final
COPY --from=build ["/usr/local/bin/top1", "/usr/local/bin/"]
RUN [ -u /usr/local/bin/top1 ]
COPY --from=build ["/usr/local/bin/myfile", "/usr/local/bin/"]
# Test if file exists and its set-user-id bit is set
RUN test -u /usr/local/bin/myfile
LABEL \
description="Testing setuid behavior in Kaniko"