From 44a064cc4a38f787a3a080b599e1f8f81ddb214a Mon Sep 17 00:00:00 2001 From: Tom Cobb Date: Thu, 22 Oct 2026 08:23:23 +0000 Subject: [PATCH 1/3] Test that the compromised eMudhra CAs are rejected Run curl and uvx (bundled and system roots) against the hosts published at https://emudhra.we-have-a-problem.com/ and require a certificate error. Assisted-by: Claude Sonnet 5.5 --- .github/workflows/ci.yml | 3 +++ tests/emudhra.sh | 42 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100755 tests/emudhra.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8e50c96..1441321 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,6 +55,9 @@ jobs: - name: Test cli works in cached runtime image run: docker run --rm tag_for_testing uvx pycowsay 'hello ubuntu-devcontainer!' + - name: Test compromised eMudhra CAs are rejected + run: docker run --rm -v ${{ github.workspace }}/tests:/tests:ro tag_for_testing /tests/emudhra.sh + - name: Log in to GitHub Docker Registry if: github.ref_type == 'tag' uses: docker/login-action@v4 diff --git a/tests/emudhra.sh b/tests/emudhra.sh new file mode 100755 index 0000000..32725b6 --- /dev/null +++ b/tests/emudhra.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# Check that this image no longer trusts the compromised eMudhra intermediate CAs. +# See https://emudhra.we-have-a-problem.com/ +# +# Each host serves a certificate chained through one of the compromised intermediates. +# A client that still trusts them connects fine, so a certificate verification failure +# is the PASS condition here. A failure for any other reason (DNS, network) is a FAIL, +# so a broken network cannot make this test pass by accident. +# +# Fixed by uv >= 0.13.4 (updated bundled roots) and the Ubuntu ca-certificates +# 20260816ubuntu0.* update (system roots, used by curl and by uv --system-certs). +set -u + +HOSTS="dv-g3b-emudhra.we-have-a-problem.com dv-g3b-aaa-emudhra.we-have-a-problem.com" +rc=0 + +for host in $HOSTS; do + # curl uses the system trust store; exit code 60 is "certificate verify failed" + curl -sS -m 30 -o /dev/null "https://$host/" 2>/dev/null + if [ $? -eq 60 ]; then + echo "PASS curl rejects $host" + else + echo "FAIL curl did not reject $host with a certificate error" + rc=1 + fi + + # uv with its bundled roots, then with the system store + for flags in "" "--system-certs"; do + out=$(UV_DEFAULT_INDEX="https://$host/simple" uvx $flags --no-cache pycowsay 2>&1) + if grep -q "invalid peer certificate" <<< "$out"; then + echo "PASS uvx $flags rejects $host" + else + echo "FAIL uvx $flags did not reject $host with a certificate error:" + echo "$out" | tail -5 + rc=1 + fi + done +done + +echo "uv: $(uv --version)" +echo "ca-certificates: $(dpkg-query -W -f='${Version}' ca-certificates)" +exit $rc From 6c589cc85097f6050841c105877cd5592722c66b Mon Sep 17 00:00:00 2001 From: Tom Cobb Date: Thu, 22 Oct 2026 08:30:43 +0000 Subject: [PATCH 2/3] CI: check out the repo so the eMudhra test script can be mounted Assisted-by: Claude Sonnet 5.5 --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1441321..da2e5c9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,6 +55,9 @@ jobs: - name: Test cli works in cached runtime image run: docker run --rm tag_for_testing uvx pycowsay 'hello ubuntu-devcontainer!' + - name: Checkout the test script + uses: actions/checkout@v5 + - name: Test compromised eMudhra CAs are rejected run: docker run --rm -v ${{ github.workspace }}/tests:/tests:ro tag_for_testing /tests/emudhra.sh From 0908add9346056a9c8e4acd405bf2e2cde66f293 Mon Sep 17 00:00:00 2001 From: Tom Cobb Date: Thu, 22 Oct 2026 09:36:55 +0000 Subject: [PATCH 3/3] Only run the eMudhra checks that fail without the fix Negative controls (uv 0.12.24, and ca-certificates 20260601 from a pre-fix snapshot) showed that dv-g3b-aaa-emudhra and uvx --system-certs pass on unpatched images, so they cannot catch a regression. Keep curl and bundled-roots uvx against dv-g3b-emudhra. Assisted-by: Claude Opus 5.5 --- tests/emudhra.sh | 47 ++++++++++++++++++++++------------------------- 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/tests/emudhra.sh b/tests/emudhra.sh index 32725b6..91f03ec 100755 --- a/tests/emudhra.sh +++ b/tests/emudhra.sh @@ -2,40 +2,37 @@ # Check that this image no longer trusts the compromised eMudhra intermediate CAs. # See https://emudhra.we-have-a-problem.com/ # -# Each host serves a certificate chained through one of the compromised intermediates. +# The host serves a certificate chained through one of the compromised intermediates. # A client that still trusts them connects fine, so a certificate verification failure # is the PASS condition here. A failure for any other reason (DNS, network) is a FAIL, # so a broken network cannot make this test pass by accident. # -# Fixed by uv >= 0.13.4 (updated bundled roots) and the Ubuntu ca-certificates -# 20260816ubuntu0.* update (system roots, used by curl and by uv --system-certs). +# Fixed by the Ubuntu ca-certificates 20260816ubuntu0.* update (system roots, used by +# curl) and uv >= 0.13.4 (updated bundled roots). Each check below fails on an image +# without its fix. set -u -HOSTS="dv-g3b-emudhra.we-have-a-problem.com dv-g3b-aaa-emudhra.we-have-a-problem.com" +host=dv-g3b-emudhra.we-have-a-problem.com rc=0 -for host in $HOSTS; do - # curl uses the system trust store; exit code 60 is "certificate verify failed" - curl -sS -m 30 -o /dev/null "https://$host/" 2>/dev/null - if [ $? -eq 60 ]; then - echo "PASS curl rejects $host" - else - echo "FAIL curl did not reject $host with a certificate error" - rc=1 - fi +# curl uses the system trust store; exit code 60 is "certificate verify failed" +curl -sS -m 30 -o /dev/null "https://$host/" 2>/dev/null +if [ $? -eq 60 ]; then + echo "PASS curl rejects $host" +else + echo "FAIL curl did not reject $host with a certificate error" + rc=1 +fi - # uv with its bundled roots, then with the system store - for flags in "" "--system-certs"; do - out=$(UV_DEFAULT_INDEX="https://$host/simple" uvx $flags --no-cache pycowsay 2>&1) - if grep -q "invalid peer certificate" <<< "$out"; then - echo "PASS uvx $flags rejects $host" - else - echo "FAIL uvx $flags did not reject $host with a certificate error:" - echo "$out" | tail -5 - rc=1 - fi - done -done +# uv with its bundled roots +out=$(UV_DEFAULT_INDEX="https://$host/simple" uvx --no-cache pycowsay 2>&1) +if grep -q "invalid peer certificate" <<< "$out"; then + echo "PASS uvx rejects $host" +else + echo "FAIL uvx did not reject $host with a certificate error:" + echo "$out" | tail -5 + rc=1 +fi echo "uv: $(uv --version)" echo "ca-certificates: $(dpkg-query -W -f='${Version}' ca-certificates)"