Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 38 additions & 23 deletions .github/workflows/supply-chain-promote-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# verified source (an upstream digest from supply-chain-mirror-verify, or a
# locally-built OCI tar from supply-chain-build-verify), it:
#
# scan job pull/load to a local tar, Snyk + Trivy BEFORE any public push
# scan job pull/load to a local tar, Snyk + Grype BEFORE any public push
# (red-team RT-4: nothing unscanned reaches public GHCR)
# publish job on scan pass, crane push to GHCR, generate SBOMs with syft in
# archive mode (NO docker.sock mount, red-team RT-8), then
Expand Down Expand Up @@ -89,11 +89,11 @@ on:
type: string
required: false
default: high
trivy_severities:
description: Trivy severities that block promotion
grype_fail_on:
description: Minimum severity that blocks promotion (negligible|low|medium|high|critical)
type: string
required: false
default: CRITICAL,HIGH
default: high
sign:
description: When true and on main, cosign sign + attest the published digest
type: boolean
Expand All @@ -115,6 +115,10 @@ env:
CRANE_SHA256: "c14340087103ba9dadf61d45acd20675490fd0ccbd56ac7901fc1b502137f44b" # pragma: allowlist secret
# syft pinned by digest so a re-tagged scanner image cannot run unexpected code.
SYFT_IMAGE: "anchore/syft:v1.44.0@sha256:86fde6445b483d902fe011dd9f68c4987dd94e07da1e9edc004e3c2422650de6" # pragma: allowlist secret
# Grype replaces Trivy (removed in PR #229 after Trivy's release infra was
# compromised). Pinned by version + checksum, verified before extraction.
GRYPE_VERSION: "0.115.0"
GRYPE_SHA256: "3fad92940650e514c0aa2dad83526942a055e210cec09a8a59d9c024adc2b90e" # pragma: allowlist secret
IMAGE_TAR: image.tar

permissions: {}
Expand Down Expand Up @@ -178,27 +182,38 @@ jobs:
with:
name: ${{ inputs.source_artifact }}

# #CRITICAL: Trivy was removed in PR #229 (64ad9cf) because Trivy's release
# infrastructure was compromised in March 2026. This re-introduction must be
# accompanied by a documented re-vetting decision and ADR-012 before merge.
# #VERIFY: either replace with Grype (consistent with PR #229) or document
# that Trivy's supply chain has been audited and cleared since the compromise.
- name: Trivy gate (blocks on configured severities, pre-publish)
uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0
with:
scan-type: image
input: ${{ env.IMAGE_TAR }}
severity: ${{ inputs.trivy_severities }}
exit-code: "1"
format: sarif
output: trivy-results.sarif

- name: Upload Trivy SARIF
if: always() && hashFiles('trivy-results.sarif') != ''
# Grype replaces Trivy here (PR #229 removed Trivy after its release
# infrastructure was compromised in March 2026). Grype is pinned by version
# and verified by checksum, consistent with the crane install above.
- name: Install Grype (verify checksum before extraction)
run: |
GRYPE_BASE="https://github.com/anchore/grype/releases/download"
GRYPE_ASSET="grype_${GRYPE_VERSION}_linux_amd64.tar.gz"
curl --fail --show-error --silent --location --proto '=https' \
"${GRYPE_BASE}/v${GRYPE_VERSION}/${GRYPE_ASSET}" -o grype.tar.gz
echo "${GRYPE_SHA256} grype.tar.gz" | sha256sum --check
tar xz -C /usr/local/bin grype < grype.tar.gz
rm grype.tar.gz
grype version

- name: Grype gate (blocks on configured severity, pre-publish)
env:
FAIL_ON: ${{ inputs.grype_fail_on }}
run: |
# Scan the local tar and write SARIF. --fail-on exits non-zero when any
# vulnerability at or above FAIL_ON severity is found, BEFORE any public
# push (red-team RT-4). The report is written even on a failing exit.
# #VERIFY grype 0.115.0 supports the docker-archive: scheme and sarif= output.
grype "docker-archive:${IMAGE_TAR}" \
--fail-on "${FAIL_ON}" \
-o "sarif=grype-results.sarif"

- name: Upload Grype SARIF
if: always() && hashFiles('grype-results.sarif') != ''
uses: github/codeql-action/upload-sarif@4e828ff8d448a8a6e532957b1811f387a63867e8 # v4.30.4
with:
sarif_file: trivy-results.sarif
category: trivy-${{ inputs.image_id }}
sarif_file: grype-results.sarif
category: grype-${{ inputs.image_id }}

- name: Check Snyk token available
id: check-snyk-token
Expand Down
Loading