Accept SSL_CERT_FILE pointing at a /kaniko CA bundle copy - #150
Open
xnox wants to merge 1 commit into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
cgr.dev/chainguard/kanikocarries a copy of the CA bundle at/kaniko/ssl/certs/ca-certificates.crtand setsSSL_CERT_FILEto it:CertificateAudit only accepted
/etc/ssl/certs/ca-certificates.crt, so the rule failed the image on itsSSL_CERT_FILEcriterion even though the copy is byte-identical to the packaged bundle.Change
tst:3becomes an OR, soSSL_CERT_FILEmay name either location — but the alternative is accepted only as a whole, never as a bare string match: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, aunix:file_testwithcheck_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
/etcstay 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:
pass_kaniko_bundlepass_kaniko_own_stampfail_kaniko_own_stamp_wrong_digestfail_kaniko_malformed_own_stampfail_kaniko_tampered_bundlefail_kaniko_env_without_bundlePlus a
cabundle-kanikoe2e fixture mirroring the real image's layout, andoverlay.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_auditoffline fixtures pass, fullmake test-offlinegreen,cabundle-kaniko/baseline-clean/cabundle-tamperede2e fixtures pass,golangci-lintclean.make validate_xmlstill fails, with an error set byte-identical tomain— those schematron errors are pre-existing and noted in the Makefile.🤖 Generated with Claude Code