What is a "pwn request"? Show the vulnerable pattern.
AdvancedConceptTriggers & Events
Answer
A pull_request_target (or workflow_run) workflow that runs attacker-controlled code with privileged context.
on: pull_request_target
jobs:
test:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }} # attacker's code
- run: npm ci && npm test # package.json scripts run with secrets in env and a write token
The attacker edits package.json postinstall to exfiltrate secrets.NPM_TOKEN or push to main. Fix: use pull_request for building and testing, and keep pull_request_target jobs to metadata operations with no checkout of head code. If you must, gate it behind a maintainer-applied label and an environment with required reviewers.
More on Triggers & Events
How do you trigger a workflow on pushes to `main` and on PRs that target `main`?BeginnerWhat activity types does `pull_request` trigger on by default, and how do you add more?IntermediateHow do `branches` and `branches-ignore` filters work with globs?BeginnerHow do path filters work, and what are their limits?AdvancedHow do you trigger only on version tags, and what is the gotcha with pushing many tags?IntermediateWhat is `workflow_dispatch`, and what input types does it support?Beginner