Fork Operation Safety 🔒 #69
Merged
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.
Fork Operation Safety 🔒
This avenue will no longer exist after this PR merges. Forks will be treated with highest level of restrictions when being operated on by this Action. In the past IssueOps operations did not require a review at all, but now they do (for forks).
These changes will not effect normal PRs that don't originate from forks or GitHub issues.
The reasoning behind these changes are to help prevent Actions based TOCTOU vulnerabilities. These vulns exist when a bad actor pushes a commit shortly after a legitimate actor runs an IssueOps command (like
.lint
). When the IssueOps command goes to operate on theref
of that PR, it checks out the malicious code. For this reason, workflows should only ever use the exactsha
during anactions/checkout
operation (via IssueOps) and the workflow that runs, should only ever run if the fork PR has been reviewed.TL;DR
TL;DR: If you are using this Action on pull requests that originate from forks where the rest of your workflow checks out code, ensure that you are requiring PR reviews on your repository via branch protection settings (or rulesets). Also ensure that your workflow checks out code via the exact
sha
output (from this Action) instead of theref
- documentation.fork_review_bypass
If your workflow does not checkout code in anyway and it is just doing something like adding labels to a PR, then you don't need reviews on a fork to proceed with the workflow. If this is the case, you can disable these extra safety measures with the
fork_review_bypass: "true"
input option enabled.Example
If you have a workflow that you have deemed to be safe, and you want to run it on forks without requiring reviews, you can do so like this:
related: github/branch-deploy#331