chore: harden supply chain — pin SHAs, split publish workflow#185
Merged
Conversation
- Pin all pre-commit hook revs to commit SHAs (prevents tag rewriting attacks) - Pin all GitHub Actions in publish.yaml to commit SHAs - Split publish.yaml into separate build and publish jobs so that id-token:write and the environment gate only apply to the publish step - Add attestation step for build provenance - Remove unused twine dependency (gh-action-pypi-publish handles upload) - Add persist-credentials: false to checkout Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
wesselb
approved these changes
Jun 12, 2026
Collaborator
There was a problem hiding this comment.
LGTM in principle!
- I didn't check the commit hashes everywhere, so trusting @temporaer on this one.
- It would be good to verify that
publish.yamlstill works, but that's tricky to test. Perhaps fine to fix any issues if any happen to arise when we publish a new version.
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.
Summary
Hardens the repository against supply-chain attacks:
Pre-commit config
Publish workflow (.github/workflows/publish.yaml)
id-token: writeand thepublish-to-pypienvironment gateactions/attest-build-provenancepersist-credentials: falseto checkouttwinedependency (pypi-publish action handles upload natively)Why split build from publish?
The previous single-job workflow granted
id-token: writeto the entire job including the checkout and build steps. By splitting, a compromised build step cannot mint OIDC tokens or publish to PyPI — only the isolated publish job (gated by the environment) has that permission.Related: msr-ai4science/feynman#21953