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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Semgrep identified an issue in your code:
pypa/[email protected]is a mutable tag, so a moved tag could make this release job run attacker-controlled code with PyPI publish access.More details about this
Publish packagerunspypa/[email protected], which is a tag, not a full 40-character commit SHA. If thev1.14.2tag is ever moved to different code, this release workflow would automatically run that new code with this job’sid-token: writepermission when a GitHub release is published.A plausible attack looks like this:
pypa/gh-action-pypi-publishrepository or the maintainer account that controls thev1.14.2tag.v1.14.2to a malicious commit that still looks like the real publish action.deployjob reachesuses: pypa/[email protected]and pulls the attacker’s code instead of the code you previously reviewed.Build packageand can read the built distribution files, the repository checkout fromactions/checkout, and the job’s OIDC token access frompermissions: id-token: write.olist-loaferrelease that downstream users would install.Because the reference is mutable, the code executed during release can change without any change in this repository.
To resolve this comment:
✨ Commit fix suggestion
View step-by-step instructions
Replace the mutable action tag with a full 40-character commit SHA in the
usesline for the publish step.Change
uses: pypa/[email protected]touses: pypa/gh-action-pypi-publish@<full-40-character-commit-sha>.Get the SHA from the
pypa/gh-action-pypi-publishrepository release or tag that you intend to trust, and make sure it is the exact commit behindv1.14.2.The final value should look like
uses: pypa/gh-action-pypi-publish@8ade135a41bc03ea155e62e844d188df1ea18608.Keep the version in a comment next to the SHA if you want the workflow to stay readable.
For example, use
uses: pypa/gh-action-pypi-publish@<full-40-character-commit-sha> # v1.14.2. Pinning to a commit prevents the action owner from silently moving the tag to different code later.💬 Ignore this finding
Reply with Semgrep commands to ignore this finding.
/fp <comment>for false positive/ar <comment>for acceptable risk/other <comment>for all other reasonsAlternatively, triage in Semgrep AppSec Platform to ignore the finding created by github-actions-mutable-action-tag.
You can view more details about this finding in the Semgrep AppSec Platform.