|
| 1 | +# Self-provenance and artifact attestations |
| 2 | + |
| 3 | +`sbom-diff-and-risk` analyzes third-party dependency changes, but consumers should also be able to verify where the tool itself came from. This repository generates GitHub artifact attestations for the packaged build outputs produced by the `sbom-diff-and-risk-ci` workflow. |
| 4 | + |
| 5 | +## What is attested in this repository |
| 6 | + |
| 7 | +The attested subjects are the exact Python distributables built from `tools/sbom-diff-and-risk` via `python -m build`: |
| 8 | + |
| 9 | +- the wheel: `dist/sbom_diff_and_risk-<version>-py3-none-any.whl` |
| 10 | +- the source distribution: `dist/sbom_diff_and_risk-<version>.tar.gz` |
| 11 | + |
| 12 | +Those two files are uploaded together as the workflow artifact named `sbom-diff-and-risk-dist`. The attestation applies to the built files themselves, not just to the artifact bundle name shown in the Actions UI. |
| 13 | + |
| 14 | +Current attestations cover workflow-built wheel and sdist artifacts, not GitHub Release assets or PyPI-published distributions. |
| 15 | + |
| 16 | +## Workflow and permissions |
| 17 | + |
| 18 | +The attestation is generated in `.github/workflows/sbom-diff-and-risk-ci.yml` by the `build-and-attest` job in the `sbom-diff-and-risk-ci` workflow. |
| 19 | + |
| 20 | +That job runs only for trusted non-PR events in this repository: |
| 21 | + |
| 22 | +- `push` |
| 23 | +- `workflow_dispatch` |
| 24 | + |
| 25 | +Pull request runs still execute the `test` job, but they do not publish artifact attestations. |
| 26 | + |
| 27 | +The `build-and-attest` job uses the minimum explicit permissions required for GitHub-hosted build provenance: |
| 28 | + |
| 29 | +- `contents: read` for repository checkout |
| 30 | +- `id-token: write` for GitHub's signing identity |
| 31 | +- `attestations: write` to publish the attestation |
| 32 | + |
| 33 | +## Where provenance evidence appears in GitHub |
| 34 | + |
| 35 | +After a successful non-PR run of `sbom-diff-and-risk-ci`, consumers can find the evidence in two useful places: |
| 36 | + |
| 37 | +1. On the workflow run page: |
| 38 | + - the uploaded artifact appears as `sbom-diff-and-risk-dist` |
| 39 | + - this is the run consumers should use to confirm the workflow name, job name, and downloaded artifact bundle before verification |
| 40 | +2. In the repository-wide attestations view: |
| 41 | + - open **Actions** |
| 42 | + - in the left sidebar, under **Management**, open **Attestations** |
| 43 | + - search for `sbom_diff_and_risk-` or filter by recent creation date |
| 44 | + |
| 45 | +On the **Attestations** page, the relevant subjects are the wheel and sdist filenames, not the workflow artifact bundle name. On the workflow run page, the main visible bundle name is still `sbom-diff-and-risk-dist`. |
| 46 | + |
| 47 | +## Manual verification for one workflow run |
| 48 | + |
| 49 | +Use this path after a merge to the default branch or an intentional `workflow_dispatch` run. |
| 50 | + |
| 51 | +1. Open the repository's **Actions** tab. |
| 52 | +2. Open a successful `sbom-diff-and-risk-ci` run triggered by `push` or `workflow_dispatch`. |
| 53 | +3. Confirm that the `build-and-attest` job ran successfully. |
| 54 | +4. Download the `sbom-diff-and-risk-dist` artifact from that run. |
| 55 | +5. Confirm the downloaded archive contains exactly the expected build outputs for that version: |
| 56 | + - `sbom_diff_and_risk-<version>-py3-none-any.whl` |
| 57 | + - `sbom_diff_and_risk-<version>.tar.gz` |
| 58 | +6. Verify one of the files with the GitHub CLI: |
| 59 | + |
| 60 | +```bash |
| 61 | +gh attestation verify path/to/sbom_diff_and_risk-<version>-py3-none-any.whl \ |
| 62 | + --repo OWNER/scientific-computing-toolkit \ |
| 63 | + --signer-workflow OWNER/scientific-computing-toolkit/.github/workflows/sbom-diff-and-risk-ci.yml |
| 64 | +``` |
| 65 | + |
| 66 | +You can verify the source distribution the same way: |
| 67 | + |
| 68 | +```bash |
| 69 | +gh attestation verify path/to/sbom_diff_and_risk-<version>.tar.gz \ |
| 70 | + --repo OWNER/scientific-computing-toolkit \ |
| 71 | + --signer-workflow OWNER/scientific-computing-toolkit/.github/workflows/sbom-diff-and-risk-ci.yml |
| 72 | +``` |
| 73 | + |
| 74 | +If you want more inspection detail during review, ask the CLI for structured output: |
| 75 | + |
| 76 | +```bash |
| 77 | +gh attestation verify path/to/sbom_diff_and_risk-<version>-py3-none-any.whl \ |
| 78 | + --repo OWNER/scientific-computing-toolkit \ |
| 79 | + --signer-workflow OWNER/scientific-computing-toolkit/.github/workflows/sbom-diff-and-risk-ci.yml \ |
| 80 | + --format json |
| 81 | +``` |
| 82 | + |
| 83 | +A successful verification confirms that: |
| 84 | + |
| 85 | +- the downloaded file matches an attested subject |
| 86 | +- the attestation was linked to `OWNER/scientific-computing-toolkit` |
| 87 | +- the attestation was signed by `.github/workflows/sbom-diff-and-risk-ci.yml` |
| 88 | + |
| 89 | +## Release-consumer note |
| 90 | + |
| 91 | +If these same wheel or source distribution bytes are later attached to a GitHub release, consumers should verify the downloaded release asset file itself with the same `gh attestation verify` flow. In the current setup, the provenance source of truth is still the workflow-produced build artifact and its attestation, not a separate release-attestation workflow. |
| 92 | + |
| 93 | +## How this complements the tool's own analysis |
| 94 | + |
| 95 | +Self-provenance and dependency analysis solve different problems: |
| 96 | + |
| 97 | +- artifact attestations help consumers verify where `sbom-diff-and-risk` itself was built |
| 98 | +- `sbom-diff-and-risk` helps users review and gate third-party dependency changes in their own projects |
| 99 | + |
| 100 | +These attestations strengthen trust in the tool's own distributable artifacts, but they do not replace the tool's analysis of external SBOM inputs, policy decisions, or trust-signal reporting for third-party packages. |
0 commit comments