Skip to content

Commit cf02163

Browse files
lwasserhugovk
andcommitted
fix: edits from @hugovk
Co-authored-by: Hugo van Kemenade <[email protected]>
1 parent a133b11 commit cf02163

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

_posts/2024-12-13-python-packaging-security.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,10 @@ To lock down a GitHub environment:
115115
Now that you have a GitHub environment setup, you can set up Trusted Publisher in your PyPI account.
116116
117117
A Trusted Publisher setup creates a short-lived secure link between PyPI and your repository.
118-
- PyPI is allowed to authenticate your [package distribution files (sDist and Wheel archives)](https://www.pyopensci.org/python-package-guide/package-structure-code/python-package-distribution-files-sdist-wheel.html#how-to-create-the-distribution-format-that-pypi-and-pip-expects) uploads directly, so no additional configuration is required.
119-
- Trusted Publisher restricts publishing to a specific GitHub action workflows and environments defined in your repository.
118+
- PyPI is allowed to authenticate your [package distribution files (sdist and wheel archives)](https://www.pyopensci.org/python-package-guide/package-structure-code/python-package-distribution-files-sdist-wheel.html#how-to-create-the-distribution-format-that-pypi-and-pip-expects) uploads directly, so no additional configuration is required.
119+
- Trusted Publisher restricts publishing to a specific GitHub Actions workflows and environments defined in your repository.
120120
121-
Using a Trusted publisher combined with a locked-down environment eliminates the need to store sensitive tokens as GitHub secrets. It also removes the need to refresh and update tokens periodically to avoid token leaks or theft issues.
121+
Using a Trusted Publisher combined with a locked-down environment eliminates the need to store sensitive tokens as GitHub secrets. It also removes the need to refresh and update tokens periodically to avoid token leaks or theft issues.
122122
123123
<figure>
124124
<img src="/images/python-packaging/trusted-publisher-pypi-github.png" alt="A workflow diagram showing GitHub Actions building distribution files (sdist and wheel), publishing them securely to PyPI, represented as a warehouse. The diagram includes a lock icon emphasizing security, with the pyOpenSci logo in the top-left corner.">
@@ -140,8 +140,8 @@ The steps for setting up Trusted Publisher are:
140140
2. Click on your profile to take you to **Your projects**.
141141
3. Click on **publishing** on the left-hand side of the site. (it's below account settings).
142142
4. At the top of the page is a Manage Publishers section. At the bottom, you will see **Add a new pending publisher**
143-
7. Fill out a form that looks like the one below in the add a new pending publisher section. Notice that you can select GitHub, GitLab, Google and Active State as platforms.
144-
10. Notice that the form asks for your project name, owner, repo name, workflow's file name, and environment (**STRONGLY recommended**).
143+
5. Fill out a form that looks like the one below in the add a new pending publisher section. Notice that you can select GitHub, GitLab, Google and ActiveState as platforms.
144+
6. Notice that the form asks for your project name, owner, repo name, workflow's file name, and environment (**STRONGLY recommended**).
145145
146146
147147
<figure>
@@ -154,7 +154,7 @@ The steps for setting up Trusted Publisher are:
154154
</figcaption>
155155
</figure>
156156
157-
For an example of a GitHub workflow that uses trusted publishing, check out our active pyOpenSci [PyPI publishing GitHub workflow](https://github.com/pyOpenSci/pyosMeta/blob/main/.github/workflows/publish-pypi.yml), which follows the Trusted Publisher approach.
157+
For an example of a GitHub workflow that uses Trusted Publishing, check out our active pyOpenSci [PyPI publishing GitHub workflow](https://github.com/pyOpenSci/pyosMeta/blob/main/.github/workflows/publish-pypi.yml), which follows the Trusted Publisher approach.
158158
159159
160160
<figure>
@@ -179,9 +179,9 @@ Zizmor is a static analysis tool designed to help identify GitHub Action securit
179179

180180
**TODO: link to packaging guide page on CI when it's published friday**
181181

182-
Named as a playful nod to Dr. Zizmor’s famous “clear skin” ads, Zizmor aims to give you “beautiful clean workflows.”
182+
Named as a playful nod to Dr. Zizmor’s famous “clear skin” ads, zizmor aims to give you “beautiful clean workflows.”
183183

184-
Learn more about Zizmor on the [official blog post by Yossarian](https://blog.yossarian.net/2024/10/27/Now-you-can-have-beautiful-clean-workflows).
184+
Learn more about zizmor on the [official blog post by William Woodruff](https://blog.yossarian.net/2024/10/27/Now-you-can-have-beautiful-clean-workflows).
185185
{: .notice .notice--success }
186186

187187
### How it works
@@ -196,13 +196,12 @@ Below, I ran it on our pyosMeta PyPI build. Among other things, it found a templ
196196

197197
PyPI really is on top of things!
198198

199-
```bash
199+
```console
200200
$ zizmor .github/workflows/publish-pypi.yml
201201
202202
error[template-injection]: code injection via template expansion
203203
--> path/here/pyosMeta/.github/workflows/publish-pypi.yml:97:7
204204
github.ref_name may expand into attacker-controllable code
205-
```
206205
207206
You can also set up `zizmor` as a pre-commit hook. pyOpenSci plans to do this in the near future, but here is an example of it [setup for core Python](https://github.com/python/cpython/pull/127749/files#diff-63a9c44a44acf85fea213a857769990937107cf072831e1a26808cfde9d096b9R64).
208207

0 commit comments

Comments
 (0)