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.

CategoryExamplesSafe substitute
SecretsAPI keys, JWT secret, database URL, passwordsVariable name, mask, .env.example
PIIEmail, phone, address, order historySynthetic user, masking, generalization
OperationsInternal URLs, trace IDs, authorization headersShort redacted log
FinanceReal amounts, margin, discount rulesSynthetic values preserving thresholds
Support artifactsTickets, admin screenshots, conversationsClean 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.
Safe configuration example
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.

SurfaceWhat to check
Prompt and task specNo keys, PII, or private URLs
Terminal and transcriptNo raw environment or full production log
Tool outputs and snapshotsNo sensitive file copied into a result
Screenshots and summariesVisual and agent artifacts are cleaned
Evidence and PRSafe to store and share

If a secret already entered context

  1. Stop further distribution of the transcript or output.
  2. Replace or rotate the key, token, or password according to process.
  3. Inspect generated files, logs, and notes.
  4. Remove unsafe copies through the internal procedure.
  5. Do not pass raw material to other agents or colleagues.

Canonical lesson source · JavaRush

Open JavaRush material