Repository navigation
docker: install ca-certificates in Debian image final stages - #33136
Conversation
oven/bun:latest and oven/bun:<version> build from debian:trixie, and the -slim tags from debian:trixie-slim. Neither base ships a CA trust store, so tools that verify TLS against the system store (such as apt over HTTPS) fail with "certificate verify failed" in derived images. bun itself is unaffected because it bundles its own root certificates. Install ca-certificates in the final stage of the debian and debian-slim images so apt over HTTPS works again, restoring the behavior of the Debian 12 (bookworm) based images used through 1.3.13.
|
Updated 7:21 AM PT - Jun 30th, 2026
❌ @robobun, your commit d3d103d has 4 failures in
🧪 To try this PR locally: bunx bun-pr 33136That installs a local version of the PR into your bun-33136 --bun |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (4)
WalkthroughBoth ChangesCA Certificates in Debian Docker Images
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Comment |
There was a problem hiding this comment.
LGTM — straightforward Dockerfile fix adding ca-certificates to the trixie runtime stages, with a regression check in the existing Docker smoke tests.
Extended reasoning...
Overview
This PR adds a single RUN apt-get install ca-certificates layer to the final stage of dockerhub/debian/Dockerfile and dockerhub/debian-slim/Dockerfile, fixing a regression introduced when the base images moved from bookworm to trixie (#33135). It also extends the two existing Docker build smoke tests to tag the built image, run it, and assert /etc/ssl/certs/ca-certificates.crt is present and non-empty, with cleanup in a finally block.
Security risks
None. Installing ca-certificates from the official Debian repos is the standard way to provision the system trust store and strictly improves the image's TLS posture. No new network surfaces, credentials, or executable inputs are introduced.
Level of scrutiny
Low. The Dockerfile change is a 4-line idiomatic apt install/clean block identical in shape to what the build stage already runs successfully against the same base image, so there's no bootstrap concern. The test changes are mechanical: same Bun.spawn pattern as before, plus a -t <uuid> tag, a docker run check (the entrypoint correctly execs sh since it's on PATH), and docker rmi -f cleanup.
Other factors
No CODEOWNERS cover dockerhub/ or these test files, there are no outstanding reviewer comments, and the bug-hunting system found nothing. The change is small, self-contained, and clearly motivated by a linked user-reported regression.
There was a problem hiding this comment.
LGTM — straightforward fix adding ca-certificates to the Debian runtime stages.
Extended reasoning...
Overview
This PR adds a single RUN apt-get install ca-certificates step to the final (runtime) stage of dockerhub/debian/Dockerfile and dockerhub/debian-slim/Dockerfile, and extends the two existing Docker smoke tests to tag the built image, run it, and assert that /etc/ssl/certs/ca-certificates.crt is present and non-empty. The fix addresses #33135, where the bump to debian:trixie left the runtime image without a system CA trust store, breaking apt-get over HTTPS.
Security risks
None. Installing ca-certificates is the standard, expected way to provision a system trust store in Debian images — it strictly improves the security posture (TLS verification works) rather than weakening it. No new network surface, secrets, or permissions are introduced. The test changes only add a docker run invocation against a locally-built image with a UUID tag and clean it up in a finally block.
Level of scrutiny
Low. The Dockerfile change is mechanical and mirrors the identical apt-get install ca-certificates pattern already present in the build stage of the same files. It follows the established cleanup convention (apt-get clean && rm -rf /var/lib/apt/lists/*). The root-cause analysis in the PR description is detailed and correct, and the fix is the canonical remedy for this well-known class of issue.
Other factors
No CODEOWNERS cover the dockerhub/ or affected test paths. The bug-hunting system found no issues. I verified that docker-entrypoint.sh will correctly exec sh -c ... for the new test's docker run command. The test additions properly clean up the tagged image even on failure via try/finally. There are no outstanding reviewer comments.
|
CI status for reviewers: this diff is Dockerfile-only (plus the two docker-build test updates) and has zero effect on the bun binary. All compile/build lanes are green. The red test lanes across both CI runs are pre-existing flakes and infrastructure, not this change:
The docker-build tests that actually exercise this change ( |
Summary
oven/bun:lateststopped being able toapt-get installover HTTPS in 1.3.14. apt fails with:Downgrading to
oven/bun:1.3.13fixes it.Fixes #33135.
Reproduction
oven/bun:1.3.13builds the same Dockerfile successfully.Root cause
1.3.14 moved the images from Debian 12 (bookworm) to Debian 13 (trixie) in 5bdb8ec. The tag mapping (
.github/workflows/release.yml) is:oven/bun:latest,oven/bun:<version>,oven/bun:debianbuild fromdockerhub/debian(FROM debian:trixie)oven/bun:<version>-slim,oven/bun:slimbuild fromdockerhub/debian-slim(FROM debian:trixie-slim)Neither
debian:trixienordebian:trixie-slimships theca-certificatespackage, so the final image has no system CA trust store (/etc/ssl/certs/ca-certificates.crt). Thebuildstage installsca-certificates, but that stage is thrown away; the runtime stage starts from a fresh base and never installs it.On the bookworm images this was invisible because apt reached its mirror over HTTP, which needs no TLS verification. On trixie the mirror is reached over HTTPS (the reporter's log), and with no CA store the handshake fails with
certificate verify failed.bun itself is unaffected because it bundles its own root certificates (
getBundledRootCertificates), sofetchandbun installover HTTPS keep working. The breakage is limited to system tools that use the system trust store, such as apt, curl, and wget.Fix
Install
ca-certificatesin the final stage of both Debian images:RUN apt-get update -qq \ && apt-get install -qq --no-install-recommends ca-certificates \ && apt-get clean \ && rm -rf /var/lib/apt/lists/*The alpine image uses apk over HTTP mirrors, and the distroless image has no package manager (and relies on bun's bundled roots), so neither is affected and both are left unchanged.
Tests
Extended the existing
docker buildsmoke tests for the two Debian images (test/js/bun/test/parallel/test-docker-build-debian.tsandtest-docker-build-debian-slim.ts) to build the image, then run it and assert the final image contains a non-empty/etc/ssl/certs/ca-certificates.crt. Without this change the file is absent and the assertion fails; with it the assertion passes. These run on the Docker CI lane.Verification note
This is a Dockerfile-only change, so the automated fail-before/pass-after harness can't exercise it: it strips
src//packages/(this diff touches neither), and building the image requires pullingdebian:trixiefrom Docker Hub, which the CI sandbox firewalls off. The root cause is confirmed from the official Debian rootfs manifests (noca-certificatesintrixieortrixie-slim, both using the same mirror scheme as bookworm which does not), the regressing commit, and the reporter's log. The added tests verify the fix on the Docker CI lane, where image pulls are allowed.