- Home
- The 30 checks
- A database password is written in the code
A database password is written in the code
In plain English: Your code contains a database address with the password written inside it, such as postgresql://user:password@host. Anyone who can read the code can connect to your database directly and read or delete everything, skipping every check your app makes.
What happens if you ship it
Anyone who reads the repo can connect straight to your database and read or delete everything, past every check your app makes.
How to fix it technical
Let your AI tool fix it
Paste this into Lovable, Bolt, Cursor, Replit or Claude Code:
Fix this problem in my project: A database password is written in the code. Change the database password now. Read the connection string from an environment variable such as DATABASE_URL in server code, and remove it from the code. Change only what this fix needs, then tell me what you changed and anything I have to do myself.Check your app
Run npx sigship in your project folder. It reports this problem as db-password-in-code, along with 29 other checks. Nothing leaves your computer. New to the terminal?
Questions
Where should the connection string go instead?
In an environment variable, usually DATABASE_URL, set in your host's dashboard and read only by server code. Keep it out of the code and out of git.
Is a database on my own computer a problem?
No. Addresses like localhost, or a docker compose service such as db, are only reachable from your machine, so SIGSHIP leaves them alone.
Do I need to change the password?
Yes. Once it has been in the code, assume someone has it. Change it in your database provider's dashboard, then update the environment variable.