Skip to main content
InterviewHubPRO
Section Overview
Q25

Question 25 of 50

Part 3: Enterprise Scale, Compliance & Production Hardening (Senior / Staff)

50%
CI/CD & GitHub Actions (50 Qs)•Part 3: Enterprise Scale, Compliance & Production Hardening (Senior / Staff)

Why is the `pull_request_target` trigger a critical security risk?

senior LevelSecurity & Auth

In Simple Words: The pull_request_target event runs in the context of the base repository (not the fork), granting it access to write tokens and repository secrets. If a workflow with pull_request_target checks out the code from the untrusted fork (ref: ${{ github.event.pull_request.head.sha }}) and runs build scripts (npm run build), a malicious external contributor can submit a PR with modified npm scripts that steal your production secrets and exfiltrate them!

Golden Rule:

Never check out and execute untrusted pull request code inside a workflow triggered by pull_request_target.