Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Disable default save action for pull_request_target#1757

Open
jessehouwing wants to merge 2 commits into
actions:mainfrom
jessehouwing:main
Open

Disable default save action for pull_request_target#1757
jessehouwing wants to merge 2 commits into
actions:mainfrom
jessehouwing:main

Conversation

@jessehouwing
Copy link
Copy Markdown

@jessehouwing jessehouwing commented May 12, 2026

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

@jessehouwing jessehouwing requested a review from a team as a code owner May 12, 2026 06:57
Copilot AI review requested due to automatic review settings May 12, 2026 06:57
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-if condition to skip the post save step for pull_request_target events while keeping the existing success() gating.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread action.yml
@jessehouwing
Copy link
Copy Markdown
Author

It might be even better to solve this in the @actions/cache package itself and just turn off /save when the trigger is a PRT.

@janellecanon01-lab
Copy link
Copy Markdown

yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cache/save should not run automatically from a pull_request_trigger

3 participants