new: drive vas from your AI agent over MCP · Cursor, Claude Code, Windsurf
Turso
Security Guide

How to Secure Your Turso App

Last updated: April 20, 2026

Turso provides edge SQLite databases with libSQL. This guide covers securing your Turso-powered applications.

Why Security Matters for Turso

Key Security Concerns

  • Embedded replicas in client apps contain readable data (read-only, but visible)
  • Auth tokens in client code can be extracted - use read-only tokens only
  • No Row Level Security - SQLite doesn't support RLS natively
  • Edge locations mean data exists in multiple geographic jurisdictions
  • Sync conflicts on embedded replicas could cause data inconsistencies

Security Strengths

  • libSQL (SQLite fork) is battle-tested embedded database technology
  • Token-based auth: create read-only vs full-access tokens
  • Edge replication keeps data close to users with encryption in transit
  • Group-based organization for multi-tenant isolation
  • Embedded replicas sync automatically - no direct database exposure

Step-by-Step Security Guide

1. Protect Auth Tokens

Store Turso auth tokens in environment variables. Never commit them to repositories.

# Use environment variables
TURSO_DATABASE_URL=libsql://...
TURSO_AUTH_TOKEN=...

2. Use Read-Only Tokens Where Possible

For read-only operations, use read-only tokens to limit potential damage from token exposure.

3. Implement Application-Level Access Control

Turso is SQLite-based and lacks RLS. Implement access control in your application layer.

4. Use Parameterized Queries

Prevent SQL injection by using parameterized queries with the libSQL client.

await db.execute({
  sql: 'SELECT * FROM users WHERE id = ?',
  args: [userId]
});

5. Secure Embedded Replicas

If using embedded replicas, ensure the SQLite file location is secured and not accessible via web.

6. Scan Your Application

Run vas to verify your deployed application handles database access securely.

Common Security Mistakes

Avoid these common Turso security pitfalls:

  • Auth tokens in frontend code
  • Full-access tokens for read-only operations
  • Missing application-level access control
  • String concatenation in SQL queries
  • Embedded replica files in public directories

Recommended Security Tools

Use these tools to maintain security throughout development:

vas Security Scanner
npm audit / yarn audit
Git-secrets
Snyk

Ready to Secure Your App?

Security is an ongoing process, not a one-time checklist. After implementing these steps, use vas to verify your Turso app is secure before launch, and consider regular scans as you add new features.

Frequently Asked Questions

Does Turso have Row Level Security?

No, Turso uses libSQL (SQLite-compatible) which doesn't have RLS. Implement access control in your application layer, filtering queries based on authenticated user.

How do I secure edge replicas?

Edge replicas use the same auth token as primary. Turso handles replication security. Your responsibility is protecting the token and implementing proper access control.