Permissions do not clean dangerous data
Permissions limit Claude actions; data hygiene controls what you put into context. Even read-only access does not protect against unsafe copy-paste into a prompt.
Data entering a session may appear in transcript, tool output, summary, screenshot, or generated document. Protection therefore starts before analysis.
| Category | Examples | Safe substitute |
|---|---|---|
| Secrets | API keys, JWT secret, database URL, passwords | Variable name, mask, .env.example |
| PII | Email, phone, address, order history | Synthetic user, masking, generalization |
| Operations | Internal URLs, trace IDs, authorization headers | Short redacted log |
| Finance | Real amounts, margin, discount rules | Synthetic values preserving thresholds |
| Support artifacts | Tickets, admin screenshots, conversations | Clean summary or cropped screenshot |
Redaction preserves cause, not identity
The purpose of redaction is to remove identification while preserving information needed to reproduce the problem. Replacing every value with the same marker can lose ordering, thresholds, or relationships between states.
For a refund bug, retain the amount threshold and expected versus actual status, but replace the real order ID and customer data.
- Preserve thresholds and ranges.
- Preserve event order and before/after states.
- Preserve identifier format and length when needed.
- Remove tokens, email, internal hosts, and unnecessary IDs.
.env and logs without leakage
- Do not pass a real .env to Claude.
- Do not store keys in CLAUDE.md or CLAUDE.local.md.
- Do not run cat .env or verbose requests with authorization headers.
- Pass a short cleaned log fragment.
- Check that evidence, PR descriptions, and handoffs contain no secrets.
PAYMENT_PROVIDER_MODE=sandbox
PAYMENT_API_KEY=<set-locally-never-commit>Possible leakage surfaces
/clear clears the current dialogue but does not remove files, exports, or forwarded summaries. A subagent isolates reasoning, but its result still requires review.
| Surface | What to check |
|---|---|
| Prompt and task spec | No keys, PII, or private URLs |
| Terminal and transcript | No raw environment or full production log |
| Tool outputs and snapshots | No sensitive file copied into a result |
| Screenshots and summaries | Visual and agent artifacts are cleaned |
| Evidence and PR | Safe to store and share |
If a secret already entered context
- Stop further distribution of the transcript or output.
- Replace or rotate the key, token, or password according to process.
- Inspect generated files, logs, and notes.
- Remove unsafe copies through the internal procedure.
- Do not pass raw material to other agents or colleagues.
Canonical lesson source · JavaRush
Open JavaRush material