Skip to main content

Secret Redaction

AgentLogs automatically scans all transcripts for secrets and sensitive data before uploading. This ensures your API keys, tokens, passwords, and other credentials never leave your machine in plain text.

How It Works

When you sync or upload a transcript, the CLI applies two layers of protection:
  1. Sensitive file redaction — Contents of known secret-containing files (.env, .zshrc, SSH keys, etc.) are fully masked in Read and Write tool calls
  2. Pattern-based detection — All remaining text is scanned for 1,600+ secret patterns (API keys, tokens, credentials)
  3. Upload — Only the redacted version is sent to AgentLogs
Redaction happens entirely on your machine. Secrets are never sent to AgentLogs servers.

Sensitive File Redaction

In addition to pattern-based secret detection, AgentLogs fully redacts the contents of files commonly known to contain secrets. When a Read or Write tool call targets one of these files, the entire content is replaced with asterisks while preserving whitespace structure.

Files That Are Fully Redacted

Template files like .env.example, .env.sample, and .env.template are not redacted since they typically contain placeholder values meant to be shared.

Example

Pattern-Based Secret Detection

The scanner includes 1,600+ patterns covering secrets from major services and platforms:

AI & ML Providers

Authentication Tokens

Database Connection Strings

Cloud & DevOps

Generic Patterns

The scanner also detects common secret formats:
  • Private keys (-----BEGIN RSA PRIVATE KEY-----)
  • Generic API keys (api_key=..., apikey:...)
  • Password fields (password=..., passwd:...)
  • Secret fields (secret=..., client_secret:...)

Length-Preserving Redaction

Secrets are redacted while preserving string length and JSON structure. This ensures transcripts remain valid and parseable after redaction.
Structural characters like quotes, colons, and brackets are preserved so JSON remains valid.

Pattern Sources

The scanner uses patterns from secrets-patterns-db, a community-maintained database of secret detection patterns. We’ve added custom patterns on top for better coverage of AI tools and modern services: Additional pattern sources:

Limitations

While the scanner catches the vast majority of secrets, it cannot detect:
  • Custom or proprietary secret formats
  • Secrets that don’t match common patterns
  • Encrypted or encoded secrets (base64-wrapped, etc.)
For maximum security, we recommend also using allowlist mode to control exactly which repositories are captured. See Permissions for details.