Repository navigation
Flatten the image so the base layer gosu binary is no longer shipped [skip deploy] #no-deploy - #10
Open
SebastianLopezO wants to merge 1 commit into
Open
SebastianLopezO wants to merge 1 commit into
SebastianLopezO wants to merge 1 commit into
Conversation
…[skip deploy] #no-deploy Replacing gosu with a symlink to su-exec only hid the Go binary at runtime: the original file stayed in the TimescaleDB base layer and Snyk Container kept reporting its stdlib 1.18.2 (120 issues, 4 critical). The final stage now copies the prepared filesystem onto scratch and restates the base image configuration.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Caso
Snyk/Container/github.com/tianon/gosu/1: 117 alertasabiertas (63 altas, 50 medias, 4 críticas) en
/usr/local/bin/gosu. Siguen abiertas después de Patch Alpine packages and drop the outdated Go binaries from the TimescaleDB image [skip deploy] #no-deploy #8: el análisisde hoy sobre
1f6067flas vuelve a reportar.net/http/internalrequest smuggling,net/netip,html/template).gosupor un enlace simbólico asu-exec. En tiempo de ejecución el enlace tapa elbinario, pero las capas de una imagen solo se suman: el
gosuoriginal (Go con stdlib 1.18.2) sigue dentro de lacapa de
timescale/timescaledb:2.17.2-pg17y viaja con la imagen. Snyk respeta los borrados (por eso desaparecierontimescaledb-tuneytimescaledb-parallel-copy), pero no la sobrescritura.Análisis
su-exec) ygosuno usanet/httpnihtml/template. Lo que sí pasaba: la imagen distribuía un ejecutable vulnerable que cualquiera puede extraer, y117 alertas falsas para el contexto tapaban las reales y dejaban sin sentido el umbral del escáner.
su-execcomo archivo regular sobre/usr/local/bin/gosu: el reescaneo siguió en 120 hallazgos.Por eso el cambio va a la raíz y no solo a la ruta.
Cambio
base: lo mismo que antes (apk upgrade, fuera los dos binarios de Timescale,su-execcomogosu, esquemay scripts), con
installen vez deln.FROM scratch+COPY --from=base / /: una sola capa con el sistema de archivos ya ajustado. Sedeclaran de nuevo
ENV,VOLUME,STOPSIGNAL,EXPOSE,ENTRYPOINTyCMDde la imagen base, quescratchnotrae (se copiaron de
docker image inspect).Verificación
snyk container test smartpot-db-postgre --file=Dockerfile: de 120 hallazgos (4 críticos,gosu) a «no vulnerablepaths found» en 121 dependencias.
/var/lib/postgresqly/var/run/postgresqlidénticos a la imagen anterior.
tests/validate.shcon raíz de solo lectura ycap-drop ALL: 16/16 sin datos demo y 19/19 con datos demo.