Skip to content

Commit 0d0a56e

Browse files
authored
docs: add details of how to verify provenance JSON files (#17391)
Signed-off-by: Facundo Tuesca <[email protected]>
1 parent f6161cc commit 0d0a56e

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

docs/user/attestations/consuming-attestations.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,31 @@ and simple JSON APIs.
77

88
For a full API reference, see the [Integrity API documentation].
99

10+
## Internals
11+
12+
Since a distribution file can have multiple attestations, and PyPI serves
13+
these attestations as a single JSON file, this JSON file groups the
14+
attestations into a single [provenance object]. This object contains
15+
bundles of attestations grouped by the Trusted Publisher identity used
16+
to sign them.
17+
18+
To manually verify a PyPI artifact against its provenance object,
19+
the [`pypi-attestations`][pypi-attestations] CLI tool can be used:
20+
21+
```bash
22+
export WHEEL_DIRECT_URL=https://files.pythonhosted.org/packages/d7/73/c16e5f3f0d37c60947e70865c255a58dc408780a6474de0523afd0ec553a/sampleproject-4.0.0-py3-none-any.whl
23+
24+
pypi-attestations verify pypi --repository https://github.com/pypa/sampleproject $WHEEL_DIRECT_URL
25+
```
26+
27+
This downloads the wheel from PyPI and its corresponding provenance JSON
28+
(using the Integrity API), checks that the Trusted Publishers specified
29+
in the provenance match the `--repository` argument passed by the user,
30+
and finally cryptographically verifies the wheel against the included
31+
attestations.
32+
33+
1034
[Integrity API documentation]: /api/integrity/
35+
[provenance object]: https://packaging.python.org/en/latest/specifications/index-hosted-attestations/#provenance-objects
36+
[pypi-attestations]: https://pypi.org/project/pypi-attestations/
37+

0 commit comments

Comments
 (0)