Skip to content
Databases & keys · Secret guide

Leaked PlanetScale Database Password: what to do in the first hour

Critical severityDetected onlyLast verified · 4 min read

A PlanetScale database password is the credential in the connection string of an application: with the matching host and user name, it gives direct access to one branch of a database. What the holder can do depends on the role or permissions of the password, and a read and write password lets them read customer data, change rows and drop tables. This is the credential closest to your data, and the one most often committed by accident. Reset it first, then check what was accessed.

Check your GitHub account for leaked secrets — free

Provider
Planetscale
Severity
Critical
Impact
Payments and customer data
Checked live by LeakWatch
No

What a PlanetScale Database Password looks like

A PlanetScale password starts with pscale_pw_ followed by a long generated string:

pscale_pw_XXXXXXXX…   PlanetScale database password (masked; prefix + 32 to 64 characters)

It rarely appears alone. It is the password part of a connection string or a DATABASE_URL, in the form scheme://user:password@host/db, and is often shown with a user name made of random characters (or, for Postgres databases, a role name and a branch ID) and a host ending in psdb.cloud. It is tied to one branch. Do not confuse it with pscale_tkn_ service tokens and pscale_oauth_ tokens, which act on the PlanetScale API rather than on the data. See the PlanetScale API token guide.

How PlanetScale Database Passwords get leaked

  • Connection strings in code. A DATABASE_URL in a config file, a framework settings file or a test fixture.
  • Environment files. A .env generated from the connect dialog, with the password included, then committed.
  • ORM configuration. Prisma, Drizzle or migration tool settings committed with the full URL.
  • Serverless and edge functions. Examples that put the credentials in the function source rather than in secrets.
  • Shared snippets. The connect dialog shows a password only once, so people copy it into notes, tickets and chat to avoid losing it.

What to do in the first hour

  1. Find the password. In the dashboard, open the database and the branch from the connection string, and look at its passwords or roles (see the link below). Match by name or by the user name.
  2. Create a replacement first. Create a new password with the narrowest role the application needs, and one per application or environment, so each can be rotated alone.
  3. Deploy it to your application or secret store and confirm the application connects.
  4. Delete the exposed password. For a Vitess database, the dashboard offers deletion and the CLI has pscale password delete with the database, branch and password ID. For a Postgres database, passwords belong to roles: reset the credentials of the role, and avoid using the default role in applications because rotating it causes downtime.
  5. Check the data. Look for rows you did not write, deleted tables, new users or roles and unexpected schema changes. Check recent queries and insights for unfamiliar statements or large reads from unknown addresses.
  6. Treat read access as a breach. If the password could read personal data, you may have notification duties. Note the times of exposure.
  7. Clean up the code, remove the string from history and look for other secrets in the file. See I accidentally pushed an API key to GitHub.

Not sure what else leaked from the same repository? Run a free scan.

Not sure what else leaked? Run a free scan.

Revoke it at PlanetScale

PlanetScale passwords are managed per branch in the PlanetScale dashboard, after you sign in with a user allowed to manage the database. Open the database, choose the branch, and look for the page that lists its passwords or roles. Deleting a password stops it from authenticating; for the default role of a Postgres database, the documentation describes resetting its credentials instead. A person has not confirmed the exact menu wording for this guide, and the interface can change, so if what you see differs, look for the section where passwords are created and listed, and follow PlanetScale’s documentation.

How LeakWatch detects it

The rule is called Planetscale Password. It recognizes the prefix pscale_pw_ followed by 32 to 64 characters from letters, digits, _, =, . and -, in any letter case. It needs a word boundary before the prefix and a quote, space, semicolon or the end of the line right after the value, and it does not need a variable name or a host next to it. A body shorter than 32 characters, or one with other characters attached, is not reported. The severity is critical. This type is not checked live: LeakWatch never connects to a database with the password it found.

LeakWatch detects this format but does not check it live: it can tell you the key is exposed, not whether it still works. Assume it does until you have revoked it.

FAQ

Is the password enough to connect?

You also need the host and the user name, but they are usually in the same connection string. Treat the leak as a full compromise of the branch.

Will resetting the password break my application?

Yes, until you deploy the new value. Create and deploy a replacement before deleting the old password, unless you see active abuse.

Does the password give access to every branch?

No. A password belongs to one branch. Check the production branch first, then any other branch whose password was in the same file.

Get alerted next time a secret leaks — create a free account

LeakWatch is not affiliated with Planetscale.