Secrets
Stop .env files and API keys from reaching a cloud coding agent.
The agent sends the text a tool just read, or the text you pasted. Deny the file read first. Mask the request only if a secret is still in it.
Order of work
- Keep live credentials out of the tree the agent is pointed at.
- Deny file reads, and use the sandbox where the client has one.
- Scan commits with gitleaks or TruffleHog so a key does not land in history.
- If the prompt will still contain a secret, mask it on the machine before the request leaves.
.gitignore hides a file from git status. It does not stop cat .env, and it does not stop a paste into the chat. If a key is already in a cloud chat, rotate it. Masking the next prompt does not delete the earlier one from the provider.
Claude Code
.claudeignore has no effect. Move those entries to Read deny rules. Deny wins over allow, and a Read deny also blocks Edit and Write on that path. The same rules cover file commands Claude Code recognizes in Bash (cat, head, tail, sed, tee) and redirections such as < file. They do not cover grep -r pattern . from the directory that holds the file, or a Python or Node script that opens files itself. For every process, use the sandbox. Docs: permissions, settings.
User file: ~/.claude/settings.json. Repo file: .claude/settings.json. Do not put a credential in the project file.
{
"permissions": {
"deny": [
"Read(./.env)",
"Read(./.env.*)",
"Read(./secrets/**)"
]
}
}permissions.deny replaces ignorePatterns. Bash(curl *) matches the command as Claude writes it. It does not match /usr/bin/curl or sh -c 'curl …'.
Model traffic: ANTHROPIC_BASE_URL with no /v1 suffix. A settings-file env block also reaches background sessions. A shell export does not. /status shows the loaded base URL. Gateway docs.
Codex
A permission profile can deny .env reads under a workspace root and leave the rest writable. On Linux, WSL, and native Windows, an unbounded ** pattern may need glob_scan_max_depth so the matches are expanded before the sandbox starts. Permissions.
default_permissions = "project-edit"
[permissions.project-edit]
extends = ":workspace"
[permissions.project-edit.filesystem]
glob_scan_max_depth = 3
[permissions.project-edit.filesystem.":workspace_roots"]
"**/*.env" = "deny"deny removes reads and writes for that path. Profiles do not combine with the older sandbox_mode setting. If sandbox_mode is set, Codex uses the older sandbox. :danger-full-access removes the local sandbox.
Provider keys belong in ~/.codex/config.toml. A project .codex/config.toml is ignored for openai_base_url, model_provider, and model_providers. A custom provider uses model_providers.<id>.base_url and wire_api = "responses". Config reference.
Cursor
Cursor reads .cursorignore and .gitignore. The default ignore list already includes .env*. Ignored files are blocked from Agent, Tab, Inline Edit, and @-mentions. The same page says the terminal and MCP tools cannot be blocked by .cursorignore, and that complete protection is not guaranteed. Same limit, shorter form: terminal commands and MCP tools may still read ignored files.
CLI tokens live in ~/.cursor/cli-config.json or .cursor/cli.json. Deny beats allow. Permissions reference.
{
"permissions": {
"deny": [
"Read(.env*)",
"Write(**/*.key)"
]
}
}The published CLI parameters describe Cursor's own endpoint. They do not document an OpenAI-compatible or Anthropic base URL. Listed flags include --api-key, --model, and --sandbox. Parameters. Editor chats and web chats are outside a local proxy. OPENAI_BASE_URL does not move traffic that is still going to Cursor's endpoint.
Grok Build
Permission rules and the sandbox are different controls. Permissions. The sandbox is off by default. This profile is the one in the settings reference. On Linux, a read deny requires bubblewrap.
[profiles.project]
extends = "workspace"
deny = ["/data/shared-secrets", "**/.env", "**/*.pem"]Select it with [sandbox] profile = "project" in ~/.grok/config.toml, or grok --sandbox project. Tool rules use the compact form, such as Read(src/**). Order is deny, then ask, then allow. Project .grok/config.toml may carry permission rules. It is not the file for custom model endpoints. Prefer env_key over an API key written into config.toml. Query parameters are saved in the session, so a secret does not belong there.
Commits
Deny rules do not search git history. gitleaks and TruffleHog do. Put one in pre-commit or CI. They do not sit on the model request. TruffleHog's live check contacts the provider. See the comparison.
Secret already in the prompt
Ignore files never see a key you typed, or a key a command printed. The free core (Apache-2.0) masks a fixed set on the machine and restores the values in the reply, including streamed server-sent events. The provider sees @@sv:, eight hex digits, @@.
- AWS access key ids
- GitHub PATs, classic and fine-grained
- Slack tokens
- Google API keys
- Stripe live secrets
- PEM private keys
- Quoted
api_key,secret,token, orpasswordassignments of 8 to 200 characters
"the password is written out" is not an assignment. The free core leaves it. Add more patterns under [[redact.secrets]]. An allow entry does not exempt a secret.
gitleaks and TruffleHog are the better choice for finding credentials in a repository. Their lists are wider. The free core is one choice when the prompt is about to be sent and a value matching the rules above should be replaced first.
SymVeil configuration
Copied from the SymVeil README. The proxy listens on 127.0.0.1 only. .symveil/ is gitignored. The vault is the reverse map, including secrets. Do not copy it off the machine.
[proxy]
listen = "127.0.0.1"
port = 8787
openai_base = "https://api.openai.com"
anthropic_base = "https://api.anthropic.com"
timeout_secs = 900
audit_log = ".symveil/audit.jsonl"
vault = ".symveil/vault.json"
[redact]
internal_domains = ["corp", "internal", "lan"]
[[redact.secrets]]
name = "acme-factory-token"
regex = '\bacme_live_[A-Za-z0-9]{16,}\b'Run the proxy, then point a client at it. ANTHROPIC_BASE_URL has no /v1 suffix. The Anthropic SDK appends /v1/messages. OpenAI-compatible clients use the /v1 base.
./target/release/symveil proxy --port 8787 --openai-base https://api.openai.com
export OPENAI_BASE_URL=http://127.0.0.1:8787/v1
export ANTHROPIC_BASE_URL=http://127.0.0.1:8787Authorization and x-api-key are forwarded and are not logged. Coverage starts only for clients whose base URL is the local proxy. A client left on the provider's own URL sends the prompt unveiled.
Grok Build
The README's checked path is a custom model in ~/.grok/config.toml, with session_summary set to that same model. Grok's own settings reference documents session_summary as the model used for session summaries, and user config as the place for custom models. Project .grok/config.toml is limited to MCP servers, plugins, and permission rules.
[models]
default = "symveil-grok"
# Reroute session-title generation through this model. Without it, grok calls
# https://cli-chat-proxy.grok.com directly and the start of the prompt is not redacted.
session_summary = "symveil-grok"
[model.symveil-grok]
model = "grok-4.7"
base_url = "http://127.0.0.1:8787/v1"
name = "Grok 4.7 via SymVeil"
env_key = "XAI_API_KEY"
api_backend = "responses"
context_window = 128000
supports_backend_search = falseSession titles call https://cli-chat-proxy.grok.com directly unless you reroute them. The README records that this request ignores a custom base_url. With session_summary pointed at the SymVeil model, the title request went through the proxy and the secret in that body was already a placeholder. features.title_refresh and GROK_TITLE_REFRESH control a later refresh, not that first call.
There is a second limit in the same README: when a tool-argument stream splits one @@sv:…@@ placeholder across two JSON fragments, Grok may concatenate it unrestored. A placeholder split only by HTTP chunk boundaries, inside one JSON value, was restored.
The free core does not learn project code names. That is planned Pro, about $9 a month, waitlist only. Checkout is not open. Build the core from the repository. This site does not distribute a binary.
Sources
- Claude Code permissions
- Claude Code settings
- Claude Code settings reference (
permissions.deny) - Connect Claude Code to an LLM gateway
- Codex permissions
- Codex configuration reference
- Cursor ignore file
- Cursor ignore files help
- Cursor CLI permissions
- Cursor CLI parameters
- Grok Build permissions
- Grok Build sandbox
- Grok Build settings reference
- SymVeil README, configuration
- gitleaks
- TruffleHog