# Redact database connection strings

> Redact connection strings containing embedded credentials for Postgres, MySQL, MongoDB, Redis, and AMQP.

Canonical: https://bitbanger.in/entities/connection-string
Last updated: 2026-10-27

Category: Credentials and secrets · Entity type: `credential.connection_string`

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

```bash
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"}'
```

## FAQ

**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

- [Passwords](https://bitbanger.in/entities/password) — Redact plaintext passwords from configuration dumps, tickets, and transcripts before they are shared.
- [API keys](https://bitbanger.in/entities/api-key) — Redact AWS, OpenAI, Anthropic, GitHub, Google, Slack, and Hugging Face API keys from logs and pasted text.
- [Private keys](https://bitbanger.in/entities/private-key) — Redact PEM private keys, header and body, from logs and pasted configuration before they are stored or shared.

Try it on your own text: https://bitbanger.in/entities/connection-string
