AI Coding Tools: A Security Showdown
Not all AI coding tools are equal when it comes to security. We analyzed code generated by Lovable, Bolt.new, and Cursor across 50 common development tasks to assess their security posture.
Methodology
We prompted each tool with identical requests:
- User authentication systems
- Database CRUD operations
- File upload handling
- Payment integration
- API endpoint creation
The Results
Overall Vulnerability Rates
| Tool | Vulnerability Rate | Critical Issues | High Issues |
|---|
| Cursor | 34% | 8% | 14% |
|---|
| Lovable | 42% | 11% | 18% |
|---|
| Bolt.new | 47% | 15% | 19% |
|---|
Breakdown by Vulnerability Type
SQL Injection
- Cursor: 12% of database code vulnerable
- Lovable: 18% of database code vulnerable
- Bolt.new: 22% of database code vulnerable
- Cursor: 15% missing proper checks
- Lovable: 24% missing proper checks
- Bolt.new: 28% missing proper checks
- Cursor: 8% contained placeholder secrets
- Lovable: 31% contained placeholder secrets
- Bolt.new: 38% contained placeholder secrets
- Cursor: 6% had XSS issues
- Lovable: 9% had XSS issues
- Bolt.new: 11% had XSS issues
Tool-by-Tool Analysis
Cursor
Strengths:
- IDE integration allows more context awareness
- Can see existing code patterns and follow them
- Lower rate of hardcoded secrets (developers often have .env set up)
- Autocomplete encourages smaller, reviewable changes
- Still generates SQL injection when prompted for "quick" database code
- Authentication code often lacks rate limiting
- Follows insecure patterns if they exist in codebase
Lovable
Strengths:
- Generates complete applications quickly
- Includes authentication out of the box
- Often uses ORMs that prevent SQL injection
- Good Supabase integration with RLS prompts
- High rate of hardcoded placeholder secrets
- RLS policies often incomplete
- Authentication flows sometimes bypassable
- Less visibility into individual code decisions
Bolt.new
Strengths:
- Fastest time to working application
- Good for static sites and simple apps
- Useful for learning and experimentation
- Highest vulnerability rate across all categories
- Frequently embeds API keys in client code
- Authentication implementations often incomplete
- Database code typically uses string concatenation
Common Issues by Tool
Cursor Pattern: Completing Insecure Code
If your file has:
const query = "SELECT * FROM users WHERECursor will complete with:
const query = "SELECT * FROM users WHERE id = " + userIdIt follows the established (insecure) pattern.
Lovable Pattern: Incomplete RLS
Lovable generates Supabase tables but often creates RLS like:
CREATE POLICY "Users can read own data" ON users
FOR SELECT USING (auth.uid() = id);
-- Missing: INSERT, UPDATE, DELETE policiesBolt.new Pattern: Client-Side Secrets
// Generated in client-side code
const supabase = createClient(
'https://xxx.supabase.co',
'eyJhbGc...' // Service role key exposed!
)Recommendations by Use Case
For Production Applications
Recommended: Cursor with mandatory security scanning
Cursor gives you the most control and visibility. Combine with:
- Pre-commit security hooks
- PR-based scanning
- Security review checklist
For MVPs and Launches
Recommended: Lovable with pre-launch security audit
Lovable's speed is valuable for validation. Before launch:
- Run comprehensive security scan
- Review authentication flows
- Check RLS policies
- Remove hardcoded secrets
For Learning and Prototypes
Recommended: Any tool, but don't deploy to production
Use whatever helps you learn fastest. Just don't ship it without security review.
Universal Security Steps
Regardless of tool:
- Scan before shipping - Quick scans catch 80% of issues
- Review authentication - Every tool struggles here
- Check for secrets - Search for API key patterns
- Verify authorization - Confirm users can only access their data
- Test edge cases - Try SQL injection strings, XSS payloads
The Bottom Line
No AI coding tool generates secure code by default. Cursor is currently the most secure option, but all tools require security review before production deployment.
The tool you use matters less than the scanning you do after.