Skip to content

Commit cce911e

Browse files
authored
Merge pull request #1 from trail-of-forks/attestations-fixes
Attestations fixes
2 parents 85dbf7c + e79f6e3 commit cce911e

File tree

5 files changed

+27
-10
lines changed

5 files changed

+27
-10
lines changed

Dockerfile

-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ ENV PIP_ROOT_USER_ACTION ignore
1313
ENV PATH "/root/.local/bin:${PATH}"
1414
ENV PYTHONPATH "/root/.local/lib/python3.12/site-packages"
1515

16-
# NOTE: Temporary; to be removed once a new twine is released.
17-
RUN apt-get update && apt-get install -y git
18-
1916
COPY requirements requirements
2017
RUN \
2118
PIP_CONSTRAINT=requirements/runtime-prerequisites.txt \

README.md

+21
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,25 @@ for example. See [Creating & using secrets]. While still secure,
246246
[trusted publishing] is now encouraged over API tokens as a best practice
247247
on supported platforms (like GitHub).
248248

249+
### Generating and uploading attestations (EXPERIMENTAL)
250+
251+
> [!NOTE]
252+
> Support for generating and uploading [PEP 740 attestations] is currently
253+
> experimental and limited only to Trusted Publishing flows using PyPI or TestPyPI.
254+
255+
You can generate signed [PEP 740 attestations] for all the distribution files and
256+
upload them all together by enabling the `attestations` setting:
257+
258+
```yml
259+
with:
260+
attestations: true
261+
```
262+
263+
This will use `sigstore` to create attestation objects for each distribution package,
264+
signing them with the identity provided by the GitHub's OIDC token associated with the
265+
current workflow. This means both the trusted publishing authentication and the
266+
attestations are tied to the same identity.
267+
249268
## License
250269

251270
The Dockerfile and associated scripts and documentation in this project
@@ -287,3 +306,5 @@ https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md
287306
[configured on PyPI]: https://docs.pypi.org/trusted-publishers/adding-a-publisher/
288307

289308
[how to specify username and password]: #specifying-a-different-username
309+
310+
[PEP 740 attestations]: https://peps.python.org/pep-0740/

requirements/runtime.in

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
# NOTE: Temporarily pulling directly from GitHub for the attestations feature,
2-
# which is not yet released.
3-
# See: https://github.com/pypa/twine/issues/1094
4-
twine @ git+https://github.com/pypa/twine@5d17a43dec622d6f4fc490937baad3db4b9a8e29
1+
twine
52

63
# NOTE: Used to detect an ambient OIDC credential for OIDC publishing,
74
# as well as PEP 740 attestations.
@@ -13,5 +10,5 @@ id ~= 1.0
1310
requests
1411

1512
# NOTE: Used to generate attestations.
16-
pypi-attestation-models == 0.0.1rc2
13+
pypi-attestation-models == 0.0.1
1714
sigstore ~= 3.0.0rc2

requirements/runtime.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ pyjwt==2.8.0
8181
# via sigstore
8282
pyopenssl==24.1.0
8383
# via sigstore
84-
pypi-attestation-models==0.0.1rc2
84+
pypi-attestation-models==0.0.1
8585
# via -r runtime.in
8686
python-dateutil==2.9.0.post0
8787
# via betterproto
@@ -119,7 +119,7 @@ six==1.16.0
119119
# via python-dateutil
120120
tuf==4.0.0
121121
# via sigstore
122-
twine @ git+https://github.com/pypa/twine@5d17a43dec622d6f4fc490937baad3db4b9a8e29
122+
twine==5.1.0
123123
# via -r runtime.in
124124
typing-extensions==4.10.0
125125
# via

twine-upload.sh

+2
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,15 @@ if [[ "${INPUT_ATTESTATIONS}" != "false" ]] ; then
6969
# user confusion, since attestations (currently) require Trusted Publishing.
7070
if [[ -n "${INPUT_PASSWORD}" ]] ; then
7171
echo "${ATTESTATIONS_WITHOUT_TP_WARNING}"
72+
INPUT_ATTESTATIONS="false"
7273
fi
7374

7475
# Setting `attestations: true` with an index other than PyPI or TestPyPI
7576
# indicates user confusion, since attestations are not supported on other
7677
# indices presently.
7778
if [[ ! "${INPUT_REPOSITORY_URL}" =~ pypi\.org ]] ; then
7879
echo "${ATTESTATIONS_WRONG_INDEX_WARNING}"
80+
INPUT_ATTESTATIONS="false"
7981
fi
8082
fi
8183

0 commit comments

Comments
 (0)