Skip to content

Commit a945348

Browse files
fabriciojsclaude
andcommitted
extract only the dockerize binary, owned by root
Since v0.10 the dockerize release tarball also ships LICENSE and README.md. We only moved the binary out, and WORKDIR /app is set before this step, so both files were left in /app of every image (and of every prod app that doesn't ship its own copies). tar also restored the archive's owner, so /usr/local/bin/dockerize was owned by uid 1001 (501 with v0.9.3). The entrypoint runs dockerize as root on every start, so when ASUSER matched that uid the kool user could replace it and get root on the next restart. Extract just the binary straight into /usr/local/bin, without restoring ownership, and assert both in test-image.sh. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent 69ab080 commit a945348

15 files changed

Lines changed: 18 additions & 28 deletions

File tree

‎8.2-prod/Dockerfile‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ RUN adduser -D -u 1337 kool \
2121
&& addgroup kool www-data \
2222
# dockerize
2323
&& DOCKERIZE_ARCH="$( [ "$(uname -m)" = "aarch64" ] && echo arm64 || echo amd64 )" \
24-
&& curl -L "https://github.com/jwilder/dockerize/releases/download/v0.15.2/dockerize-linux-${DOCKERIZE_ARCH}-v0.15.2.tar.gz" | tar xz \
25-
&& mv dockerize /usr/local/bin/dockerize \
24+
&& curl -L "https://github.com/jwilder/dockerize/releases/download/v0.15.2/dockerize-linux-${DOCKERIZE_ARCH}-v0.15.2.tar.gz" | tar xz -C /usr/local/bin --no-same-owner dockerize \
2625
# deps
2726
&& apk --no-cache add su-exec bash sed git openssh-client icu shadow procps \
2827
freetype libpng libjpeg-turbo libzip-dev ghostscript imagemagick \

‎8.2/Dockerfile‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ RUN adduser -D -u 1337 kool \
2222
&& addgroup kool www-data \
2323
# dockerize
2424
&& DOCKERIZE_ARCH="$( [ "$(uname -m)" = "aarch64" ] && echo arm64 || echo amd64 )" \
25-
&& curl -L "https://github.com/jwilder/dockerize/releases/download/v0.15.2/dockerize-linux-${DOCKERIZE_ARCH}-v0.15.2.tar.gz" | tar xz \
26-
&& mv dockerize /usr/local/bin/dockerize \
25+
&& curl -L "https://github.com/jwilder/dockerize/releases/download/v0.15.2/dockerize-linux-${DOCKERIZE_ARCH}-v0.15.2.tar.gz" | tar xz -C /usr/local/bin --no-same-owner dockerize \
2726
# deps
2827
&& apk --no-cache add su-exec bash sed git openssh-client icu shadow procps \
2928
freetype libpng libjpeg-turbo libzip-dev ghostscript imagemagick \

‎8.3-prod/Dockerfile‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ RUN adduser -D -u 1337 kool \
2121
&& addgroup kool www-data \
2222
# dockerize
2323
&& DOCKERIZE_ARCH="$( [ "$(uname -m)" = "aarch64" ] && echo arm64 || echo amd64 )" \
24-
&& curl -L "https://github.com/jwilder/dockerize/releases/download/v0.15.2/dockerize-linux-${DOCKERIZE_ARCH}-v0.15.2.tar.gz" | tar xz \
25-
&& mv dockerize /usr/local/bin/dockerize \
24+
&& curl -L "https://github.com/jwilder/dockerize/releases/download/v0.15.2/dockerize-linux-${DOCKERIZE_ARCH}-v0.15.2.tar.gz" | tar xz -C /usr/local/bin --no-same-owner dockerize \
2625
# deps
2726
&& apk --no-cache add su-exec bash sed git openssh-client icu shadow procps \
2827
freetype libpng libjpeg-turbo libzip-dev ghostscript imagemagick \

‎8.3/Dockerfile‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ RUN adduser -D -u 1337 kool \
2222
&& addgroup kool www-data \
2323
# dockerize
2424
&& DOCKERIZE_ARCH="$( [ "$(uname -m)" = "aarch64" ] && echo arm64 || echo amd64 )" \
25-
&& curl -L "https://github.com/jwilder/dockerize/releases/download/v0.15.2/dockerize-linux-${DOCKERIZE_ARCH}-v0.15.2.tar.gz" | tar xz \
26-
&& mv dockerize /usr/local/bin/dockerize \
25+
&& curl -L "https://github.com/jwilder/dockerize/releases/download/v0.15.2/dockerize-linux-${DOCKERIZE_ARCH}-v0.15.2.tar.gz" | tar xz -C /usr/local/bin --no-same-owner dockerize \
2726
# deps
2827
&& apk --no-cache add su-exec bash sed git openssh-client icu shadow procps \
2928
freetype libpng libjpeg-turbo libzip-dev ghostscript imagemagick \

‎8.4-debian-prod/Dockerfile‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ RUN useradd -m -u 1337 kool \
2121
&& usermod -aG www-data kool \
2222
# dockerize
2323
&& DOCKERIZE_ARCH="$( [ "$(uname -m)" = "aarch64" ] && echo arm64 || echo amd64 )" \
24-
&& curl -L "https://github.com/jwilder/dockerize/releases/download/v0.15.2/dockerize-linux-${DOCKERIZE_ARCH}-v0.15.2.tar.gz" | tar xz \
25-
&& mv dockerize /usr/local/bin/dockerize \
24+
&& curl -L "https://github.com/jwilder/dockerize/releases/download/v0.15.2/dockerize-linux-${DOCKERIZE_ARCH}-v0.15.2.tar.gz" | tar xz -C /usr/local/bin --no-same-owner dockerize \
2625
# gosu
2726
&& GOSU_ARCH="$( [ "$(uname -m)" = "aarch64" ] && echo arm64 || echo amd64 )" \
2827
&& curl -L "https://github.com/tianon/gosu/releases/download/1.17/gosu-${GOSU_ARCH}" -o /usr/local/bin/gosu \

‎8.4-debian/Dockerfile‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ RUN useradd -m -u 1337 kool \
2222
&& usermod -aG www-data kool \
2323
# dockerize
2424
&& DOCKERIZE_ARCH="$( [ "$(uname -m)" = "aarch64" ] && echo arm64 || echo amd64 )" \
25-
&& curl -L "https://github.com/jwilder/dockerize/releases/download/v0.15.2/dockerize-linux-${DOCKERIZE_ARCH}-v0.15.2.tar.gz" | tar xz \
26-
&& mv dockerize /usr/local/bin/dockerize \
25+
&& curl -L "https://github.com/jwilder/dockerize/releases/download/v0.15.2/dockerize-linux-${DOCKERIZE_ARCH}-v0.15.2.tar.gz" | tar xz -C /usr/local/bin --no-same-owner dockerize \
2726
# gosu
2827
&& GOSU_ARCH="$( [ "$(uname -m)" = "aarch64" ] && echo arm64 || echo amd64 )" \
2928
&& curl -L "https://github.com/tianon/gosu/releases/download/1.17/gosu-${GOSU_ARCH}" -o /usr/local/bin/gosu \

‎8.4-prod/Dockerfile‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ RUN adduser -D -u 1337 kool \
2121
&& addgroup kool www-data \
2222
# dockerize
2323
&& DOCKERIZE_ARCH="$( [ "$(uname -m)" = "aarch64" ] && echo arm64 || echo amd64 )" \
24-
&& curl -L "https://github.com/jwilder/dockerize/releases/download/v0.15.2/dockerize-linux-${DOCKERIZE_ARCH}-v0.15.2.tar.gz" | tar xz \
25-
&& mv dockerize /usr/local/bin/dockerize \
24+
&& curl -L "https://github.com/jwilder/dockerize/releases/download/v0.15.2/dockerize-linux-${DOCKERIZE_ARCH}-v0.15.2.tar.gz" | tar xz -C /usr/local/bin --no-same-owner dockerize \
2625
# deps
2726
&& apk --no-cache add su-exec bash sed git openssh-client icu shadow procps \
2827
freetype libpng libjpeg-turbo libzip-dev ghostscript imagemagick \

‎8.4/Dockerfile‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ RUN adduser -D -u 1337 kool \
2222
&& addgroup kool www-data \
2323
# dockerize
2424
&& DOCKERIZE_ARCH="$( [ "$(uname -m)" = "aarch64" ] && echo arm64 || echo amd64 )" \
25-
&& curl -L "https://github.com/jwilder/dockerize/releases/download/v0.15.2/dockerize-linux-${DOCKERIZE_ARCH}-v0.15.2.tar.gz" | tar xz \
26-
&& mv dockerize /usr/local/bin/dockerize \
25+
&& curl -L "https://github.com/jwilder/dockerize/releases/download/v0.15.2/dockerize-linux-${DOCKERIZE_ARCH}-v0.15.2.tar.gz" | tar xz -C /usr/local/bin --no-same-owner dockerize \
2726
# deps
2827
&& apk --no-cache add su-exec bash sed git openssh-client icu shadow procps \
2928
freetype libpng libjpeg-turbo libzip-dev ghostscript imagemagick \

‎8.5-debian-prod/Dockerfile‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ RUN useradd -m -u 1337 kool \
2121
&& usermod -aG www-data kool \
2222
# dockerize
2323
&& DOCKERIZE_ARCH="$( [ "$(uname -m)" = "aarch64" ] && echo arm64 || echo amd64 )" \
24-
&& curl -L "https://github.com/jwilder/dockerize/releases/download/v0.15.2/dockerize-linux-${DOCKERIZE_ARCH}-v0.15.2.tar.gz" | tar xz \
25-
&& mv dockerize /usr/local/bin/dockerize \
24+
&& curl -L "https://github.com/jwilder/dockerize/releases/download/v0.15.2/dockerize-linux-${DOCKERIZE_ARCH}-v0.15.2.tar.gz" | tar xz -C /usr/local/bin --no-same-owner dockerize \
2625
# gosu
2726
&& GOSU_ARCH="$( [ "$(uname -m)" = "aarch64" ] && echo arm64 || echo amd64 )" \
2827
&& curl -L "https://github.com/tianon/gosu/releases/download/1.17/gosu-${GOSU_ARCH}" -o /usr/local/bin/gosu \

‎8.5-debian/Dockerfile‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ RUN useradd -m -u 1337 kool \
2222
&& usermod -aG www-data kool \
2323
# dockerize
2424
&& DOCKERIZE_ARCH="$( [ "$(uname -m)" = "aarch64" ] && echo arm64 || echo amd64 )" \
25-
&& curl -L "https://github.com/jwilder/dockerize/releases/download/v0.15.2/dockerize-linux-${DOCKERIZE_ARCH}-v0.15.2.tar.gz" | tar xz \
26-
&& mv dockerize /usr/local/bin/dockerize \
25+
&& curl -L "https://github.com/jwilder/dockerize/releases/download/v0.15.2/dockerize-linux-${DOCKERIZE_ARCH}-v0.15.2.tar.gz" | tar xz -C /usr/local/bin --no-same-owner dockerize \
2726
# gosu
2827
&& GOSU_ARCH="$( [ "$(uname -m)" = "aarch64" ] && echo arm64 || echo amd64 )" \
2928
&& curl -L "https://github.com/tianon/gosu/releases/download/1.17/gosu-${GOSU_ARCH}" -o /usr/local/bin/gosu \

0 commit comments

Comments
 (0)