Repository navigation
fix: patch nginx HIGH CVEs in the base image - #262
bohdankanarskyi-runpod wants to merge 6 commits into
Conversation
|
Verdict: ready to merge Findings: none still open. Fixed since last review
What I checked: all four nginx/nginx-common debs (24.04 Risk to current users: low
Release: Test on a live pod: none needed beyond CI. If you want to be thorough, run |
| echo "${p#*:} /tmp/${deb}" | sha256sum -c - && \ | ||
| debs="${debs} /tmp/${deb}"; \ | ||
| done && \ |
There was a problem hiding this comment.
[minor] If the first deb fails to download or fails its checksum, the build keeps going. The loop runs curl && sha256sum -c && debs=...; done, so a failure in the first iteration (nginx_*.deb) only stops that && chain. The loop's exit status comes from the last iteration, so done && still goes on to dpkg -i, now with just nginx-common. Here is the shell behaviour on its own:
$ bash -c 'for p in a b; do [ $p = b ] && echo ok $p; done && echo LOOP_OK'
ok b
LOOP_OK
What happens next depends on how dpkg treats an upgraded nginx-common while the installed nginx needs nginx-common (= old). If dpkg exits 0, the image ships the vulnerable nginx binary and the build passes. The dpkg-query line only prints versions and does not check them. The pinned hashes match what is published today (I checked all four), so this only matters when the mirror misbehaves or a deb is tampered with. Still, a failed checksum should always fail the build. The apt block above has the same pattern.
| echo "${p#*:} /tmp/${deb}" | sha256sum -c - && \ | |
| debs="${debs} /tmp/${deb}"; \ | |
| done && \ | |
| echo "${p#*:} /tmp/${deb}" | sha256sum -c - && \ | |
| debs="${debs} /tmp/${deb}" || exit 1; \ | |
| done && \ |
| for p in "nginx_${ver}_amd64.deb:${sha_nginx}" "nginx-common_${ver}_all.deb:${sha_common}"; do \ | ||
| deb="${p%%:*}" && \ | ||
| curl -fsSL --proto '=https' --tlsv1.2 -o "/tmp/${deb}" \ | ||
| "https://security.ubuntu.com/ubuntu/pool/main/n/nginx/${deb}" && \ |
There was a problem hiding this comment.
[major] This URL stops working as soon as Ubuntu publishes the next nginx security update. After that, every base build on a CUDA parent fails with a 404 whenever the layer cache misses.
security.ubuntu.com/ubuntu/pool keeps only the current build of each source. I checked today:
nginx_1.24.0-2ubuntu7.21_amd64.deb 200
nginx_1.24.0-2ubuntu7.20_amd64.deb 404 # published only a few days ago, already gone
nginx_1.24.0-2ubuntu7.19_amd64.deb 404
The CUDA parents pin apt to a stale snapshot, which is why this block exists. So on those parents cur stays below ver, and the download runs on every uncached build. Once 7.22 ships, curl -f gets a 404. If the open loop-exit issue above is fixed, that 404 fails the build. If it is not fixed, the build quietly ships only nginx-common. Either way, every family in the release is blocked until someone re-pins. nginx gets security updates often (7.20 → 7.21 within days), so this will happen soon. The apt, brotli and ca-certificates blocks have the same exposure.
The Launchpad librarian keeps superseded builds permanently, and the sha256 still pins the content:
https://launchpad.net/ubuntu/+archive/primary/+files/nginx_1.24.0-2ubuntu7.20_amd64.deb -> 200 (launchpadlibrarian.net)
| "https://security.ubuntu.com/ubuntu/pool/main/n/nginx/${deb}" && \ | |
| curl -fsSL --proto '=https' --tlsv1.2 -o "/tmp/${deb}" \ | |
| "https://launchpad.net/ubuntu/+archive/primary/+files/${deb}" && \ |
No description provided.