Overview
Coding agents rungit push as easily as they run tests. Teams may want pushes to sensitive repositories to come from people, not agents.
Git talks to GitHub over SSH or HTTPS. A rule that covers only one transport is bypassed by switching the remote URL. GitHub also serves SSH on port 443 at ssh.github.com, for networks that block port 22.
The Formal Endpoint intercepts all three in Transparent Mode. One network rule selects git traffic from agents. One blocks pushes:
- SSH: a push runs
git-receive-packon the server. Asessionrule reads it frominput.ssh.command. - HTTPS: a push sends
POSTto<repository>/git-receive-pack. Arequestrule reads it frominput.http.
git-upload-pack and keep working. Pushes from a user’s own terminal skip the rule.
Prerequisites
- Formal Endpoint on macOS with Transparent Mode enabled
- Permission to create network rules and policies in Formal
Create the network rule
The Endpoint passes a connection through untouched unless a network rule matches it. This rule matches GitHub over SSH, SSH on port 443, and HTTPS, for connections from a known agent or its children.- Control Plane
- Terraform
- Navigate to Network Rules
- Create a rule named
github-agent-git - Paste the CEL below
- Leave Forward to Connector unset
- Save the rule and set it to Active
connection_process.has_agent_ancestor is true for a known agent and for every process it spawns, such as git and ssh. It relies on code-signed process identity, which only macOS has.
Interception happens on the Endpoint. This rule does not need a Formal
, Connector listener, or Forward to
Connector.
Create the policy
List the repositories to protect inrepositories. The match is a substring, so repositories whose name starts with one of them, such as acme/infrastructure-docs, are also blocked.
Verify agent pushes are blocked
Prompt Claude Code to clone a protected repository, make a change, and push it:Troubleshooting
The HTTPS push fails with a certificate error
The HTTPS push fails with a certificate error
Git does not trust the Formal CA. Run:Git builds that use their own CA bundle ignore the system store. Point
http.sslCAInfo at a bundle that includes the Formal CA.The SSH push fails before the policy runs
The SSH push fails before the policy runs
See SSH troubleshooting
for key and host key errors.
The agent push goes through
The agent push goes through
Confirm the policy is Active and Transparent Mode is enabled. Confirm
the
github-agent-git network rule is Active. Without a matching rule
the Endpoint forwards the connection without inspecting it. The rule only
matches known agents, so a push from an unrecognized tool is not
intercepted.Next steps
Network Rules
Select which traffic Transparent Mode intercepts
SSH
Review how the Endpoint handles SSH
Policy Evaluation
Explore SSH and HTTP policy inputs
Endpoint Logs
Review sessions and policy decisions