mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-08-29 18:27:33 +00:00
pin gosu, fail closed on BuildTools download, reject zip slip (#4247)
This commit is contained in:
+1
-1
@@ -17,7 +17,7 @@ ARG KNOCKD_REPO_ORG=Metalcape/knock
|
|||||||
RUN --mount=target=/build,source=build \
|
RUN --mount=target=/build,source=build \
|
||||||
TARGET=${TARGETARCH}${TARGETVARIANT} \
|
TARGET=${TARGETARCH}${TARGETVARIANT} \
|
||||||
/build/run.sh install-packages
|
/build/run.sh install-packages
|
||||||
COPY --from=tianon/gosu /gosu /usr/local/bin/
|
COPY --from=tianon/gosu:1.19 /gosu /usr/local/bin/
|
||||||
|
|
||||||
RUN --mount=target=/build,source=build \
|
RUN --mount=target=/build,source=build \
|
||||||
/build/run.sh setup-user
|
/build/run.sh setup-user
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ function buildSpigotFromSource {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
logn ''
|
logn ''
|
||||||
curl -sSL -o ${tempDir}/BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar && \
|
curl -fsSL -o "${tempDir}/BuildTools.jar" https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar && \
|
||||||
java $jvmOpts -jar ${tempDir}/BuildTools.jar --rev "$VERSION" 2>&1 |tee ${spigotBuildLog}| while read l; do echo -n .; done; log "done"
|
java $jvmOpts -jar ${tempDir}/BuildTools.jar --rev "$VERSION" 2>&1 |tee ${spigotBuildLog}| while read l; do echo -n .; done; log "done"
|
||||||
|
|
||||||
case ${TYPE^^} in
|
case ${TYPE^^} in
|
||||||
|
|||||||
@@ -579,12 +579,24 @@ function extract() {
|
|||||||
|
|
||||||
case "${type}" in
|
case "${type}" in
|
||||||
application/zip)
|
application/zip)
|
||||||
|
if unzip -Z1 "${src}" | grep -qE '(^/)|(^\.\./)|(/\.\./)|(/\.\.$)'; then
|
||||||
|
logError "Refusing to extract $src because it contains path traversal entries"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
unzip -o -q -d "${destDir}" "${src}" "$@"
|
unzip -o -q -d "${destDir}" "${src}" "$@"
|
||||||
;;
|
;;
|
||||||
application/x-tar | application/gzip | application/x-gzip | application/x-bzip2)
|
application/x-tar | application/gzip | application/x-gzip | application/x-bzip2)
|
||||||
|
if tar -tf "${src}" | grep -qE '(^/)|(^\.\./)|(/\.\./)|(/\.\.$)'; then
|
||||||
|
logError "Refusing to extract $src because it contains path traversal entries"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
tar -C "${destDir}" -xf "${src}" "$@"
|
tar -C "${destDir}" -xf "${src}" "$@"
|
||||||
;;
|
;;
|
||||||
application/zstd | application/x-zstd)
|
application/zstd | application/x-zstd)
|
||||||
|
if tar --use-compress-program=unzstd -tf "${src}" | grep -qE '(^/)|(^\.\./)|(/\.\./)|(/\.\.$)'; then
|
||||||
|
logError "Refusing to extract $src because it contains path traversal entries"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
tar -C "${destDir}" --use-compress-program=unzstd -xf "${src}" "$@"
|
tar -C "${destDir}" --use-compress-program=unzstd -xf "${src}" "$@"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
|||||||
Reference in New Issue
Block a user