From 8ce5b9b41a19327c1f6aa8b2f0b6e7edee749f17 Mon Sep 17 00:00:00 2001 From: slayerjain Date: Wed, 28 Oct 2026 00:38:44 +0530 Subject: [PATCH] feat(playwright): ship certutil, so Chromium under keploy trusts keploy's CA On Linux, Chromium takes its trusted CAs from the user's NSS database ($HOME/.pki/nssdb), not from the system store. keploy now adds its CA there with certutil while it runs (record, test, mock record, mock replay) and removes it at exit (keploy branch feat/ca-nss-db-next). The Playwright image has libnss3, which install-deps brings, but not certutil, which is in the separate libnss3-tools package. Without it keploy warns once and adds nothing, Chromium refuses keploy's certificate, and every HTTPS call a Playwright test makes through keploy ends in a failed handshake: on two enterprise-ui lanes recorded with keploy mock record, 93 and 18 handshakes ("remote error: tls: unknown certificate"), each a call neither recorded nor served. With certutil installed in the lane, both went to 0. The image now installs libnss3-tools, pinned like the image's other tools (NSS_TOOLS_VERSION=2:3.110-1+deb13u4, the build its libnss3 is at), and its verify step checks that certutil is on PATH. Checked on an amd64 box: the published playwright-1.2.49 has no certutil (libnss3 2:3.110-1+deb13u4); this Dockerfile builds on node-1.2.49, and in the result certutil creates a database, adds a CA with trust C,,, lists it and removes it. Signed-off-by: slayerjain --- keploy-ci-playwright/Dockerfile | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/keploy-ci-playwright/Dockerfile b/keploy-ci-playwright/Dockerfile index c802c96..f109318 100644 --- a/keploy-ci-playwright/Dockerfile +++ b/keploy-ci-playwright/Dockerfile @@ -1,6 +1,7 @@ # keploy-ci-playwright: keploy-ci-node + Playwright system deps + browsers + MongoDB tools # Pre-installs the OS-level libraries Chromium needs (fonts, libatk, libnss, etc.), -# THE CHROMIUM BROWSER ITSELF, MongoDB Database Tools, and CI utilities. +# THE CHROMIUM BROWSER ITSELF, MongoDB Database Tools, certutil (so Chromium +# trusts keploy's CA), and CI utilities. # Used by: playwright.yml, playwright-e2e.yml (Woodpecker CI) # The base tag is a BUILD ARG, not a frozen literal. # @@ -37,6 +38,14 @@ ARG MONGO_TOOLS_VERSION=100.10.0 # minutes, on every one of ~16 lanes, on the critical path. ARG PLAYWRIGHT_VERSION=1.62.1 +# Debian trixie's libnss3-tools (certutil; see its install step below), from +# the same nss build as the libnss3 the image already has (2:3.110-1+deb13u4 +# on node-1.2.49). When Debian replaces this build (a security update or a +# point release), the archive stops serving it and the build fails at that +# install step, naming the version: set this to what +# `apt-cache policy libnss3-tools` shows then. +ARG NSS_TOOLS_VERSION=2:3.110-1+deb13u4 + RUN set -eux; \ # ── Playwright system dependencies (OS packages only). # These are the ~200 apt packages (fonts, libatk, libcups, libnss, etc.) @@ -98,12 +107,26 @@ RUN set -eux; \ # ── CI utilities apt-get install -y --no-install-recommends zip zstd ffmpeg; \ \ + # ── certutil (libnss3-tools), so Chromium trusts keploy's CA. + # On Linux, Chromium takes its trusted CAs from the user's NSS database + # ($HOME/.pki/nssdb), not from the system store. keploy (record, test, mock + # record, mock replay) adds its CA there with certutil while it runs, as it + # does to the system store, and removes it at exit. Without certutil keploy + # warns once and adds nothing, so Chromium refuses keploy's certificate: + # every HTTPS call a Playwright test makes through keploy ends in a failed + # handshake ("remote error: tls: unknown certificate" in keploy's log) and is + # neither recorded nor served. libnss3 itself comes from install-deps above; + # certutil is in this separate package. + apt-get install -y --no-install-recommends "libnss3-tools=${NSS_TOOLS_VERSION}"; \ + \ # ── Cleanup apt-get clean; \ rm -rf /var/lib/apt/lists/* /tmp/* /root/.npm/_cacache; \ \ # ── Verify mongorestore --version; \ + command -v certutil; \ + dpkg-query -W libnss3 libnss3-tools; \ # The browsers are the whole point of this image now, and an empty directory # would ship silently: every consumer's probe checks only that the path is # non-empty, so a half-installed tree reads as "baked" and the tests then