Neon gives an AI-built app a Postgres database in a minute, and the connection string is one copy-paste away. That string is the whole problem: it holds the host, the user and the password, and it works from anywhere.
What the connection string is
A Neon connection string looks like a URL with a username and password inside it. Anyone who has it can connect to the database from their own machine and run any query that user is allowed to run. If the user owns the tables, that means reading, changing and dropping everything.
How it ends up in the wrong place:
- The AI writes the database call in a front-end file, so the string is bundled into JavaScript.
- The string sits in a variable that the build tool exposes to the browser because of its prefix.
- The app uses Neon's serverless driver in the browser "because it works over HTTP".
- A
.envfile or a screenshot gets committed or shared.
What to check
- Search your built JavaScript. Open the live site, find the bundle files, and search for "postgres://" or "postgresql://" and for neon.tech. Any hit in a public file is a leak.
- Query from the server only. The browser calls your API. The API holds the connection string in server-side secrets.
- Use a limited role for the app. Do not connect with the owner role. Create a role that can only touch the tables and actions the app needs.
- Check your env variable names. Variables with a public prefix in your framework ship to the browser. The string must not use one.
- Check branches. Neon branches copy data. A dev branch with real data and a loose password is still real data.
- Rotate after a leak. Removing the string from the code does not help once it was served. Reset the role password in Neon and update the server.
What an outside scan can tell you
I work on ProofForge. The free scan checks the public side of a URL you own or have permission to test: browser bundle, public files, headers and supported backend signals. It never signs in. It looks for private keys and tokens sitting in your JavaScript. It cannot see your database roles or branches, so that review is yours in the Neon console. A clean result means nothing was found in the public assets checked, not that the app is secure.
Top comments (0)