diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 772c02d1..4915841f 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -9,6 +9,10 @@ on: # Run tests daily at 2 AM UTC - cron: '0 2 * * *' +permissions: + contents: read + actions: read + env: PYTHON_VERSION: "3.12" POETRY_VERSION: "1.7.1" @@ -540,7 +544,7 @@ jobs: - name: Upload package uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 with: - name: package + name: dist path: dist/ # ============================================================================= diff --git a/.github/workflows/provenance.yml b/.github/workflows/provenance.yml new file mode 100644 index 00000000..b014cc8d --- /dev/null +++ b/.github/workflows/provenance.yml @@ -0,0 +1,41 @@ +# ============================================================================= +# 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@11bd71901bbe5b1630ceea73d27597364c9af683 + + - name: Download build artifacts + uses: actions/download-artifact@v4 + with: + name: dist + path: dist + + - 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 00000000..a372047b --- /dev/null +++ b/.github/workflows/verify-provenance.yml @@ -0,0 +1,32 @@ +# ============================================================================= +# 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 + gh attestation verify "${{ github.sha }}" \ + --owner ${{ github.repository_owner }} \ + --predicate-type https://slsa.dev/provenance/v1 + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}