A pull request submitted from a copy (fork) of a repository, typically by an external contributor, proposing changes to the original. In CI/CD, the workflow may run untrusted code; if it has access to secrets or write-scoped tokens, attackers can steal them. Defenders restrict secrets for fork-triggered runs and require approval before workflows execute.
What a fork pull request changes in the trust model
A fork pull request shifts review from trusted repository contributors to code that can originate outside the project’s normal trust boundary. That matters because the workflow often evaluates untrusted changes before merge, so the security question is not just “is the code correct?” but “what can this run or expose while being reviewed?”
The core risk is that the forked branch may trigger automation in ways the original maintainers did not intend. If the workflow has write-scoped tokens, cached credentials, or injected secrets, the pull request can become an execution path rather than a passive review artifact.
This is why fork pull requests are treated differently from ordinary internal branches. Teams commonly separate review from execution, reduce permissions on fork-triggered jobs, and require explicit approval before anything privileged runs.
In practice, the term describes a governance boundary as much as a repository workflow. It tells you where trust changes, which controls should narrow that trust, and why the same CI/CD logic is safer when it is assumed to handle hostile input until proven otherwise.
Why fork pull requests are dangerous in CI/CD
The danger is not the pull request mechanism itself, but the combination of untrusted code with automation that can read secrets, push artifacts, or write back to the repository. That pattern has become a standard route to secret theft, malicious build changes, and poisoned pipeline execution.
Fork-based workflows can also be abused through indirect paths, such as script injection in build steps, checkout of attacker-controlled refs, or overly broad job permissions. For a practical example of the class, see OWASP CI/CD Top 10 CICD-SEC-4 Poisoned Pipeline Execution Guide, which covers fork approvals, privileged triggers, and detection.
When this model is misconfigured, the attacker does not need to “break into” the platform in the classic sense. They only need a workflow path that already runs on their submitted changes and exposes something valuable, usually credentials, signing material, or repository write capability.
How organisations evaluate exposure from forked contributions
Exposure review starts with knowing which repositories accept forks, which workflows run on pull request events, and whether any of those jobs can touch protected resources. That means inventorying CI/CD definitions, checking which runners are shared, and identifying whether secrets or write tokens can reach jobs triggered from a fork.
Security teams should also look at whether the workflow fetches data from the forked branch, whether it uses privileged events such as pull_request_target, and whether approval gates exist before execution. For repository-specific hardening, How to Restrict GITHUB_TOKEN Permissions in Workflows explains why read-only defaults and per-job permission scoping matter.
In repository ecosystems with review environments, the same exposure review should include preview URLs, temporary infrastructure, and teardown controls, because a forked contribution can influence more than the source tree. Ephemeral and Preview Environment Security Guide is useful when the pull request also provisions per-PR infrastructure.
Safer handling, detection, and post-merge review
The safest pattern is to assume forked code is hostile until the repository has decided it is safe to run. That usually means withholding secrets by default, limiting token scopes, approving only the minimum jobs that need execution, and separating validation jobs from deployment jobs.
Detection should focus on unexpected workflow changes, new or widened permissions, unusual outbound network activity, and any evidence that a pull request job accessed material it should never see. If a workflow has already run, teams should review logs, runner state, token usage, and any artifacts the job produced.
If compromise is suspected, the follow-up is not only code review. Credentials, tokens, signing keys, and other identity material exposed to the workflow may need rotation, and the pipeline may need to be rebuilt from a known-good source. That is the same recovery logic used in Malicious Commit Response Playbook, which extends naturally to malicious pull request handling.
Fork pull requests therefore sit at the intersection of collaboration and control. The right security posture is not to block contribution, but to make untrusted contribution non-privileged by default and auditable when it is allowed to progress.
Risk and Threat Considerations
Fork pull requests create a material exposure because they invite code from outside the trusted repository boundary into automation that may already have access to secrets, credentials, or write-capable tokens. If the workflow is privileged, the pull request becomes an attack surface for secret theft, pipeline poisoning, and unauthorized repository actions.
Failure mechanism: The attacker submits crafted changes that trigger a workflow path with excessive permissions, then abuses log output, environment access, artifact generation, or misconfigured event handling to extract sensitive material or alter build behaviour.
Impact: The result can be stolen credentials, compromised build integrity, tampered artifacts, unauthorized merges or releases, and follow-on compromise of related systems that trust the pipeline output.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Non-Human Identity Top 10 provides the primary governance reference for this term.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Non-Human Identity Top 10 | NHI-02 — Secret Leakage | Fork PR workflows can expose secrets through untrusted execution. |
| NHI-04 — Insecure Authentication | Fork-triggered jobs may abuse overly trusted workflow authentication paths. | |
| NHI-05 — Overprivileged NHI | Workflow tokens and CI identities can have excessive permissions in fork runs. | |
| Recommendation — Keep secrets out of fork-triggered runs and rotate any exposed material. Restrict workflow credentials and remove unnecessary authentication power from untrusted jobs. Apply least privilege to CI identities, tokens, and job-level permissions. | ||
Practitioner Guidance
Why practitioners should care: Treat fork pull requests as an untrusted execution channel, not just a code review mechanism. The key judgment is whether any job triggered by the fork can observe or influence protected resources before human approval.
Common misunderstanding: Many teams assume “the workflow only runs tests” means the run is harmless. In reality, test jobs still execute code, and the security boundary is defined by what the job can reach, not by the label on the job.
Practitioner takeaway: If a fork-triggered run can read secrets or write back to the repository, the workflow design is already too permissive for the trust model it is using.
Related resources from NHI Mgmt Group
- Guide: Atlantis Security
- What breaks when fork pull request workflows can influence deployment context?
- Why do fork based pull request workflows increase supply chain risk in cloud native development?
- Why do pull_request_target and fork-based workflows increase the risk of secrets exposure in CI/CD pipelines?
- Cross-Fork Pull Request
Deepen Your Knowledge
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.
Reviewed and updated by the NHIMG editorial team on November 26, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org