Disable default save action for pull_request_target#1757
Open
jessehouwing wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the actions/cache action metadata so the default post-step cache save does not execute when the workflow is triggered by pull_request_target, reducing unnecessary runs and improving security-by-default for that event type.
Changes:
- Adds a
post-ifcondition to skip the post save step forpull_request_targetevents while keeping the existingsuccess()gating.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Author
|
It might be even better to solve this in the |
|
yes |
janellecanon01-lab
approved these changes
May 15, 2026
janellecanon01-lab
approved these changes
May 15, 2026
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.
Disables the default save action on actions/cache when the event is a pull_request_target to prevent unnecessary executions. This change optimizes the workflow by ensuring that the save action only occurs for relevant events.
This plug a cache poisoning attack vector used in a number of supply chain attacks.
For users who REALLY want to save the cache on a PRT workflow, they can still use actions/cache/save dircetly. The secure by default principle should apply to the standard actions/cache action.
Technically this is a breaking change. A major version bump might be advised. But I'd personally backport this to all previous versions of actions/cache instead.
Fixes #1756