Interview Prep/GitHub Actions/Security Hardening & Supply Chain

You find `pull_request_target` used to build and test PRs in a private repo. Is that acceptable?

AdvancedScenarioSecurity Hardening & Supply Chain
Answer

Situation read → Private repos limit forks to people with read access, but insiders, compromised accounts and accidental malicious dependencies still exist.

What I'd do →

  1. Switch to pull_request; in private repos, same-repo PRs already get secrets with pull_request.
  2. If forks are used internally, enable "Send secrets to workflows from fork pull requests" only if truly needed, and with approval required.
  3. Remove the head checkout from any remaining pull_request_target workflow.

Why → pull_request_target gives no benefit here and keeps a dangerous pattern alive.

Interview tip → The trigger is for metadata on public fork PRs, not for building code.

All GitHub Actions questions Roadmap: GitHub Actions

More on Security Hardening & Supply Chain