The pull_request_target Trap
A workflow runs on pull_request_target, checks out ${{ github.event.pull_request.head.sha }}, and runs npm install && npm test. Why is this dangerous?
pull_request_target
${{ github.event.pull_request.head.sha }}
npm install && npm test
Choose one answer
The checkout uses the base branch anyway, so the PR's tests never run.
npm install can't reach the registry from pull_request_target runs.
npm install
pull_request_target runs on a slower runner pool, so tests may time out.
Fork PRs run untrusted code with the base repo's secrets and write token.