verify-provenance #138
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
| # SPDX-FileCopyrightText: Copyright 2025-2026 The Secureblue Authors | |
| # | |
| # SPDX-License-Identifier: Apache-2.0 | |
| name: verify-provenance | |
| permissions: {} | |
| on: | |
| schedule: | |
| - cron: "00 15 * * *" # run at 15:00 UTC every day | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| verify-provenance: | |
| name: Verify provenance | |
| if: github.triggering_actor == 'oakleafknight06' || github.event_name == 'schedule' | |
| runs-on: ubuntu-slim | |
| permissions: | |
| packages: read # needed to pull images | |
| steps: | |
| - name: Install slsa-verifier | |
| uses: slsa-framework/slsa-verifier/actions/installer@ea584f4502babc6f60d9bc799dbbb13c1caa9ee6 # v2.7.1 | |
| - name: Install crane | |
| shell: bash | |
| run: | | |
| CRANE_VERSION=v0.20.7 | |
| CRANE_OS=Linux | |
| CRANE_ARCH=x86_64 | |
| curl -fLsS --retry 5 \ | |
| -o 'go-containerregistry.tar.gz' "https://github.com/google/go-containerregistry/releases/download/${CRANE_VERSION}/go-containerregistry_${CRANE_OS}_${CRANE_ARCH}.tar.gz" \ | |
| -o 'provenance.intoto.jsonl' "https://github.com/google/go-containerregistry/releases/download/${CRANE_VERSION}/multiple.intoto.jsonl" | |
| slsa-verifier verify-artifact go-containerregistry.tar.gz --provenance-path provenance.intoto.jsonl --source-uri github.com/google/go-containerregistry --source-tag "${CRANE_VERSION}" | |
| tar -zxvf go-containerregistry.tar.gz -C /usr/local/bin/ crane | |
| - name: Verify provenance | |
| shell: bash | |
| run: | | |
| images=( | |
| silverblue-startingleaf | |
| ) | |
| failed_images=0 | |
| for image in "${images[@]}"; do | |
| image_url="ghcr.io/oakleafknight06/${image}:latest" | |
| full_ref=$(crane digest --full-ref "${image_url}") | |
| echo "Verifying provenance for ${full_ref}..." | |
| if ! slsa-verifier verify-image --source-uri 'github.com/Oakleafknight06/startingleaf' --source-branch 'main' "${full_ref}"; then | |
| failed_images=$(( failed_images + 1 )) | |
| echo "FAIL: Provenance verification failed for ${image}" | |
| fi | |
| done | |
| if (( failed_images > 0 )); then | |
| echo "FAIL: ${failed_images} image(s) failed provenance verification." | |
| exit 1 | |
| fi |