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:
The
actions/setup-java@v5.6.0step uses a mutable version tag that can be silently redirected to malicious code if the action's maintainer account is compromised.More details about this
The GitHub Actions step
uses: actions/setup-java@v5.6.0uses a semantic version tag (v5.6.0) instead of pinning to a specific commit SHA. This means thev5.6.0tag can be silently repointed by the action's maintainers to a new commit at any time without your workflow noticing.Attack scenario: An attacker compromises the GitHub account of the
actions/setup-javamaintainer and pushes malicious code to a new commit, then force-pushes thev5.6.0tag to point to this malicious commit. The next time your workflow runs, it automatically pulls and executes the compromised version. The attacker could then:This happened in real supply-chain attacks like the
trivy-actionandkics-github-actioncompromises, where maintainers' accounts were hijacked and tags were repointed to malicious versions.To resolve this comment:
✨ Commit fix suggestion
View step-by-step instructions
actions/setup-java@v5.6.0with a full 40-character commit SHA for the same release, for exampleactions/setup-java@<full-commit-sha>.with:block unchanged so the action still usesdistribution: 'zulu'andjava-version: '21'.actions/setup-javarelease page forv5.6.0and pin it directly in the workflow file. Pinning to a commit SHA prevents the tag from being moved 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.