Three Ways to Safely Run CI Workflows on Forked Pull Requests in GitHub Actions
GitHub repository maintainers face a security challenge when running secret-dependent workflows on pull requests submitted by external, untrusted contributors. By default, GitHub restricts forked PRs triggered via the pull_request event to a read-only GITHUB_TOKEN with no access to repository secrets, preventing exposure of sensitive data. GitHub introduced the pull_request_target event in 2021 to elevate token permissions, but using it to execute untrusted forked code directly is considered dangerous without additional safeguards. Security experts, including a GitHub researcher, warn that any automated processing of external fork PRs should be treated as untrusted input due to risks like code injection and race condition exploits. The article outlines three solutions of varying security levels for maintainers needing to run tests or other secret-dependent workflows against community-contributed code changes.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in