Pin your web server, and make the build check it
Our frontend's Docker image installed whatever nginx the OS repository offered. I switched to nginx's own mainline repository, pinned a version, and made the build fail on anything older.
Frontend security isn’t only npm packages. Our legacy operations console, like most single-page apps, is served by nginx inside a Docker image. In 2026 nginx published a long run of security advisories, and our image wasn’t getting the fixes when we expected.
The problem
The Dockerfile installed nginx from the operating system’s package repository. That’s convenient, but OS repositories lag. They ship a version that was current when the OS release was cut, and patch it on their own schedule. So “rebuild the image” didn’t mean “get the latest nginx”. It meant “get whatever the OS currently offers”, which could be behind the version that fixed a published CVE.
Worse, nothing told us. The build passed either way.
The fix
Two changes, in the Dockerfile and the build spec:
- Install from nginx’s own mainline repository, which gets new releases (and their security fixes) directly.
- Pin a version and verify it at build time. We pinned 1.31.2, and added a step that reads the installed version and fails the build if it’s older, with a message naming the 2026 CVEs that version fixes.
installed=$(nginx -v 2>&1 | sed 's|.*nginx/||')
# fail if $installed sorts below the minimum
Now an old nginx can’t slip into an image silently. The build stops, and the error explains why.
The other half
A pin is a snapshot. In October 2026, five more nginx CVEs were published, fixed in 1.31.7, and some of them affect 1.31.2. The check guarantees we’re never below the floor. It can’t tell us the floor has moved. That still takes someone watching nginx’s advisories page and raising the number.
What I learned
- Your web server is a dependency. It just isn’t in
package.json, so the usual tools don’t flag it. - “Latest from the OS” isn’t “latest”. Use the vendor’s repository when you need fixes promptly.
- Turn assumptions into build failures. “We’re on a safe version” is a belief. A version check that fails the build makes it a fact.
- Floors need owners. A minimum version is only as good as the person who raises it when the next advisory comes out.