pull_request_target
A pull request event that runs the base repository's workflow with its secrets and a write-capable token, even for pull requests from forks.
Running fork code under this event gives an anonymous contributor your secrets and repository write access.
In more detail
It exists for tasks such as labelling outside contributions. Checking out and building the pull request's head code under this event hands a stranger your secrets and write access, a privilege escalation known as a pwn request. Never check out and execute fork code under pull_request_target.
Related terms
- pull_request — The workflow event that fires when a pull request is opened or updated, running the contributor's code with no secrets and a read-only token.
- fork — A copy of someone else's repository made on a hosting service such as GitHub, under your own account, so you can push to it.
- privilege escalation — Gaining the rights of a more powerful account, such as root, either deliberately through a tool like sudo or illegitimately through a flaw.
- GITHUB_TOKEN — A short-lived access token GitHub creates for each job so the workflow can call the GitHub API for its own repository.
Taught in
- Triggers and the Event Model — Continuous Integration & Continuous Delivery Pipelines
- The Workflow That Ran On A Stranger's Pull Request — GitHub Actions (GH-200) Exam Prep
- Triggers In Depth: Filters, Schedules And Dispatch — GitHub Actions (GH-200) Exam Prep
- Outputs, Artifacts, Caches And Job Summaries — GitHub Actions (GH-200) Exam Prep
- Governing Actions: Allow Lists, SHA Pinning And Rulesets — GitHub Actions (GH-200) Exam Prep
- Script Injection: When An Issue Title Becomes Code — GitHub Actions (GH-200) Exam Prep
- Full Mock And Review: Where Your Points Go — GitHub Actions (GH-200) Exam Prep