Switch to Trusted Publishing for package upload to PyPI in CI
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 68/100
Direzione di ricerca
Inizia da .github/workflows/release.yml e ispeziona il job publish, in particolare il suo passaggio Upload to PyPI. Configura l’ambiente GitHub e la registrazione PyPI corrispondente, quindi aggiorna i permessi del job e rimuovi l’argomento della password. Il lavoro è completato quando le release usano Trusted Publishing con attestazioni invece di un token PyPI.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Trusted publishing (with attestations) is currently suggested as good practice to ensure confidence that what users download from PyPI is the same artifact that was generated in GitHub CI, meaning that what I see in GitHub is the same as what is installed - handy for auditing. It also avoids the presence of PyPI tokens as 'secrets' in the CI, which can be exfiltrated by bad actors.
Following the recent litellm supply chain attack this week, I would like to express my support for this*. The uvloop package is one of 16 packages in the top 500 PyPI packages (by downloads) which use the pypa/gh-action-pypi-publish action but have not yet upgraded it to use Trusted Publishing: this is 'low hanging fruit' in terms of making Python a more secure programming environment.
Instead of using the stored secret token, GitHub vouches for the upload, and PyPI checks the uploading CI workflow filename against a pre-declared filename you set ahead of time (in uvloop's case the filename is release.yml). It also requires creating an 'environment' for the repo on GitHub (suggested name "pypi") which you also register the package with on PyPI.
* Post-mortems of the litellm attack:
- https://futuresearch.ai/blog/litellm-pypi-supply-chain-attack/
- https://snyk.io/articles/poisoned-security-scanner-backdooring-litellm/
Implementation (click to expand)
-
Configure (or use an existing) GitHub environment, and register with PyPI
-
Add the environment definition to the same
publishjob -
Add
id-token: write,contents: writeandpackages: writepermissions to the samepublishjob- specifying any permission restricts the token, and creating a GitHub release requires
contents: writeand potentiallypackages: write
- specifying any permission restricts the token, and creating a GitHub release requires
-
Remove
passwordargument in theUpload to PyPIstep of thepublishjob of the Build & Publish CI workflow -
Optionally remove the
PYPI_TOKENproject secret
- Lingua principale
- Cython
- Stelle
- 11.9k
- Fork
- 615
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di MagicStack/uvloop
-
License not clear Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
MagicStack/uvloop#759 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
MagicStack/uvloop#702 · 8 commenti · 9 reazioni ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
MagicStack/uvloop#763 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
MagicStack/uvloop#760 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
MagicStack/uvloop#754 · 1 commento · 1 reazione ·
Tutte le issue di MagicStack/uvloop
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
ethereum-optimism/factory#64 ·
-
Observer env strips CLAUDE_CODE_TMPDIR, which is the documented fix for a fatal temp-dir error Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
thedotmack/claude-mem#4161 ·
-
intake mcp-intake needs-ac needs-human-review priority:medium type:bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
Ikalus1988/MisakaNet#2019 · 2 commenti ·
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
-
bug github_actions
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100