Turso in an AI-built app: the database token that ships with your front end
Turso gives an AI-built app a small, fast SQLite database at the edge. Setup asks for two values, a database URL and an auth token, and the AI often treats both as harmless config. The token is not harmless. Wh
Turso gives an AI-built app a small, fast SQLite database at the edge. Setup asks for two values, a database URL and an auth token, and the AI often treats both as harmless config. The token is not harmless.
What the token is
A Turso auth token lets a client talk to your database. Depending on how it was created, it can have full access or read-only access, and it can last a long time or never expire. If it sits in browser code, anyone can copy it and run queries against your database with the same access.
Common slips:
- The database client is created in a front-end file, so the URL and token are bundled into JavaScript.
- The token sits in a variable that the build tool exposes to the browser.
- The app uses a full-access token where a read-only one would do.
- A token that never expires, created once and pasted everywhere.
What to check
- Search your built JavaScript. Open the live site, find the bundle files, and search for "libsql://" and for turso.io. See whether a long token sits next to the URL.
- Query from the server only. The browser calls your API. The API holds the URL and token in server-side secrets.
- Use the narrowest token. Read-only if the code only reads. Give it an expiry and make a separate token for each environment.
- Check your env variable names. Variables with a public prefix in your framework ship to the browser. The token must not use one.
- Keep private rows out of reach. SQLite has no row-level rules like some hosted databases, so your API must check who is asking before it returns data.
- Rotate after a leak. Removing the token from the code does not help once it was served. Revoke it and create a new one.
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 token permissions or your API's access checks, so that review is yours. A clean result means nothing was found in the public assets checked, not that the app is secure.
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.