postgres:// (mysql/mongodb/redis://)

Exposed Database Connection String? Here's how to detect and rotate it

A postgres:// or mongodb:// URL has your DB password baked in — full read/write to every table. Scan free with Trust, then reset the password and update everywhere.

A database connection string is a single URL like postgres://user:password@host:5432/db that bundles your host, port, database name, and — critically — the password right in the text. It's the master key to your data. Anyone who reads this string can connect to your database directly, no app or login required.

What an attacker can do with a leaked Database Connection String

How Database Connection Strings get exposed

Scan your repo and live site for exposed Database Connection Strings — free

Trust checks your code, git history, and shipped JavaScript. No signup, results in about a minute.

Run a free scan →

How to rotate a leaked Database Connection String

  1. Reset the database user's password in your provider — Supabase: Project Settings → Database → Reset database password; Neon: Branches → your branch → Roles & Databases → Reset password; PlanetScale: Connect → create a new password (and delete the old one); Railway: your DB service → Variables → regenerate the password; MongoDB Atlas: Database Access → Edit user → Edit Password (or create a fresh user, cut over, then delete the old one).
  2. Copy the brand-new connection string from the provider — the host and DB name stay the same, only the password segment changes.
  3. Update the URL in every place it lives — your host's env/secrets (Vercel, Railway, Fly), CI, local .env, and any worker or cron job — then redeploy so nothing still holds the old string.
  4. Confirm the app reconnects, then make sure the old password is fully dead (delete the old PlanetScale password or the old Atlas user so it can never be reused).
  5. Lock down network access — restrict allowed IPs / disable open 0.0.0.0/0 access, require SSL, and use a least-privilege user for the app instead of the superuser where you can.
  6. Audit your database and provider logs for connections, queries, or data changes made from unfamiliar IPs while the string was exposed.

Other secret types to check

Keep your app safe