Redact database connection strings from text, JSON, and CSV
Connection strings embed a username and password in the URL itself, which is why they are so often pasted into incident threads. Redactly matches the scheme, the credential pair, and the host together.
How Redactly detects database connection strings
- Matched by regex for a supported scheme followed by user:password@host.
- Covers postgres, postgresql, mysql, mongodb, mongodb+srv, redis, and amqp.
- The scheme, credentials, and host are replaced together; a trailing path is outside the match.
Why redact database connection strings?
A connection string is usually production access, not a stale sample, and it needs no further exploitation.
Example request
curl -X POST https://api.bitbanger.in/v1/redact \
-H "X-API-Key: rdct_your_key_here" \
-H "Content-Type: application/json" \
-d '{"text": "DATABASE_URL=postgres://app:s3cr3t-pass@db.internal.example.com:5432/prod", "style": "replace"}'
Every hit in the response carries entity, text, start, and end. The offsets index into the text you sent, so you can apply the redactions to your own copy of the document. The full response schema is in the API reference.
Questions
Does Redactly redact database connection strings automatically?
Yes. Send text to the API and every detected type is redacted, including database connection strings. To redact only this type, pass the value credential.connection_string in the entities filter. No training or configuration is required.
What happens to database connection strings after redaction?
With style set to replace, each match becomes [credential.connection_string] — the entity type in square brackets. Setting style to mask replaces every character with a block character, and remove deletes the span entirely.
Related entity types
- PasswordsRedact plaintext passwords from configuration dumps, tickets, and transcripts before they are shared.
- API keysRedact AWS, OpenAI, Anthropic, GitHub, Google, Slack, and Hugging Face API keys from logs and pasted text.
- Private keysRedact PEM private keys, header and body, from logs and pasted configuration before they are stored or shared.
Redact database connection strings in production
Get an API key and send your first request in a minute. Plans start at $24/month.
See pricing