security: don't install ca-certificates in the driver image - #2067
security: don't install ca-certificates in the driver image#2067chris-altamimi wants to merge 1 commit into
Conversation
The driver image is built FROM registry.k8s.io/build-image/debian-base, which
deliberately ships /etc/ssl/certs/ca-certificates.crt copied in from a separate
stage *without* the ca-certificates package, precisely so that openssl is not
pulled in as a dependency (see images/build/debian-base/*/Dockerfile.build in
kubernetes/release).
`clean-install ca-certificates mount` undoes that: ca-certificates hard-Depends
on openssl (>= 1.1.1), so installing it puts openssl and libssl3 back into the
final image. Neither is reachable from the driver, which is built with
CGO_ENABLED=0 and therefore reads the trust bundle as a file through
crypto/x509 -- it never links libssl3 and never execs the openssl CLI.
`mount` is likewise already present in debian-base, so the install is a no-op
for it; it is kept to keep the runtime dependency explicit.
Verified by building the image before and after:
- openssl and libssl3 are no longer installed (82 -> 79 packages)
- /etc/ssl/certs/ca-certificates.crt is still present (142 certs)
- a statically linked Go TLS probe run inside the image still completes a
verified TLS 1.3 handshake to a public endpoint (2 verified chains),
identically to the unmodified image
- /usr/bin/mount is still present and the driver binary still starts
Signed-off-by: Chris Altamimi <chris.altamimi@epsilonasi.com>
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: chris-altamimi The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
This issue is currently awaiting triage. If secrets-store-csi-driver contributors determine this is a relevant issue, they will accept it by applying the The DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
Welcome @chris-altamimi! |
|
Hi @chris-altamimi. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
The driver image installs
ca-certificates, which pullsopensslandlibssl3back into the final image — undoing something the base image goes out of its way to avoid.registry.k8s.io/build-image/debian-basedeliberately ships/etc/ssl/certs/ca-certificates.crtcopied in from a separate stage without theca-certificatespackage, precisely so that openssl is not a dependency (seeimages/build/debian-base/*/Dockerfile.buildinkubernetes/release).clean-install ca-certificates mountindocker/Dockerfilereverses that, becauseca-certificateshard-Dependsonopenssl (>= 1.1.1).Neither package is reachable from the driver. It is built with
CGO_ENABLED=0, so it reads the trust bundle as a file throughcrypto/x509— it never linkslibssl3and never execs theopensslCLI.mountis already present in debian-base, so that half of the install is a no-op; I've kept it so the runtime dependency stays explicit.Why it's worth doing: openssl and libssl3 are a recurring source of CVEs in image scans, and here they are entirely unused. In a recent scan of a cluster running v1.5.0, these two packages accounted for 11 findings on the driver image — 6 of which had no fixed Debian package available at any version, so they could not be resolved by patching, only by not shipping the packages. This change removes that surface permanently rather than waiting on Debian.
Note that this repo's
scan_vulnsworkflow currently runsgovulncheckonly, so OS-package findings like these don't surface in CI.Verification: built the image before and after the change.
opensslandlibssl3are no longer installed (82 → 79 packages)/etc/ssl/certs/ca-certificates.crtis still present (142 certs)/usr/bin/mountis still present and the driver binary still startsSpecial notes for your reviewer:
There is a related, larger issue I'm raising separately against
kubernetes/release:perl-baseis inherited asEssential: yesfromdebian:bookworm-slimand is absent from debian-base's existing purge list, which affects every image built on that base. This PR is scoped only to what the driver image itself controls.TODOs: