DevSecOps··5 min read·By Veer Bhanushali
How pull_request_target workflows leak CI secrets and NPM publish tokens
Checking out an untrusted fork commit inside a privileged workflow lets external PRs run build scripts with repository write permissions.
Key takeaway
Never checkout github.event.pull_request.head inside privileged workflows, pin Actions to 40-char commit SHAs, and pass event inputs via env vars.
Split untrusted PR builds from privileged labeling workflows
Keep untrusted test runs on standard pull_request with read-only permissions, passing build outputs as static artifacts cleanly instead of executing fork package scripts inside pull_request_target.