diff --git a/.github/workflows/provenance.yml b/.github/workflows/provenance.yml new file mode 100644 index 0000000..cd3d76d --- /dev/null +++ b/.github/workflows/provenance.yml @@ -0,0 +1,46 @@ +# ============================================================================= +# SLSA L1 — Provenance Attestation (OWASP A03: Supply Chain) +# Generates signed provenance for build artifacts +# ============================================================================= + +name: SLSA Provenance Attestation + +on: + push: + branches: [main, develop] + +permissions: + contents: read + id-token: write # Required for OIDC signing + attestations: write + +jobs: + provenance: + name: Generate Provenance Attestation + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Install build tools + run: python -m pip install --upgrade pip build + + - name: Build package + run: python -m build + + - name: Attest build provenance + uses: actions/attest-build-provenance@v2 + with: + subject-path: dist/* + + - name: Upload provenance artifact + uses: actions/upload-artifact@v4 + with: + name: provenance + path: .attestation/ + retention-days: 90 diff --git a/.github/workflows/verify-provenance.yml b/.github/workflows/verify-provenance.yml new file mode 100644 index 0000000..c588965 --- /dev/null +++ b/.github/workflows/verify-provenance.yml @@ -0,0 +1,33 @@ +# ============================================================================= +# SLSA L1 — Verify Provenance Attestation (OWASP A03: Supply Chain) +# Verifies that build artifacts have valid provenance +# ============================================================================= + +name: Verify Provenance + +on: + pull_request: + branches: [main, develop] + +permissions: + contents: read + attestations: read + id-token: write + +jobs: + verify: + name: Verify Source Provenance + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Verify attestation + run: | + # List attestations for this commit + BASE_SHA=$(git rev-parse origin/${{ github.base_ref }}) + gh attestation verify "$BASE_SHA" \ + --owner ${{ github.repository_owner }} \ + --predicate-type https://slsa.dev/provenance/v1 + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}