Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

security: migrate PyPI publish to Trusted Publishing (OIDC)

Aperta
#417 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
72/100
Tipo di issue
Refactoring
Chiarezza
Specificata chiaramente
Stato di attività
Tranquilla
Stack tecnologico
github-actions, python

Direzione di ricerca

Start with .github/workflows/publish-pypi.yml and the Trusted Publishing guidance from PyPI and pypa/gh-action-pypi-publish. Check the workflow's permissions, publish environment, and existing PyPI and Test PyPI secrets. Done means publishing uses OIDC with reviewer approval and the long-lived token secrets can be removed after verification.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Summary

publish-pypi.yml currently authenticates to PyPI using a long-lived PYPI_API_TOKEN repo secret. This is a security risk: if the secret is ever leaked or the repo is compromised, the token can be used to publish arbitrary versions to PyPI indefinitely.

Recommended fix

Migrate to PyPI Trusted Publishing (OIDC), which is supported natively by pypa/gh-action-pypi-publish. With trusted publishing:

  • No long-lived token is stored anywhere
  • PyPI issues a short-lived token scoped to a specific GitHub repo + workflow + environment for each publish run
  • Even if the workflow is triggered unexpectedly, the token expires immediately after use

Steps

  1. On PyPI, add a Trusted Publisher for tabcmd:

    • Owner: tableau
    • Repository: tabcmd
    • Workflow: publish-pypi.yml
    • Environment: pypi-production (create this environment on the repo with required reviewers)
  2. Update publish-pypi.yml:

    • Add permissions: id-token: write to the job
    • Remove password: ${{ secrets.PYPI_API_TOKEN }} from the publish step
    • The action authenticates automatically via OIDC
  3. Add a pypi-production GitHub environment with required reviewer approval as an extra gate.

  4. Delete the PYPI_API_TOKEN repo secret once verified.

Same change can be applied to TEST_PYPI_API_TOKEN / Test PyPI.

References

Lingua principale
Python
Stelle
52
Fork
17
Merge medio
5g 20h
PR unite (30g)
2

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di tableau/tabcmd

Tutte le issue di tableau/tabcmd

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.