PyPI Token Exfiltration Campaign via GitHub Actions Workflows

4 points by ubernostrum


ubernostrum

This occurred because people were storing long-lived PyPI access tokens in GitHub for use in publishing workflows, and accidentally leaked or exposed those tokens.

As a reminder, the preferred approach is the Trusted Publishing flow, whose entire point is to let you trust a third-party CI/CD provider with publishing permissions, because it’s built around issuing an on-demand, short-lived, narrow-scoped access token. That way, even if you do manage to accidentally leak it, it expires so quickly an attacker is limited in how much damage they can do (if they can even react quickly enough to do anything at all).