Safeguard
Security Guides•

Should AI agents be allowed to open pull requests on your repositories?

An AI agent opening pull requests can be safe if it cannot merge, uses a scoped identity and a human reviews. Conditions, risks and a rollout path.

Safeguard Security Team
3 min read

Yes, if the agent can propose but not merge, works under a scoped identity, and every change passes the same checks and human review as anyone else's. An agent that opens pull requests is manageable. An agent that can push to protected branches or approve its own work is not.

What a safe setup looks like

GitHub's description of its cloud coding agent is a useful model. It works on one branch at a time, opens one pull request per task, is limited to the repository named when the task starts, and runs in an ephemeral environment with a session time limit. Repository owners and administrators can disable it per repository. Its documentation also says session logs do not replace your own review and testing, and that output can contain vulnerabilities.

Conditions to require

ConditionWhy
Agent has its own identityChanges are attributable and revocable
Token scoped to one repositoryLimits damage if misused
No write access to protected branchesForces the pull request path
Required reviews, with the agent unable to approveKeeps a human in the loop
Same CI and security checksNo fast lane for machines
Workflow changes need owner reviewCI files are a privilege escalation path
Logs retainedReconstruct what happened

Watch for rules that block the agent

GitHub notes that incompatible rulesets or branch protection can block the agent, for example a rule allowing only certain commit authors. Some teams respond by adding the agent as a bypass actor. Do that carefully. A bypass actor skips rules meant to constrain it. Prefer adjusting the rule to allow pull request creation while still requiring review and checks for merge.

Risks to plan for

  1. Prompt injection through issues and files. An agent reading a hostile issue can be steered. OWASP lists indirect prompt injection as a top risk and recommends least privilege and human approval for high-risk actions.
  2. Dependency changes. Agents may add or bump packages. Keep dependency review as a gate.
  3. Review fatigue. Many small agent pull requests can erode attention. Cap the volume per day while you learn.

A rollout path

  1. Start with a low-risk repository and documentation or test tasks.
  2. Review every pull request in detail for two weeks.
  3. Add code owner rules for sensitive paths.
  4. Widen scope only after you can show the review quality held up.

Try it yourself

Click through it at your own pace, or open it full screen.

Click through the gate and imagine every agent pull request passing through exactly this check.

Quick check

Should the agent be able to merge its own pull request?

No. Keep merge rights with humans and required reviews, and prevent the agent from approving.

Is adding the agent as a bypass actor a good idea?

Usually not. It removes the constraints that make agent changes safe to accept.

Safeguard policies and gates apply to every pull request, and agent identity helps attribute agent actions. Try a free scan at gold.safeguard.sh/scan.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.