Skip to content

ci(release): restore OIDC auth, keep the idempotency guard (security fix)#569

Merged
MartinCastroAlvarez merged 1 commit into
mainfrom
ci/restore-oidc-keep-idempotency
May 28, 2026
Merged

ci(release): restore OIDC auth, keep the idempotency guard (security fix)#569
MartinCastroAlvarez merged 1 commit into
mainfrom
ci/restore-oidc-keep-idempotency

Conversation

@MartinCastroAlvarez
Copy link
Copy Markdown
Owner

What

Revert the auth method from PR #567 (stored token in repo secrets) back to OIDC Trusted Publishing, while keeping the idempotency guard that PR introduced.

Why

PR #567 changed the publish credential from OIDC to a stored `PYPI_API_TOKEN` repo secret. That's a security downgrade:

Vector OIDC Trusted Publishing Stored token
Long-lived secret anywhere? No Yes (encrypted at rest, but extant)
Attacker who compromises the repo can publish a malicious wheel? Only via an approved `release` event If they exfiltrate the secret, yes, indefinitely
Rotation cadence Not needed (per-run identity) Required (calendar-driven)

PyPI explicitly recommends Trusted Publishing for exactly this reason. Sticking with OIDC keeps zero long-lived secrets on disk or in GitHub Secrets.

What I kept from #567

The idempotency guard — the step that queries `pypi.org/pypi///json` before uploading. This is what actually fixes the red `pypi` Deployment widget for already-published versions:

End state

  • No GitHub Secret required. `secrets.PYPI_API_TOKEN` reference removed.
  • No long-lived token anywhere except the maintainer's local `./.env` (gitignored, never echoed, never tracked, verified clean in history).
  • Already-published versions (1.0.0, 1.0.1) → workflow skips upload → deployment goes green without OIDC even being attempted.
  • Fresh versions → workflow attempts OIDC; will still red-X until Publish v1.0.0 to PyPI — one-time owner OIDC setup blocks the release workflow #564's PyPI-side step is performed. When that one-time setup is done, fresh uploads go green too, with zero stored secrets.

Closes

Diff

`.github/workflows/release.yml` — pivot the auth back to OIDC; idempotency guard stays exactly as #567 wrote it.

🤖 Generated with Claude Code

PR #567 pivoted to stored-token auth (`secrets.PYPI_API_TOKEN`) to get
the `pypi` Deployments widget green. That was a security downgrade —
OIDC Trusted Publishing is strictly better (no long-lived token stored
anywhere; PyPI verifies a short-lived per-run identity at upload time).

This restores OIDC as the publish credential, while keeping the
idempotency guard introduced in #567 — which is the part that actually
turns the widget green for already-published versions (the guard hits
the public PyPI JSON endpoint and needs no auth at all).

End state:
- No GitHub Secret required.
- Already-published versions (1.0.0, 1.0.1) → workflow detects them and
  skips the upload → deployment goes green without ever attempting OIDC.
- Fresh versions → workflow attempts OIDC; will still red-X until the
  one-time PyPI Trusted Publisher is configured (#564). When that's done
  the workflow's fresh-upload path also goes green, with no token stored
  anywhere on the repo or on disk.

Closes #568 (the "add stored secret" follow-up is moot — there is no
stored secret to add).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants