|
| 1 | +# |
| 2 | +# Licensed to the Apache Software Foundation (ASF) under one or more |
| 3 | +# contributor license agreements. See the NOTICE file distributed with |
| 4 | +# this work for additional information regarding copyright ownership. |
| 5 | +# The ASF licenses this file to you under the Apache License, Version 2.0 |
| 6 | +# (the "License"); you may not use this file except in compliance with |
| 7 | +# the License. You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +# See the License for the specific language governing permissions and |
| 15 | +# limitations under the License. |
| 16 | +# |
| 17 | + |
| 18 | +# Source Provenance Workflow |
| 19 | +# ========================== |
| 20 | +# |
| 21 | +# This workflow implements the requirements of SLSA Source Level 4 |
| 22 | +# (https://slsa.dev/spec/v1.2/source-requirements#source-l4) for our protected branches and tags. |
| 23 | +# |
| 24 | +# ## Background: SLSA Source Level 4 |
| 25 | +# |
| 26 | +# SLSA Source Level 4 requires that each commit on a protected branch carry a signed provenance attestation that proves: |
| 27 | +# |
| 28 | +# 1. **Authenticity**: the commit was processed by a trusted, auditable CI system (GitHub Actions), whose identity is |
| 29 | +# cryptographically bound to the attestation via a short-lived OIDC token issued by GitHub. |
| 30 | +# 2. **Integrity**: the attestation covers the exact commit SHA, so any rewrite of branch history would invalidate |
| 31 | +# existing attestations and be immediately detectable. |
| 32 | +# 3. **Non-repudiation**: the attestation is signed by Sigstore/Fulcio using the OIDC token, creating a transparent, |
| 33 | +# append-only record in the Sigstore public ledger (Rekor) that cannot be silently deleted or altered. |
| 34 | +# |
| 35 | +# Together, these properties let downstream consumers (build pipelines, auditors, dependency scanners) verify that a |
| 36 | +# given commit really came from our repository, was not tampered with after the fact, and was merged under our normal |
| 37 | +# review process. |
| 38 | +# |
| 39 | +# ## How provenance is stored |
| 40 | +# |
| 41 | +# The signed attestation (a JSON Lines document) is attached to each commit as a Git Note in the default |
| 42 | +# `refs/notes/commits` namespace, so it travels with the repository without modifying commit history. |
| 43 | +# |
| 44 | +# To fetch and inspect attestations locally: |
| 45 | +# |
| 46 | +# git fetch origin '+refs/notes/*:refs/notes/*' |
| 47 | +# git notes show # for HEAD |
| 48 | +# git notes show <sha> # for a specific commit |
| 49 | +# |
| 50 | +# To verify a commit using the SLSA source-tool: |
| 51 | +# |
| 52 | +# sourcetool verifycommit --owner apache --repo logging-log4j2 -c <sha> |
| 53 | +# |
| 54 | +# See https://github.com/slsa-framework/source-tool for full documentation. |
| 55 | + |
| 56 | +name: generate-source-provenance |
| 57 | + |
| 58 | +on: |
| 59 | + push: |
| 60 | + # Only protected branches receive attestations. |
| 61 | + branches: |
| 62 | + - "2.x" |
| 63 | + - "main" |
| 64 | + - "release/*" |
| 65 | + |
| 66 | +# No default permissions: individual jobs declare exactly what they need. |
| 67 | +permissions: { } |
| 68 | + |
| 69 | +jobs: |
| 70 | + |
| 71 | + # Generates and stores a signed SLSA Source provenance attestation for each commit pushed to a protected branch. |
| 72 | + # The action `slsa_with_provenance`: |
| 73 | + # |
| 74 | + # 1. Runs `source-tool` to collect the commit metadata and verify that the branch satisfies the SLSA Source policy. |
| 75 | + # 2. Signs the resulting attestation using the GitHub Actions OIDC token via Sigstore, which also publishes the |
| 76 | + # signing event to the public Rekor transparency log. |
| 77 | + # 3. Attaches the signed attestation to the commit via `git notes`. |
| 78 | + generate-source-provenance: |
| 79 | + uses: slsa-framework/source-actions/slsa_with_provenance@dea965cdca5e0cb422bf7b2653c9d15f678ad01c # 0.1.0 |
| 80 | + permissions: |
| 81 | + # Needed to push the attestation to refs/notes/commits. |
| 82 | + contents: write |
| 83 | + # Needed to obtain the GitHub OIDC token used for Sigstore signing. |
| 84 | + id-token: write |
| 85 | + with: |
| 86 | + version: v0.6.3 |
| 87 | + # Allow merge commits so that `release/*` branches can be integrated back |
| 88 | + # into `main` via a merge commit after a release. |
| 89 | + allow-merge-commits: true |
| 90 | + # Use the pre-compiled `slsa-source-tool` binary rather than building it |
| 91 | + # from source. |
| 92 | + build-from-source: false |
0 commit comments