Kagex/Guides
Git SafetySecurity & Zero-Trust · 4 min read

Scoped Git Credentials & Branch Push Guardrails for Autonomous Agents

Let agents clone private repos or open experimental branches safely while blocking force pushes or writes to main.

Sync strip
Credential helpers, auth headers & URL creds stripped
Push scope
Allowed owner/repo + branch globs (e.g. sbx/*)
CLI setup
sandboxctl secret set-git
Scope Git pushes strictly to sandbox branches
sandboxctl secret set-git GITHUB_TOKEN \
  --repos "codewithevilxd/*" \
  --branches "sbx/*,agent/*"

Key Engineering Points · Ghost Secrets Vault & Zero-Leak Proxy

All 10 key points →
  • 1Real API tokens and credentials stay encrypted/stored solely on the host with 0600 permissions under daemon data roots.
  • 2Sandboxes receive only synthetic harmless placeholder tokens formatted as sbxph_<name>_<hex>.
  • 3Outbound HTTPS requests targeting approved secret hosts terminate TLS cleanly at a per-daemon ECDSA P-256 local CA proxy.
  • 4Host egress proxy swaps real credentials in transit strictly when both host allowlist and secret destination rules match.
  • 5Echoed secrets inside upstream HTTP response bodies or debug headers are redacted automatically back into placeholders via scrubReader.
  • 6Cleartext HTTP requests attempting to carry secret placeholders are dropped immediately before touching the wire.

Sanitized .git/config Inside Every VM

Before copying your repository into /workspace, internal/workspace/sync strips credential helpers, HTTP Authorization extraheaders, includes, and embedded URL tokens from .git/config.

Proxy-Enforced Branch Rules

Outbound git smart-HTTP traffic routes through the host vault, injecting the token only for matching repositories and rejecting pushes targeting main or protected branches.

Inspect this architecture live in 3D

Step through MCP ingress, Ghost Secrets, CoW blades, and run sandboxctl commands interactively in your browser.

Frequently Asked Questions

No. If you bind the token with --branches 'sbx/*', Kagex rejects pushes to any other branch ref at the host proxy.