Repository navigation
Security: pin third-party release actions to commit SHAs - #7
Open
pimfeltkamp wants to merge 1 commit into
Open
pimfeltkamp wants to merge 1 commit into
pimfeltkamp wants to merge 1 commit into
Conversation
pypa/gh-action-pypi-publish and softprops/action-gh-release ran on mutable refs (release/v1, v3) inside the job holding id-token: write for PyPI trusted publishing. Pin both to the commit SHAs those refs currently resolve to (v1.14.3, v3.0.3) so a hijacked upstream tag or branch cannot run in the publishing job. Dependabot keeps the pins updated via the version comments. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
pimfeltkamp
commented
Nov 1, 2026
pimfeltkamp
left a comment
Contributor
Author
There was a problem hiding this comment.
✅ Automated review passed — no issues found. (Would approve, but the reviewer account authored this PR and GitHub forbids self-approval.)
✅ Safe to merge
This branch has not been deployed
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.
What was vulnerable
.github/workflows/release.ymlgrantsid-token: write(PyPI trusted publishing) andcontents: writeto thepublishjob, and that job ran two third-party actions on mutable refs:pypa/gh-action-pypi-publish@release/v1andsoftprops/action-gh-release@v3. If either upstream branch/tag were hijacked, the attacker's code would run inside the job that can mint the trusted-publisher OIDC token for thecryptohopperPyPI project and modify GitHub releases.What the fix does
Pins both actions to full commit SHAs with a version comment:
pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3.0.3Verified with
gh api repos/<owner>/<repo>/commits/<ref>thatrelease/v1andv1.14.3both resolve to7245906…, andv3andv3.0.3both resolve toefb3536…. The pinned code is therefore exactly what the workflow runs today. The existing Dependabotgithub-actionsentry keeps SHA-pinned actions updated using the# vX.Y.Zcomment.The fix touches a CI workflow because the vulnerable code is the workflow itself. First-party
actions/checkout@v6andactions/setup-python@v6were left on tags, as the finding only covered third-party actions.Breaking?
No. Same action commits as before. For
pypa/gh-action-pypi-publishthe reviewer confirmed the action resolves its container image from the action ref, and the image tagged with this SHA shares the same digest as therelease-v1image, so publishing behaviour is unchanged.Tests
python -Istdlib regex check overrelease.yml: every non-actions/*uses:ref is a 40-hex SHA. Result:unpinned third-party: [].ModuleNotFoundError: No module named 'yaml'(not installed);yamllintandruby -ryamlrequired an approval nobody could grant in the unattended run. The change only replaces two scalar values withsha # comment, which the independent reviewer confirmed is valid YAML.Reviewer notes (not fixed here, outside this finding)
contents: write, publishing alone withid-token: write, tests with no write permissions) was not done to keep the diff minimal. Recommended follow-up.build,.[dev], andhatchlingfetched bypython -m build) run in the same privileged job. A compromised PyPI package could reach the OIDC token. Recommended follow-up: hashed requirements and/or moving tests out of the privileged job.actions/checkoutdefaults topersist-credentials: true, leaving the write-capable token in.git/configfor later steps. Considerpersist-credentials: false.pypa/gh-action-pypi-publishpulls its container image by an overwritable registry tag rather than a digest. Upstream design, same trust boundary as the action code; cannot be fixed in this repo.🤖 Automated security fix by claude-code-security. It is reviewed by the automated PR reviewer and auto-merged only if the review passes, CI is green, and the change is small and non-breaking.
🤖 Generated with Claude Code