Query examples
Queries Vericto blocks and why.
These are real examples of queries that AI agents (LangChain, Vercel AI SDK, OpenAI function calling, MCP servers, etc.) generate when connecting to production databases. We have anonymized table names but the pattern of each query is identical to the original.
DELETE queries
Mass DELETE without condition
BLOCKEDDELETE FROM users;
DeleteStmt > WhereClause = NULL
VERICTO-001
CRITICAL
DELETE FROM users WHERE id = $1;
DELETE in CTE without WHERE
BLOCKEDWITH old_orders AS (
DELETE FROM orders
RETURNING id
)
SELECT COUNT(*) FROM old_orders;
WithClause > DeleteStmt > WhereClause = NULL
VERICTO-001
CRITICAL
WITH old_orders AS (
DELETE FROM orders
WHERE created_at < NOW() - INTERVAL '90 days'
RETURNING id
)
SELECT COUNT(*) FROM old_orders;
DELETE with always-true WHERE
BLOCKEDDELETE FROM products WHERE 1=1;
DeleteStmt > WhereClause > BoolExpr = ALWAYS_TRUE
VERICTO-003
CRITICAL
DELETE FROM products WHERE id = $1;
DELETE with subquery and no external predicate
BLOCKEDDELETE FROM logs
WHERE id IN (SELECT id FROM logs);
DeleteStmt > WhereClause > SubLink — sin predicado adicional
VERICTO-033
HIGH
DELETE FROM logs
WHERE id IN (
SELECT id FROM logs
WHERE created_at < NOW() - INTERVAL '30 days'
);
UPDATE queries
UPDATE role on all users
BLOCKEDUPDATE users SET role = 'admin';
UpdateStmt > WhereClause = NULL
VERICTO-042
CRITICAL
UPDATE users SET role = 'admin' WHERE id = $1;
UPDATE price to zero across the entire catalog
BLOCKEDUPDATE products SET price = 0;
UpdateStmt > WhereClause = NULL
VERICTO-042
CRITICAL
UPDATE products SET price = $1 WHERE id = $2;
Mass UPDATE of status in CTE without WHERE
BLOCKEDWITH affected AS (
UPDATE orders SET status = 'cancelled'
RETURNING id
)
SELECT id FROM affected;
WithClause > UpdateStmt > WhereClause = NULL
VERICTO-031
HIGH
WITH affected AS (
UPDATE orders SET status = 'cancelled'
WHERE status = 'pending' AND created_at < NOW() - INTERVAL '7 days'
RETURNING id
)
SELECT id FROM affected;
DROP queries
DROP TABLE in production
BLOCKEDDROP TABLE users;
DropStmt (nodo presente)
VERICTO-010
CRITICAL
-- Usar migración versionada con herramienta de migración
-- (Flyway, Liquibase, Prisma Migrate, Alembic, Rails migrations)
-- Nunca ejecutar DROP TABLE directamente desde un agente
DROP production DATABASE
BLOCKEDDROP DATABASE production;
DropStmt (nodo presente, object_type = DATABASE)
VERICTO-010
CRITICAL
-- Las operaciones a nivel de DATABASE nunca deben ejecutarse
-- desde agentes de IA. Requieren intervención humana con acceso
-- administrativo explícito y autorización documentada.
TRUNCATE queries
TRUNCATE on orders table
BLOCKEDTRUNCATE TABLE orders;
TruncateStmt (nodo presente)
VERICTO-011
CRITICAL
DELETE FROM orders
WHERE created_at < NOW() - INTERVAL '90 days';
TRUNCATE with CASCADE
BLOCKEDTRUNCATE TABLE users CASCADE;
TruncateStmt (nodo presente)
VERICTO-011
CRITICAL
DELETE FROM users WHERE created_at < $1
AND NOT EXISTS (
SELECT 1 FROM subscriptions
WHERE subscriptions.user_id = users.id
AND subscriptions.status = 'active'
);
Allowed safe queries
Vericto does not block legitimate queries. Any operation that includes specific predicates and does not present mass destruction patterns passes without modification. The added latency is less than 2ms p99.
DELETE with specific WHERE
ALLOWEDDELETE FROM users WHERE id = $1;
DeleteStmt > WhereClause > ColumnRef (id)
UPDATE with specific WHERE
ALLOWEDUPDATE users SET name = $1 WHERE id = $2;
UpdateStmt > WhereClause > ColumnRef (id)
SELECT with time filter
ALLOWEDSELECT * FROM orders
WHERE created_at > NOW() - INTERVAL '7 days';
SelectStmt > WhereClause > A_Expr (temporal)
INSERT with explicit columns
ALLOWEDINSERT INTO events (user_id, action) VALUES ($1, $2);
InsertStmt > Cols = [user_id, action]
Edge cases
Some patterns deserve additional explanation because Vericto's behavior may not be intuitive at first glance.
WHERE 1=1: always true
BLOCKEDDELETE FROM temp_table WHERE 1=1;
DeleteStmt > WhereClause > Integer(1) = Integer(1)
VERICTO-003
CRITICAL
A WHERE with an always-true condition (1=1, true, 'a'='a') is semantically equivalent to no WHERE.
DELETE with LIMIT in MySQL
ALLOWEDDELETE FROM mysql_table LIMIT 10;
DeleteStmt > LimitCount = 10 (MySQL)
In MySQL, DELETE ... LIMIT N is a SQL extension that limits the number of deleted rows. Vericto detects LIMIT 0 as a special case: although it deletes no rows, it is syntactically indistinguishable from a misconfigured DELETE.
DELETE in CTE with valid WHERE
ALLOWEDWITH deleted AS (
DELETE FROM sessions
WHERE expired_at < NOW()
RETURNING id
)
SELECT COUNT(*) FROM deleted;
WithClause > DeleteStmt > WhereClause > A_Expr (temporal)
The DELETE inside the CTE includes a WHERE with a real temporal predicate (expired_at < NOW()).