Skip to main content

Security gateway for Claude Code traffic

Project description

cc-guard

Security gateway for Claude Code traffic.

Not to be confused with agent-guard — that's a runtime security engine for AI agents. This is a config installer.

What it does

Point Claude Code at any local anthropic-compatible proxy (flowlens sidecar, litellm, mitmproxy, anthropic-proxy, …) by modifying ~/.claude/settings.json, and back it out cleanly when you're done. Optionally, spawn and supervise the proxy subprocess for you.

# A. Bring your own proxy — cc-guard just patches settings.json
flow run -c ~/.flowlens/sidecar.yaml &
cc-guard install http://127.0.0.1:9999
# ...
cc-guard uninstall

# B. Let cc-guard generate the sidecar config AND spawn the process
cc-guard install http://127.0.0.1:9999 --sidecar
# or against a remote flowlens hub for centralized audit:
cc-guard install http://127.0.0.1:9999 \
  --hub https://hub.example.com --hub-token $TOKEN

Your ANTHROPIC_API_KEY / ANTHROPIC_AUTH_TOKEN are passed through untouched in both modes — cc-guard never reads, stores, or rewrites credentials.

Why not just edit ~/.claude/settings.json by hand

Several things need to happen together for the redirect to actually stick:

  • Back up the original ANTHROPIC_BASE_URL so uninstall can restore it (otherwise you lose whatever was there before).
  • Clean conflicting export ANTHROPIC_BASE_URL=... lines in your shell rc file, since shell env vars override settings.json.
  • Atomic writes so a Ctrl-C mid-edit doesn't corrupt your settings.
  • Idempotent install/uninstall so running it twice doesn't double-backup or crash.

cc-guard does all of this, and provides doctor and status commands for checking things after the fact.

Design principles

  1. Proxy-agnostic — any anthropic-compatible local proxy works; nothing is hard-coded to one implementation.
  2. Never touches credentialsANTHROPIC_AUTH_TOKEN and ANTHROPIC_API_KEY pass through unchanged. The proxy forwards them to the real upstream.
  3. Clean uninstall — every change is backed up before it's made, and the optional managed sidecar is SIGTERM'd cleanly on uninstall.
  4. Idempotent — repeat install/uninstall safely.
  5. Plain installer by default — sidecar spawning is strictly opt-in via --sidecar / --hub / --sidecar-config. No background processes unless you asked.

Install

The PyPI package is cc-guardian (the short cc-guard name was too close to an unrelated ccguard project, so PyPI forced a rename). The CLI command is still cc-guard.

uv tool install cc-guardian
# or, to also get managed-sidecar support (pulls flowlens + psutil on Windows):
uv tool install "cc-guardian[sidecar]"
# or
pipx install cc-guardian
# or
pip install --user cc-guardian

Two commands are installed: cc-guard (full name) and ccg (short alias).

Platforms: Linux, macOS, Windows. The plain installer is fully cross-platform; the managed sidecar uses start_new_session on POSIX and DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP on Windows. Shell rc cleanup is POSIX-only (no equivalent concept in cmd.exe / PowerShell).

Commands

Command Purpose
cc-guard install URL Point Claude Code at URL (plain mode)
cc-guard install URL --sidecar + spawn a local flowlens sidecar
cc-guard install URL --hub HUB --hub-token TOK + attach to a remote hub
cc-guard uninstall Restore previous settings, stop managed sidecar
cc-guard status Show current install state + sidecar liveness
cc-guard doctor Run diagnostic checks
cc-guard (no args) Interactive wizard

See cc-guard <command> --help for all options, or read docs/execution-logic.md for the wire flow.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cc_guardian-0.0.4.tar.gz (222.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cc_guardian-0.0.4-py3-none-any.whl (39.5 kB view details)

Uploaded Python 3

File details

Details for the file cc_guardian-0.0.4.tar.gz.

File metadata

  • Download URL: cc_guardian-0.0.4.tar.gz
  • Upload date:
  • Size: 222.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for cc_guardian-0.0.4.tar.gz
Algorithm Hash digest
SHA256 08ed70804fc85663cd4ac233b9bfe345d9ec84f08a29af71f25e991d3054c48a
MD5 86ae9165afbc8ff48da7cbd41a254cf6
BLAKE2b-256 84e9b84dc8eeeb7f7f6130111ff3cd2e78d489acd2aef515a642985fbd7b899c

See more details on using hashes here.

File details

Details for the file cc_guardian-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: cc_guardian-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 39.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for cc_guardian-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f76daf253c15f6b2b9f1d73922f4e59460a636c9715d93308f5e577597658b17
MD5 728b60e5b7dd9d68e8406ce82d0bec27
BLAKE2b-256 47b2e8a94957a291eba919080db0105c6a591a5c74f1bf0237e147f6b8e2b17c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page