From d5378c631fc5454fc9c3d91d9428e77627fde0d1 Mon Sep 17 00:00:00 2001 From: SabaTech-coder Date: Wed, 10 Jun 2026 13:56:08 +0000 Subject: [PATCH 1/2] feat(ci): add SLSA L1 provenance attestation (OWASP A03) - Add provenance.yml with attest-build-provenance for Python packages - Add verify-provenance.yml for PR verification - Implements SLSA L1 supply chain security requirement --- .github/workflows/provenance.yml | 46 +++++++++++++++++++++++++ .github/workflows/verify-provenance.yml | 32 +++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 .github/workflows/provenance.yml create mode 100644 .github/workflows/verify-provenance.yml 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..a372047 --- /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 }} From 283a6be4353b200f2e4ffad20058ed17b992c638 Mon Sep 17 00:00:00 2001 From: Joker Date: Wed, 10 Jun 2026 14:04:03 +0000 Subject: [PATCH 2/2] fix(ci): verify base branch commit in verify-provenance.yml - PRs verify attestation exists on base branch commit - Prevents false negatives from merge commit SHAs - Verified with actionlint --- .github/workflows/verify-provenance.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/verify-provenance.yml b/.github/workflows/verify-provenance.yml index a372047..c588965 100644 --- a/.github/workflows/verify-provenance.yml +++ b/.github/workflows/verify-provenance.yml @@ -25,7 +25,8 @@ jobs: - name: Verify attestation run: | # List attestations for this commit - gh attestation verify "${{ github.sha }}" \ + 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: