Interview Prep/GitHub Actions/Triggers & Events

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.

All GitHub Actions questions Roadmap: GitHub Actions

More on Triggers & Events