fix(supply-chain): publish mirrors with digest-preserving crane copy#242
Conversation
The publish job pushed the scanned docker-archive tar with `crane push`, which
re-serializes the image and mints a new manifest digest. For a registry
(mirror) source that breaks the approved-lock invariant source_digest ==
target_digest (RT-11): the lock validator correctly rejected the first
distroless-static promotion because the published index digest (4d52ef30) did
not match the verified upstream manifest digest (7d14daf).
Publish a registry source with `crane copy "${SOURCE_REF}" "${TARGET}"` instead,
copying the exact @digest the scan job already pulled and scanned. The bytes are
identical, so RT-4 (scan-before-publish) still holds and target_digest now
equals the verified source_digest. The oci-tar (build) path keeps `crane push`
since it has no upstream registry and its source_digest collapses to the target
digest. Adds optional upstream login before copy for authenticated mirrors.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 46 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
There was a problem hiding this comment.
Pull request overview
This PR updates the reusable supply-chain promotion workflow to preserve upstream manifest digests when publishing mirrored images to GHCR, so the approved-lock invariant source_digest == target_digest remains valid for registry sourced promotions.
Changes:
- Switch registry sourced publishing from
crane push <tar>to digest-preservingcrane copy "${SOURCE_REF}" "${TARGET}". - Add an optional upstream registry login in the publish job to support authenticated upstream mirrors (for example, dhi.io).
- Keep the existing
oci-tar(build) path publishing viacrane pushsince there is no upstream registry digest to preserve.
Comments suppressed due to low confidence (1)
.github/workflows/supply-chain-promote-core.yml:367
- The step is named "Publish to GHCR and assert digest", but it only shape-checks the GHCR digest. For registry sources, this is the critical invariant the PR is addressing: the published digest should equal the digest embedded in SOURCE_REF. Adding an explicit equality check here will fail fast (before cosign/signing and before any lock update) if something regresses and a digest mismatch is reintroduced.
TARGET_DIGEST=$(crane digest "${TARGET}" --platform "${PLATFORM}")
if ! printf '%s' "${TARGET_DIGEST}" | grep -Eq '^sha256:[0-9a-f]{64}$'; then
echo "::error::GHCR digest has unexpected shape: ${TARGET_DIGEST}"; exit 1
fi
echo "target_ref=${TARGET}" >> "${GITHUB_OUTPUT}"



Problem
The publish job pushed the scanned docker-archive tar with
crane push, whichre-serializes the image and mints a new manifest digest. For a registry
(mirror) source this breaks the approved-lock invariant
source_digest == target_digest(RT-11). The firstdistroless-staticpromotion was correctlyrejected by the lock schema validator:
7d14daf…is the verified upstream manifest (mirror-verify,--platformlinux/amd64);
4d52ef30…is the digest crane minted when re-pushing the tar.Fix
Publish a registry source with
crane copy "${SOURCE_REF}" "${TARGET}"(digest-preserving, registry-to-registry) instead of pushing the tar. It copies
the exact
@digestthe scan job already pulled and scanned, so:target_digestnow equals the verifiedsource_digest=> RT-11 invariant holds;The
oci-tar(build) path keepscrane push(no upstream registry; itssource_digestcollapses to the target digest in update-lock). Adds an optionalupstream login before the copy for authenticated mirrors (dhi.io).
Rollout
Callers pin promote-core by SHA, so the container-images bake caller will be
re-pinned to this commit's SHA (bundled with the lock-YAML-indent fix) before
the next bake.
Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com