pull_request_target is a GitHub Actions trigger that runs a workflow in the context of the target repository, not the contributor’s fork. That means the job can access repository secrets, write permissions, and other trusted resources even when the pull request comes from an untrusted source.
This matters because attackers can submit malicious changes that try to abuse workflow steps, script execution, or exposed secrets. A common defensive rule is to avoid checking out or executing untrusted pull-request code in a pull_request_target workflow unless the steps are tightly sandboxed. Safer patterns include using pull_request for testing contributor code, limiting permissions, separating approval from execution, and never handing secrets to jobs that process attacker-controlled input.



