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

CategoryFiles
Environment files.env, .env.local, .env.development, .env.production, .env.test, .env.staging, .env.dev, .env.prod, etc.
Shell configuration.zshrc, .bashrc, .bash_profile, .profile, .zprofile, .zshenv
Shell history.zsh_history, .bash_history
SSH keysid_rsa, id_ed25519, id_ecdsa, id_dsa, *.pem, *.key
AWS credentials.aws/credentials, .aws/config
Package managers.npmrc, .yarnrc, .yarnrc.yml
Kubernetes.kube/config, kubeconfig
Git credentials.git-credentials, .netrc
Docker.docker/config.json
Application secretssecrets.yml, secrets.yaml, master.key, credentials.yml.enc, service-account.json
Template files like .env.example, .env.sample, and .env.template are not redacted since they typically contain placeholder values meant to be shared.

Example

// Original .env file content in transcript
DATABASE_URL=postgres://admin:secret@db.example.com/myapp
API_KEY=sk-ant-abc123

// After redaction (structure preserved, all content masked)
***************************************************************
**********************

Pattern-Based Secret Detection

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

AI & ML Providers

ProviderPattern Example
OpenAIsk-..., sk-proj-...
Anthropicsk-ant-...
HuggingFacehf_...
Replicater8_...

Authentication Tokens

TypePattern Example
JWTeyJ...
Bearer tokensBearer ...
OAuth secretsclient_secret=...
GitHub PATgithub_pat_..., ghp_..., gho_...
GitLab PATglpat-...

Database Connection Strings

DatabasePattern Example
PostgreSQLpostgres://user:pass@host/db
MongoDBmongodb+srv://user:pass@host/db
MySQLmysql://user:pass@host/db
Redisredis://user:pass@host

Cloud & DevOps

ServicePattern Example
AWSAccess keys, ARNs
Stripepk_live_..., sk_live_...
SendGridSG....
Sentry DSNhttps://...@sentry.io/...
DiscordBot tokens, webhooks
TelegramBot tokens

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.
// Before
"Authorization": "Bearer sk-ant-api03-abc123..."

// After
"Authorization": "Bearer ************************"
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:
CategoryCustom Patterns Added
AI ProvidersOpenAI, Anthropic, Cohere, HuggingFace, Replicate
AuthenticationJWT, OAuth client secrets, Bearer tokens, Google OAuth
Git PlatformsGitHub fine-grained PATs, GitLab PATs and runner tokens
Database URIsMongoDB, PostgreSQL, MySQL, Redis, JDBC, password-in-URL
Cloud & DevOpsDigitalOcean, Vault, CircleCI, New Relic, Sentry DSN, Cloudinary
MessagingDiscord bot tokens and webhooks, Telegram bots, Microsoft Teams webhooks
PaymentStripe publishable keys, PayPal Braintree, Square
ServicesSendGrid, Mailgun, MailChimp, Shopify, Dropbox, Asana, Linear
GenericAPI keys, secrets, tokens, private key blocks, certificates
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.