
`pull_request_target` Without Regret: Secure Fork PRs in GitHub Actions
pull_request_target Without Regret: Secure Fork PRs in GitHub Actions If you maintain a public repo, you eventually hit this tradeoff: You want CI + automation on contributions from forks. You don’t want to leak secrets or run untrusted code with elevated permissions. A lot of teams switch to pull_request_target to get access to secrets and write permissions (for labels/comments), then accidentally check out and execute fork code in the same job. That’s one of the fastest ways to create a supply-chain incident in your own repo. In this post, I’ll show a safer pattern I use in real repos: Split untrusted validation from trusted automation . Avoid checking out attacker-controlled code in privileged contexts. Use explicit permissions and OIDC (where relevant). Add guardrails so regressions are caught automatically. Why pull_request_target is risky pull_request_target runs in the context of the base repository , not the fork. That means it can access repo secrets and can get elevated GITHU
Continue reading on Dev.to DevOps
Opens in a new tab
![[Learning notes and hw] getting started with R-cnn: Manually implementing Intersection over Union (IoU)](/_next/image?url=https%3A%2F%2Fmedia2.dev.to%2Fdynamic%2Fimage%2Fwidth%3D800%252Cheight%3D%252Cfit%3Dscale-down%252Cgravity%3Dauto%252Cformat%3Dauto%2Fhttps%253A%252F%252Fdev-to-uploads.s3.amazonaws.com%252Fuploads%252Farticles%252Favit2emoxc0g68e5ltqj.jpg&w=1200&q=75)



