Docs · Hiding secrets
Hide secrets from the model in Claude Code
A credential pasted into a prompt, or read out of a file by a tool, is replaced before the request reaches the model, and the request still goes through. It is a company setting, off until an owner turns it on.
What happens
Where does a secret stop?
Without the setting, a request streams through Selan to the provider, held whole only to translate it for another provider, to apply a setting your company chose, or for a Codex request, which is read whole either way. With it on, every request stops at the proxy: the body is read whole (up to 24 MiB), parsed, and every string inside it swept for credentials with gitleaks' rule set. Each match is replaced before a byte goes upstream.
It redacts and forwards. It never blocks over a secret. Nothing bounces back, nothing asks you to confirm, and the developer sees no warning. It refuses a request only when the scanner cannot be reached or the body is over 24 MiB (see limits).
test token: eyJhbGciOiJIUzI1NiIsInR5… test token: [REDACTED: jwt]
See it yourself
How do I test it in Claude Code?
Assemble a JWT that signs nothing, not a real credential:
b64() { printf %s "$1" | base64 | tr -d '=\n' | tr '+/' '-_'; }
head=$(b64 '{"alg":"HS256","typ":"JWT"}')
body=$(b64 '{"sub":"local-example","name":"not a real token"}')
JWT="$head.$body.$(b64 'this-signature-signs-nothing')"
This is a syntactically real JWT that authenticates against nothing. Send it through:
selan claude -p "Read this token back to me verbatim and say nothing else: $JWT"
If the model reads the token back, your company has not turned scanning on.
The token did leave your machine and reached the Selan proxy, where the scan runs. It did not reach Anthropic, and the body is held in memory for the length of the request and never stored. See Trust.
user@example.com
and values like 12345678. A real credential does land in the feed.
How do I test it in Claude Desktop?
Claude Desktop uses the same proxy (setting it up), so it gets the same sweep. The setting is per company, not per client.
Put the same throwaway token on the clipboard, paste it into a Desktop conversation and ask for it back:
printf %s "$JWT" | pbcopy # macOS
printf %s "$JWT" | xclip -sel clip # Linux
test token: eyJhbGciOiJIUzI1NiIsInR5…
The value itself is [REDACTED: jwt] — a placeholder, not an actual token. Some layer between you and me stripped the real credential out, so there is nothing functional there for me to inspect, decode or use.
A real credential sent from Desktop lands in the feed like one from Claude Code. Desktop
holds a device token whose principal is your own email, so a detection
is attributed to you in Who and its spend lands on your own budget.
UA shows a terminal glyph for Claude Code and a monitor
for Desktop, and Agent marks a detection from a remote agent's run.
For owners
How do I turn secret scanning on?
Settings → Security → Secret scanning, in control.selan.ai. It saves when you click it.
| How it behaves | |
|---|---|
| Default | Off, for every company. |
| Who can change it | Owners. Everyone can read it. |
| Audit | Turning it on and off is logged. |
| What the CLI is told | Nothing. The launch settings omit it; members read it in the console. |
Where do I see what was caught?
Detections land in Logs → Secrets, beside the request log, with its range switcher and pager. The count badge shows on the Requests tab.
Logs RequestsSecrets 104
| Rule | Session | Who | Last seen | Requests |
|---|---|---|---|---|
| github-pat | 7c1e0b9a | dev@yourcompany.com | 15:12:45 | 3 |
Requests is how many requests carried it
in the range, and Session is the session it last arrived in. The tab also
has UA, Agent and Model columns and a chart of
requests that carried a credential. A member with read access sees only their own
detections.
A detection carries no secret material, ever. It records the rule that fired, how many values it matched, and twelve hex characters of a hash: no value, no prefix, no preview.
With scanning off, the feed says so instead of showing an all-clear:
Secret scanning is off — Requests are not being checked for credentials. This is not the same as having found none.
The detail
What is scanned, and what is not?
Request bodies, on the way upstream. Nothing else is scanned.
| In scope | Why |
|---|---|
Every top-level field: system, tools, metadata |
Not a fixed list of fields, so a field added later is scanned too. |
Every message you or a tool wrote, including tool_result blocks |
How a secret usually arrives: cat .env, kubectl get secret -o yaml. |
tool_use blocks inside the model's own messages |
Executed as commands. |
| Object keys, not only values | A secret used as a key is still a secret. |
| Out of scope | Why |
|---|---|
The model's prose: text, thinking |
The provider generated it and already holds it, and a thinking block carries a signature over its text, so rewriting it produces Invalid `signature` in `thinking` block. |
| Response bodies | Nothing on the way back is scanned. |
Which rules detect a secret?
gitleaks' own gitleaks.toml, vendored into the proxy: 215
rules, with upstream's allowlists carried across. Patterns run on
RE2 (no backtracking, linear match time). Two checks sit on top:
- An entropy floor, per rule, so a checksum does not match like a key.
- A base64 gate. Runs of 40 or more base64 characters are decoded and re-tested.
Ten rules are left out. generic-api-key and
kubernetes-secret-yaml fire on ordinary source and prose, and the eight
*-client-id rules cover ids that are public by design. Four rules are added
for the tokens Selan itself issues.
What does it deliberately not do?
| It does not block | Claude Code resends the whole conversation every turn, so a refusal would break it for good. When a secret survives being cut out of its string, the redaction widens to the whole string, then the message, then the body. The request is still forwarded. |
| It does not scan model output | Ever, in any mode. |
| It does not forward unscanned | If the scanner cannot be reached or answers too late, the request is refused with 503 selan: request blocked — the secret scanner could not be reached, so nothing was sent. A retry is right. |
| It does not hold more than 24 MiB | A larger body is refused with 413 selan: request too large, before any of it is read when it declares its length. Without the setting the same body streams through. A body that stops arriving for 30 seconds while it is read is refused with 408 selan: the request body stopped arriving. |
| It has one knob | On or off, per company. No blocking mode, no per-rule configuration, no allowlist screen, no notification. |
More
- Trust: what a request leaves behind, what is stored, and what is never stored.
- What an owner sets: this switch beside the other company-wide ones.
- Secrets: why a credential should never reach the provider.
- How Claude Code and Codex run without API keys on laptops: the provider keys themselves, kept off every laptop.
- How to stop Claude Code reading .env files: the deny rules and sandbox that keep a secret off the request in the first place.