Appearance
Secrets Protection for AI Coding Tools
Executive Summary
AI coding assistants—Cursor, Windsurf, Claude Code, GitHub Copilot—routinely send code context to third-party LLM providers. That context often contains API keys, database credentials, private keys, and OAuth tokens embedded in source code and configuration files. GhostAI's Secrets Protection intercepts these secrets in real time at the point of transmission, before they ever reach an external model. Unlike traditional secret scanners that only detect leaks after code is committed, GhostAI prevents the leak from happening in the first place.
The Problem
Modern AI tools transmit substantial context to LLM providers. Cursor sends open files and project context via the OpenAI API; Claude Code sends file contents via the Anthropic Messages API. This context frequently includes AWS access keys, database connection strings, private keys, and API keys—either hardcoded or in environment variables. A single accidental paste can expose credentials to a third-party provider. Traditional scanners like GitGuardian and TruffleHog scan repositories after the fact; they cannot protect against secrets sent directly from an AI tool to a model provider before any commit occurs.
How GhostAI Solves It
GhostAI acts as a transparent proxy between AI coding tools and LLM providers. Every request passes through a detection pipeline that identifies 20+ secret types using pattern matching, high-entropy analysis, and configurable custom patterns. Secrets are replaced with reversible tokens before the request reaches any external model; responses are detokenized before returning to the developer. The experience remains seamless—developers keep coding—while secrets never leave their infrastructure.
Architecture
The proxy layer sits between the developer's AI tool and the LLM provider. A Secrets Detector scans all message content; a Policy Engine applies warn, block, or redact actions; a Token Vault stores reversible mappings. The system supports OpenAI-compatible (/v1/chat/completions), Anthropic-compatible (/v1/messages), and MCP protocols. No changes to the AI tool's core behavior are required—only the API base URL and key are pointed to GhostAI.
Supported Secret Types
| Category | Examples |
|---|---|
| Cloud | AWS Access Key, Google API Key |
| Source Control | GitHub Token, GitLab PAT |
| AI/ML | OpenAI API Key |
| Payment | Stripe (test + live) |
| Communication | Slack, Twilio, SendGrid |
| Databases | PostgreSQL, MySQL, MongoDB, Redis connection URLs |
| Cryptographic | RSA, EC, OpenSSH private keys |
| Generic | High-entropy strings, env var secrets |
High-entropy detection catches unknown secret formats. Custom patterns support internal formats (e.g., myco_prod_[A-Za-z0-9]{32}).
Protocol Support
- OpenAI-compatible — Cursor, Windsurf, any OpenAI SDK
- Anthropic-compatible — Claude Code, Anthropic SDK
- MCP — Cursor MCP, Claude Desktop, n8n (scan, sanitize, restore tools)
Defense in Depth
- Input scanning — Secrets tokenized before reaching the LLM
- Response scanning — LLM output scanned for hallucinated or regurgitated secrets
- Context budget — Maximum secrets per request prevents bulk exfiltration
- Pre-commit hooks — Catch secrets before version control
- Canary tokens — Trackable fake secrets to detect provider leaks (Enterprise)
Deployment
GhostAI deploys on existing infrastructure: Docker, Kubernetes, AWS ECS/Fargate, or air-gapped environments. No new services or load balancers are required. Configure the AI tool to use GhostAI as the API base URL; all traffic flows through the proxy automatically.
Performance
| Operation | Target |
|---|---|
| Input scanning | <50ms P95 |
| Response scanning | <30ms P95 |
| Workspace scan (10K files) | <5s |
Comparison: GhostAI vs Traditional Scanners
| Capability | GhostAI | GitGuardian | TruffleHog | Gitleaks |
|---|---|---|---|---|
| Real-time AI tool interception | Yes | No | No | No |
| Pre-transmission protection | Yes | No | No | No |
| PII + Secrets combined | Yes | Secrets only | Secrets only | Secrets only |
| Reversible tokenization | Yes | N/A | N/A | N/A |
| OpenAI/Anthropic proxy | Yes | No | No | No |
| MCP server | Yes | No | No | No |
| Secret manager integration | Yes | Partial | No | No |
| Canary tokens | Yes | No | No | No |
Traditional scanners operate post-commit; GhostAI operates at the point of transmission. Both approaches are complementary—use GhostAI for real-time protection and scanners for repository hygiene.
GhostAI — Your secrets stay invisible.