Skip to content

Redact secret-shaped strings from transcript bundles before writing to disk - #136

Open
priyamkarn wants to merge 8 commits into
Autoloops:mainfrom
priyamkarn:fix/transcript-secret-redaction
Open

Redact secret-shaped strings from transcript bundles before writing to disk#136
priyamkarn wants to merge 8 commits into
Autoloops:mainfrom
priyamkarn:fix/transcript-secret-redaction

Conversation

@priyamkarn

@priyamkarn priyamkarn commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Problem

Transcript bundles wrote secret-shaped values from session messages and metadata to disk unchanged. The existing sanitizer only removed injected instruction tags.

Fix

  • Add best-effort pattern redaction for common API keys, tokens, credentials, private keys, connection-string passwords, and secret-shaped assignments.
  • Apply redaction at the shared message sanitizer used by transcript adapters.
  • Redact metadata values when filtered transcript markdown is rendered.
  • Preserve visible [REDACTED:<type>] placeholders in the bundle without maintaining separate count or reporting state.

Tests

  • Unit coverage for supported secret shapes, quoted multi-word assignments, ordinary text, and instruction-tag stripping.
  • End-to-end CLI coverage proving secrets in messages and metadata do not reach the bundle file while non-secret content survives.

Limitation

Redaction is best-effort pattern matching, not a guarantee. Bundles should still be reviewed before sharing or committing.

priyamkarn and others added 4 commits July 11, 2026 04:59
…o disk

sanitizeTranscriptMessage previously only stripped fake <system_instruction>/<developer_instruction> tags (prompt-injection defense) with zero redaction of API keys, tokens, passwords, or .env content.

Adds pattern-based redaction for common secret shapes (AWS, GitHub, Slack, Stripe, Anthropic, OpenAI, Google keys, JWTs, Bearer tokens, private key blocks, .env assignments) at the single choke point every platform adapter calls. CLI now warns with a redaction count when writing a transcript bundle.
@priyamkarn

Copy link
Copy Markdown
Contributor Author

Good catches : the metadata field was a real gap (I only traced the message field, not cwd/session_id, into the redaction path) and the quoted multi-word value was an actual regex bug, not just an untested edge case. Appreciate the fix. I'll add both patterns to my mental checklist for future redaction-adjacent work: trace every field that reaches the output, not just the obvious one, and test quoted/multi-token values explicitly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants