Use hashes instead of version tags
Opened this issue · 0 comments
Letgamer commented
What about instead of:
# Build container
ARG GOVERSION=1.21.6
ARG ALPINEVERSION=3.19
The hashes of the containers are used like this:
ARG GOHASH=2523a6f68a0f515fe251aad40b18545155135ca6a5b2e61da8254df9153e3648 # golang:1.21.6-alpine3.19
FROM --platform=${BUILDPLATFORM} \
golang@sha256:$GOHASH AS build
This would make the container more secure by guaranteeing that the images won't change unless the sha256 is updated manually, so no malicious code will be executed. Version tags on the other hand can be easily overwritten