Repository navigation
Conversation
Pin all GitHub Actions to full commit SHAs with version comments to protect against tag-rewrite attacks, add least-privilege permissions blocks to all workflows, disable credential persistence on checkouts that do not push, add a Dependabot config to keep Actions and Python dependencies up to date, and add the OpenSSF Scorecard workflow. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace the long-lived PYPI_PASSWORD API token with short-lived OIDC tokens via PyPI Trusted Publishing. Bind the publish job to a 'pypi' environment and grant it the id-token write permission. This also enables automatic PEP 740 attestations for published distributions. Requires a trusted publisher to be configured for the Markdown project on PyPI before the next release. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Member
|
There is an open issue for this at #1560. I have not made this change because the existing implementation works (if it an't broke, don't fix it). Therefore, this will likely continue to sit here until such time as GitHub changes something which forces this change to be made. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Migrates PyPI publishing from a long-lived API token (
secrets.PYPI_PASSWORD) to PyPI Trusted Publishing (OIDC):Publish to PyPIstep no longer passesuser/password;pypa/gh-action-pypi-publishauthenticates with a short-lived OIDC token minted per workflow run.pypijob is grantedid-token: writeand bound to apypideployment environment (with the project URL), so environment protection rules (required reviewers, tag restrictions) can be applied.gh-action-pypi-publishautomatically generates and uploads PEP 740 attestations when using Trusted Publishing.This eliminates the risk of the long-lived PyPI token being exfiltrated from repository secrets.
Markdownproject → Publishing, add a GitHub trusted publisher: ownerPython-Markdown, repositorymarkdown, workflowdeploy.yml, environmentpypi.pypienvironment under repository Settings → Environments (optionally restrict it to tags / require reviewers).PYPI_PASSWORDsecret and revoke the token on PyPI.Note: this PR is stacked on top of the general supply-chain hardening PR (action SHA pinning + least-privilege permissions); its own change is the last commit only.
Validation: the workflow file was checked with a YAML parser (
yaml.safe_load) — parses successfully. The publish path can only be fully exercised on the next tagged release after the PyPI trusted publisher is configured.AI Assistance Disclosure
No AI tools were used in preparing this PR.
AI tools were used and I have disclosed which ones, and have fully reviewed and verified their output.
AI tools were use to assist with the following:
Checklist