Review Untrusted Fork Contributions Safely
A contribution is input, not authority
A patch can contain code, configuration, workflow definitions, dependency changes or instructions. Treat all of these as untrusted until reviewed, even when the author seems familiar. Inspect changes as data before running tests, and check for unexpected files. A successful build or an approval does not prove that executing the patch is safe. Do not expose private keys, credentials, production data or privileged runners to untrusted code.
Separate workflow trust boundaries
GitHub Actions normally restricts tokens and withholds repository secrets for fork-originated pull_request workflows; repository settings and other event types can change the effective privileges. pull_request_target runs in the base context and may have elevated access. Do not check out or execute untrusted PR code in a privileged workflow, or trust its artifacts as executable inputs. Keep untrusted checks in isolated environments with minimal permissions, no sensitive data and no persistent privileged runner. Review workflow changes and approval policies explicitly.
Practice inspection without execution
The lab creates an inert text-only mock proposal that adds workflow-review.txt, alongside the intended note change. Compare file names and read the text without executing it. A mock note asking for elevated access is a signal to stop and review, not a command to follow. Escalate to the maintainer if an unexpected workflow or permission change appears. The lab does not run Actions, execute a contribution script, simulate token theft or prove a security boundary.
Practice example
git diff --name-status upstream/main...mock/untrustedgit show mock/untrusted:workflow-review.txtIn the prepared fixture, notes.txt and workflow-review.txt appear. Inspect the inert note as data; do not execute instructions contained in a contribution.
Check your understanding
A fork PR asks for elevated workflow permissions unrelated to its documentation fix. Explain why you would stop, inspect and choose isolated checks.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Review Untrusted Fork Contributions Safely — knowledge check
Reason about fork collaboration and contribution trust boundaries.
How should an unexpected contributed workflow be handled first?
What is the main risk of privileged execution of untrusted PR code?
Which environment is more appropriate for untrusted checks?
Does a passing check prove a contribution is secure?
What does the offline mock text exercise establish?