Secrets in Prompts
Keep API Keys and Credentials Out of AI Prompts and Coding Agents
A developer pastes a stack trace into ChatGPT. Line 14 has a Postgres connection string with the production password in it. Or a coding agent runs `cat .env` to understand the config, and the AWS key goes into the model's context.
Maskflare detects 232 credential and secret formats, from cloud keys and AI provider keys to private keys and database URLs, and masks or blocks them before the prompt or tool call reaches the provider.
- 01
Request from your application
- 02
Sensitive values masked
- 03
Forwarded to the AI provider
Why the usual approach falls short
Secret scanners check commits. They don't see a key pasted into a chat box or read by a coding agent, and once it is in a provider's logs you have to rotate it.
The Maskflare approach
Turn on the credentials pack and choose an action per format: block for private keys and cloud credentials, so the request is refused with a 403 before the provider sees it; mask for lower-risk tokens, so the surrounding code still goes through. The same rules apply on the gateway, in the desktop agent and browser protection, where credential-shaped values are blocked, and in coding agents through `maskflare-hook`. In Claude Code the hook blocks prompts containing secrets and masks Bash, WebFetch, Write, Edit, and MCP tool input and output. Cursor and Codex CLI hooks cover less, because their hook APIs expose less.
Benefits
232 formats, validated
Provider-specific key formats are matched precisely, and base64- or hex-encoded runs are decoded and checked too.
Block or mask, per rule
Refuse the request for a private key; mask a test token and let the developer keep working.
Coding agents covered
Hooks for Claude Code, Cursor, and Codex CLI apply the rules to what the agent sends and what its tools return.
Measure first
Start in alert mode to count how often secrets show up in prompts before you switch on blocking.
Built on
Understand the underlying risks
Frequently asked questions
Should we block or mask secrets?
Block anything that grants real access: private keys, cloud credentials, production database URLs. A block is unambiguous and tells the developer why. Mask lower-risk tokens where refusing the whole request would just push people to work around it.
Which coding agents are supported?
Claude Code, OpenAI Codex, Cursor, GitHub Copilot CLI and VS Code agent mode through hooks that the desktop agent installs and keeps in place, or `maskflare-hook` from the Python SDK.
What happens when a request is blocked?
On the gateway the request is refused with a 403 before it reaches the provider. On MCP routes a block rule returns a JSON-RPC error to the agent.
Can encoded secrets slip through?
Base64- and hex-encoded runs are decoded and scanned, and zero-width and look-alike characters are normalized. A secret split across several messages or encrypted by the user won't be caught.
Does this replace rotating leaked keys?
No. It stops new leaks through AI prompts. Keys that already went to a provider should still be rotated.
See it on your own data
Try Maskflare free.
Bring your hardest prompts.
28-day free trial or 10,000 requests, whichever comes first. Point one app at the gateway or enroll a few laptops,
and watch what gets masked. Or talk to us first.
- SOC 2 Type II: In progress
- ISO 27001: In progress
- EU hosting by default · on-premises available
- Prompts and files never stored
- Never used to train AI models
- GDPR · nDSG · DPA available
- Trust center →