Skip to content

Accept SSL_CERT_FILE pointing at a /kaniko CA bundle copy - #150

Open
xnox wants to merge 1 commit into
chainguard-dev:mainfrom
xnox:kaniko
Open

Accept SSL_CERT_FILE pointing at a /kaniko CA bundle copy#150
xnox wants to merge 1 commit into
chainguard-dev:mainfrom
xnox:kaniko

Conversation

@xnox

@xnox xnox commented Aug 13, 2026

Copy link
Copy Markdown
Member

Problem

cgr.dev/chainguard/kaniko carries a copy of the CA bundle at /kaniko/ssl/certs/ca-certificates.crt and sets SSL_CERT_FILE to it:

$ crane config cgr.dev/chainguard-private/kaniko:latest | jq -r '.config.Env[]'
...
SSL_CERT_FILE=/kaniko/ssl/certs/ca-certificates.crt

CertificateAudit only accepted /etc/ssl/certs/ca-certificates.crt, so the rule failed the image on its SSL_CERT_FILE criterion even though the copy is byte-identical to the packaged bundle.

Change

tst:3 becomes an OR, so SSL_CERT_FILE may name either location — but the alternative is accepted only as a whole, never as a bare string match:

AND: /etc bundle exists · /etc stamp well-formed · /etc bundle hash == /etc stamp
     OR:  SSL_CERT_FILE == /etc/ssl/certs/ca-certificates.crt                    (tst:3)
          AND: /kaniko copy exists                                               (tst:8)
               OR:  AND: /kaniko stamp exists & well-formed                      (tst:11)
                         /kaniko copy hash == /kaniko stamp digest               (tst:12)
                    AND: no /kaniko stamp file                                   (tst:13)
                         /kaniko copy hash == /etc stamp digest                  (tst:9)
               SSL_CERT_FILE == /kaniko/...                                      (tst:10)
     OR:  Java truststore branch, unchanged

A stamp file shipped beside the copy is authoritative where there is one; otherwise the copy falls back to the system stamp at /etc/ssl/certs/.ca-certificates.crt.sha256 — the layout kaniko ships today, which has the copy but no stamp beside it.

The fallback arm is gated on tst:13, a unix:file_test with check_existence="none_exist", rather than on the parse test failing. That is what makes it precedence rather than an OR of two acceptable digests: when a stamp sits beside the copy it is the only digest that counts. It also keeps "no stamp shipped" distinct from "stamp shipped but unparseable" — the latter fails instead of silently falling back.

The bundle and stamp criteria under /etc stay mandatory for every image: that stamp is the only digest source a copy shipped without one can be checked against.

Tests

Six new offline fixtures, all run against real openscap:

fixture verdict dimension
pass_kaniko_bundle pass fallback arm — copy, no stamp beside it (what kaniko ships)
pass_kaniko_own_stamp pass own-stamp arm is reachable
fail_kaniko_own_stamp_wrong_digest fail precedence — the system stamp would have matched, so this fails only because the local stamp wins
fail_kaniko_malformed_own_stamp fail unparseable stamp beside the copy is a present stamp, not an absent one
fail_kaniko_tampered_bundle fail copy diverges from the system stamp
fail_kaniko_env_without_bundle fail naming an accepted path is not enough on its own

Plus a cabundle-kaniko e2e fixture mirroring the real image's layout, and overlay.CopyFile, which lets a fixture reproduce a base file at a second path without restating its bytes (with unit tests).

Verified locally: all 16 certificate_audit offline fixtures pass, full make test-offline green, cabundle-kaniko / baseline-clean / cabundle-tampered e2e fixtures pass, golangci-lint clean. make validate_xml still fails, with an error set byte-identical to main — those schematron errors are pre-existing and noted in the Makefile.

🤖 Generated with Claude Code

cgr.dev/chainguard/kaniko carries a copy of the CA bundle at
/kaniko/ssl/certs/ca-certificates.crt and sets SSL_CERT_FILE to it, so
CertificateAudit failed the image on its SSL_CERT_FILE criterion even
though that copy is byte-identical to the packaged bundle.

Accept the alternative location, but only as a whole: the copy must
exist and carry the digest recorded for it. A stamp file shipped beside
the copy is authoritative where there is one; otherwise the copy falls
back to the system stamp at /etc/ssl/certs/.ca-certificates.crt.sha256,
which is the layout kaniko ships today. Gating that fallback on the
stamp file being absent, rather than on it yielding no digest, keeps a
divergent or unparseable stamp beside the copy from being sidestepped by
the system one.

The bundle and stamp criteria under /etc stay mandatory for every image:
that stamp is the only digest source a copy shipped without one can be
checked against.

Six offline fixtures cover the new branches — the fallback and own-stamp
passes, plus a copy that diverges from the system stamp, a stamp beside
the copy naming an impossible digest (which the system stamp would have
matched, so it fails only because the local stamp wins), an unparseable
stamp beside the copy, and SSL_CERT_FILE naming a copy that was never
laid down. The e2e tier gains a cabundle-kaniko fixture mirroring the
layout of the real image. overlay.CopyFile is new, letting a fixture
reproduce a base file at a second path without restating its bytes.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@xnox
xnox requested a review from a team August 13, 2026 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant