Skip to content

Commit c639b1d

Browse files
committed
Add sbom attestations
1 parent de4b35b commit c639b1d

4 files changed

Lines changed: 57 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ jobs:
2020
permissions:
2121
contents: write
2222
security-events: write
23+
attestations: write
24+
id-token: write
2325

2426
steps:
2527
- name: "Harden the runner (Block egress traffic: Only allow calls to allowed endpoints)"
@@ -42,6 +44,9 @@ jobs:
4244
community.chocolatey.org:80
4345
packages.chocolatey.org:443
4446
api.nuget.org:443
47+
fulcio.sigstore.dev:443
48+
rekor.sigstore.dev:443
49+
tuf-repo-cdn.sigstore.dev:443
4550
4651
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4752
with:
@@ -117,6 +122,22 @@ jobs:
117122
path: ${{ github.workspace }}\.clcache
118123
key: ${{ steps.clcache-restore.outputs.cache-primary-key }}
119124

125+
- name: Find SBOM path
126+
id: find-sbom
127+
shell: bash
128+
run: |
129+
SBOM=$(find build/dfetch-package -name '*.cdx.json' -maxdepth 1 | head -1)
130+
echo "path=$SBOM" >> "$GITHUB_OUTPUT"
131+
- name: Attest binary packages with SBOM
132+
uses: actions/attest@59d89421af93a897026c735860bf21b6eb4f7b26 # v4.1.0
133+
with:
134+
subject-path: |
135+
build/dfetch-package/*.deb
136+
build/dfetch-package/*.rpm
137+
build/dfetch-package/*.pkg
138+
build/dfetch-package/*.msi
139+
predicate-type: 'https://cyclonedx.org/bom'
140+
predicate-path: ${{ steps.find-sbom.outputs.path }}
120141
- name: Store the distribution packages
121142
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
122143
with:

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ jobs:
2828
permissions:
2929
contents: write
3030
security-events: write
31+
attestations: write
32+
id-token: write
3133
with:
3234
release_id: ${{ needs.prep-release.outputs.release_id }}
3335

.github/workflows/python-publish.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ jobs:
1818
build:
1919
name: Build distribution 📦
2020
runs-on: ubuntu-latest
21+
permissions:
22+
contents: read
23+
attestations: write
24+
id-token: write
2125

2226
steps:
2327
- name: "Harden the runner (Block egress traffic: Only allow calls to allowed endpoints)"
@@ -30,6 +34,9 @@ jobs:
3034
release-assets.githubusercontent.com:443
3135
pypi.org:443
3236
files.pythonhosted.org:443
37+
fulcio.sigstore.dev:443
38+
rekor.sigstore.dev:443
39+
tuf-repo-cdn.sigstore.dev:443
3340
3441
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3542
with:
@@ -50,6 +57,17 @@ jobs:
5057
with:
5158
name: python-package-distributions
5259
path: dist/
60+
- name: Find SBOM path
61+
id: find-sbom
62+
run: |
63+
SBOM=$(find dist-sbom -name '*.cdx.json' -maxdepth 1 | head -1)
64+
echo "path=$SBOM" >> "$GITHUB_OUTPUT"
65+
- name: Attest Python distribution with SBOM
66+
uses: actions/attest@59d89421af93a897026c735860bf21b6eb4f7b26 # v4.1.0
67+
with:
68+
subject-path: 'dist/*.whl,dist/*.tar.gz'
69+
predicate-type: 'https://cyclonedx.org/bom'
70+
predicate-path: ${{ steps.find-sbom.outputs.path }}
5371
- name: Store the SBOM
5472
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
5573
with:

doc/tutorials/installation.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,19 @@ Run the following command to verify the installation
8787
$ dfetch environment
8888
8989
.. asciinema:: ../asciicasts/environment.cast
90+
91+
Verifying release integrity
92+
---------------------------
93+
94+
Every dfetch release artifact is published with a `cryptographic attestation`_ that ties
95+
it to the SBOM describing its dependencies. You can verify any downloaded artifact using
96+
the GitHub CLI:
97+
98+
.. code-block:: console
99+
100+
$ gh attestation verify dfetch-<version>-nix.deb --repo dfetch-org/dfetch
101+
102+
See `GitHub artifact attestations`_ for more information on how attestations work.
103+
104+
.. _`cryptographic attestation`: https://docs.github.com/en/actions/security-for-github-actions/using-artifact-attestations/using-artifact-attestations-to-establish-provenance-for-builds
105+
.. _`GitHub artifact attestations`: https://docs.github.com/en/actions/security-for-github-actions/using-artifact-attestations

0 commit comments

Comments
 (0)