OIDC Trusted Publishing on PyPI: Passwordless Security & Cryptographic Provenance
Trusted Publishing replaces static API tokens (PYPI_API_TOKEN) with ephemeral OpenID Connect (OIDC) identities issued directly by GitHub Actions, GitLab CI, or Google Cloud. This prevents supply chain attacks from leaked credentials and generates verifiable cryptographic attestations on PyPI.
Trusted Publishing Adoption in PyPkgScore Catalog
No More Leaked Tokens
You no longer need to store long-lived tokens in repository Secrets. Authentication lasts only a few seconds during the release job.
Sigstore Attestation on PyPI
PyPI cryptographically binds each .whl and .tar.gz file to the exact commit and GitHub workflow that built it.
Verified Badge on PyPI & +60 pts
Enterprise teams require provenance before approving dependencies. On PyPkgScore, OIDC attestation awards full points on the supply chain check.
How to enable in 3 steps (under 3 minutes)
.github/workflows/publish.yml
name: Publish Package to PyPI (OIDC Trusted Publishing)
on:
release:
types: [published]
permissions:
contents: read
jobs:
pypi-publish:
name: Upload release to PyPI via OIDC
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Build wheel and sdist
run: |
python -m pip install --upgrade build
python -m build
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1