Skip to main content

AI Prompt Secret Scanner — local proxy that blocks secrets before they reach AI APIs

Project description

aigate

Local secret scanner that intercepts AI API calls and prevents credentials from leaking to LLMs.

Install

pip install aigate

Requires Python 3.11+ and jq (for Claude Code hooks).

Quick start

Claude Code (hooks — no proxy needed)

aigate install-hook

All prompts and tool calls are scanned automatically. Secrets are blocked before Claude sees them.

Any AI tool (proxy mode)

Terminal 1 — proxy:

aigate setup                         # one-time: installs CA cert (needs sudo)
aigate start --mode redact           # start the proxy

Terminal 2 — your AI tool:

source ~/.bashrc                     # load cert env vars (or open a new terminal)
export HTTPS_PROXY=http://127.0.0.1:8080
export HTTP_PROXY=http://127.0.0.1:8080
claude                               # or any other AI tool

aigate setup installs the mitmproxy CA cert into the system trust store and adds NODE_EXTRA_CA_CERTS to ~/.bashrc so Claude Code / Node.js trusts the proxy.

Scan a file directly

aigate scan .env
cat prompt.txt | aigate scan -

Modes

aigate start --mode block    # reject requests containing secrets (default)
aigate start --mode redact   # replace secrets with env var placeholders
aigate start --mode warn     # forward but log a warning
aigate start --mode audit    # forward silently, log only

Redact mode

Instead of blocking, redact mode rewrites the request before it reaches the AI:

  1. Detects secrets in your prompt (AWS keys, API tokens, database URLs, private keys, etc.)
  2. Replaces them with placeholders like [REDACTED_ANTHROPIC_API_KEY]
  3. Saves the real credentials to a local .env file
  4. Injects a system instruction telling the AI to use os.environ[] and load from .env
  5. Forwards the sanitized request — the AI never sees the real credentials

The AI acknowledges the redaction, then writes secure code using environment variables automatically. Token prefixes are mapped to conventional env var names:

Token Env var
sk-ant-* ANTHROPIC_API_KEY
sk-*, sk-proj-* OPENAI_API_KEY
ghp_*, github_pat_* GITHUB_TOKEN
glpat-* GITLAB_TOKEN
xoxb-* SLACK_BOT_TOKEN
SG.* SENDGRID_API_KEY
AKIA* AWS_ACCESS_KEY_ID

Detection rules

  • AWS keysAKIA access key IDs
  • API tokens — OpenAI, Anthropic, GitHub, GitLab, Slack, SendGrid, Square
  • Database URLs — postgres, mysql, mongodb, redis, amqp, mssql with credentials
  • Private keys — RSA, EC, DSA, OPENSSH, PGP
  • Environment filesSECRET_KEY=value, DATABASE_URL=value, etc.
  • GCP service accounts — JSON with type: service_account and private_key
  • Tailscale keystskey-auth-*, tskey-api-*
  • High-entropy secrets — password/token/secret fields with entropy > 3.5 bits

Logs

aigate logs          # last 20 entries
aigate logs -n 50    # last 50 entries
aigate logs -f       # live tail

Log file: ~/.aigate/scan.log

Uninstall

aigate uninstall-hook   # remove Claude Code hooks

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

aigate-0.2.0.tar.gz (25.9 kB view details)

Uploaded Source

Built Distribution

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

aigate-0.2.0-py3-none-any.whl (18.4 kB view details)

Uploaded Python 3

File details

Details for the file aigate-0.2.0.tar.gz.

File metadata

  • Download URL: aigate-0.2.0.tar.gz
  • Upload date:
  • Size: 25.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for aigate-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b1bb98bb45a47b62f08ceae4bde7e27bc7cb4e57a1a5169c6ab7dfae3bbd6a99
MD5 d38fc7154d45919eb7ceef5d30efcfca
BLAKE2b-256 96a1e88852128a7eb56b09d5ae4ab6900aca1e2b61420a598aa8b73f2ccbe598

See more details on using hashes here.

File details

Details for the file aigate-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: aigate-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 18.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for aigate-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8c6b258b039c82fb7d791589df975769ac1aaeabd8997f943e2c47957cc70655
MD5 06e71da8bbc1efc8b3c9b75ea075248c
BLAKE2b-256 851994e92eab2d75cf8fdb7bc212ff980cf5180d21d17bc4e2acb61ca5bdde18

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