How to fix: PlanetScale database password in source
PlanetScale service-token JWTs and DB passwords grant full MySQL access including branch databases and deploy-requests.
Why it matters
An exposed PlanetScale database password gives an attacker direct MySQL access to your entire database, reading all user data, PII, and application state, and executing arbitrary SQL including destructive DROP TABLE operations.
PlanetScale service-token JWTs and DB passwords grant full MySQL access including branch databases and deploy-requests.
How to fix it
- 1Delete the compromised password at app.planetscale.com → Settings → Passwords
- 2Create a new password with the minimum required role (read-only vs read-write)
- 3Store the connection string in a secrets manager, not in .env files committed to source
Code examples
Store connection string securely
# .env.local (never commit)
DATABASE_URL="mysql://USERNAME:PASSWORD@HOST/DATABASE?ssl={\"rejectUnauthorized\":true}"
# In production: use a secrets manager (Vercel, AWS Secrets Manager, Vault)
# Never commit .env files; add to .gitignore:
.env
.env.local
.env.productionUse database-level read-only account for analytics
-- Create a read-only user for analytics/reporting to minimize blast radius
CREATE USER 'analytics'@'%' IDENTIFIED BY 'strong_random_password';
GRANT SELECT ON mydb.* TO 'analytics'@'%';
-- Never use the main database password in application codeReferences
Detected automatically by VulnRadar. The check id is secret-planetscale-password, stable across every scan so you can filter or diff on it.
More secrets checks
Questions
- How severe is PlanetScale database password in source?
- VulnRadar rates this critical severity in the secrets category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
- Does VulnRadar check for this automatically?
- Yes. It runs as part of every scan under the check id secret-planetscale-password, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does PlanetScale database password in source map to?
- It maps to CWE-798. In the OWASP Top 10 it falls under A07:2021.
Missing a check?
The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.