
Is Bolt Secure? What We Found After Scanning AI-Generated Code
Bolt Ships Fast — But Is Bolt Secure by Default?
Bolt.new by StackBlitz is impressive. Describe an app, get working code in seconds. But "working" and "secure" are very different things. After examining dozens of Bolt-generated projects shared on GitHub and community forums, a pattern emerges: Bolt optimizes for functionality, not security.
That's not a knock on Bolt specifically — it's the nature of LLM-generated code. The AI satisfies your prompt. If you don't prompt for security, you don't get it.
The Three Vulnerabilities We Keep Seeing
1. Hardcoded API Keys and Secrets
Bolt frequently injects API keys directly into client-side code. When you say "connect to Supabase" or "add Stripe payments," the generated code often drops keys right into the frontend.
// Bolt-generated pattern (vulnerable)
const supabase = createClient(
'https://abc123.supabase.co',
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.your_actual_anon_key'
);Supabase anon keys are designed to be public, but Bolt doesn't always distinguish between anon keys and service role keys. We've seen generated code expose service role keys client-side — that's full database access for anyone who opens DevTools.
Fix: Move secrets to environment variables and server-side routes.
// Fixed: use env vars, never commit .env
const supabase = createClient(
process.env.SUPABASE_URL,
process.env.SUPABASE_ANON_KEY
);2. No Input Validation or Sanitization
Bolt generates forms and API endpoints that trust user input completely. No validation on the server. No parameterized queries if it writes raw SQL. This is textbook injection territory.
When we prompted Bolt to build a simple search feature with a Node/Express backend, it produced:
// Bolt-generated (vulnerable to SQL injection)
app.get('/search', (req, res) => {
const query = `SELECT * FROM products WHERE name LIKE '%${req.query.q}%'`;
db.all(query, (err, rows) => res.json(rows));
});Fix: Use parameterized queries. Always.
// Fixed: parameterized query
app.get('/search', (req, res) => {
db.all(
'SELECT * FROM products WHERE name LIKE ?',
[`%${req.query.q}%`],
(err, rows) => res.json(rows)
);
});3. Missing Authentication and Authorization Checks
Bolt builds CRUD endpoints that work — but rarely adds auth middleware unless you explicitly ask for it. Every route is wide open by default. There's no concept of "this user can only edit their own data."
This isn't hypothetical. The OWASP Top 10 ranks Broken Access Control as the #1 web app vulnerability, and AI code generators make it worse by generating plausible-looking apps that skip authorization entirely.
Why This Matters More for Bolt Than Traditional Coding
When you write code manually, you make conscious decisions at each step. With Bolt, you get a complete app you didn't write, and you inherit every shortcut the AI took. The danger is deploying something that looks production-ready but has zero security hardening.
Bolt's own documentation doesn't make security claims. It's a prototyping tool. The responsibility is yours.
What You Should Do Before Deploying Any Bolt App
- Audit every environment variable. Search the generated codebase for hardcoded strings that look like keys, tokens, or passwords. Move them to
.envfiles and add.envto.gitignore. - Add server-side validation to every endpoint. Use a library like
zodorjoito validate all incoming data. Never trust the client. - Scan before you ship. Run your deployed Bolt app through a security scanner like PreBreach to catch exposed secrets, missing headers, and common vulnerabilities the AI left behind.
- Add auth middleware explicitly. If you're using Express, add authentication checks on every route that touches user data. Bolt won't do this for you unless prompted — and even then, verify it.
The Bottom Line
Is Bolt secure? No, not by default — and it's not trying to be. It's a code generation tool, not a security product. The apps it produces are starting points, not production-ready deployments.
Treat every Bolt-generated project like code from a fast-moving junior dev: functional, sometimes clever, but needs a thorough security review before it touches real users.