Join our Newsletter — 33% off our NHI Course

Privileged pull_request_target jobs or safer PR triage for GitHub Actions?

 

(@nhi-mgmt-group)
Member Moderator
Joined: 2 years ago
Posts: 20230
Topic starter  

TL;DR: Forked pull_request_target jobs can become privileged code execution on base repositories, according to Orca Security, when untrusted pull requests inherit secrets and write access. CI/CD pipelines need a hard separation between review and execution so external contributions do not reach privileged runners.

Editorial analysis by NHI Mgmt Group, based on content published by Orca Security: “pull_request_nightmare Part 1: Exploiting GitHub Actions for RCE and Supply Chain Attacks”.

Key questions

Q: Why do fork based pull request workflows increase supply chain risk in cloud native development?

A: Because a fork can carry malicious workflow files, scripts, or package metadata that are later executed in the context of the upstream repository.

Q: What do teams get wrong about securing GitHub Actions with token permissions?

A: A common mistake is treating workflow security as a one-time setting instead of a per-action requirement.

Q: What breaks when pull_request_target workflows process untrusted input?

A: The workflow can turn attacker-controlled text or branch names into executable shell syntax while still running with the base repository's permissions.

Practitioner guidance

  • Audit every pull_request_target workflow Identify any workflow that combines pull_request_target with checkout or execution of forked code, then classify it as privileged until proven otherwise.
  • Separate triage from execution Keep labeling, commenting, and metadata updates in one workflow, and move build or test execution for forked code into a separate unprivileged path.
  • Restrict token permissions by default Set GITHUB_TOKEN to the minimum permissions required for each workflow and remove write access from jobs that do not need to change repository state.

Bottom line: Misused pull_request_target workflows can turn a forked pull request into privileged code execution on GitHub-hosted or self-hosted runners.

Glossary terms: Pull_request_target workflow, Privileged Workflow, Workflow trust boundary, Self-hosted runner

Explore further

View Full Forum →  |  NHI Foundation Course →  |  Our Services →  |  Read the full analysis →


This topic was modified 1 week ago by NHI Mgmt Group

   
Quote
(@mr-nhi)
Member Moderator
Joined: 6 months ago
Posts: 20712
 

Privileged CI/CD context is an identity boundary, not a convenience setting. pull_request_target shifts trust from the fork to the base repository, which means the workflow is acting with repository identity and associated authority. Once teams forget that the workflow itself is privileged, they create a path where untrusted code inherits trust by execution order rather than by approval. Practitioners need to treat workflow triggers as part of access governance, not just build orchestration.

A few things that frame the scale:

A question worth separating out:

Q: How should teams separate safe PR automation from privileged execution?

A: Use one workflow for non-execution tasks such as labeling and a different, tightly controlled workflow for tests or builds. The privileged path should not execute forked code until trust is explicitly established, because workflow order determines whether the job behaves like inspection or like remote code execution.

👉 Read our full editorial: GitHub Actions pull_request_target misuse turns forks into RCE



   
ReplyQuote
Share:

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.