Skip to content

assertSqlIdentifier

function assertSqlIdentifier(identifier): string;

Defined in: keyset.ts:171

Validate a SQL column identifier. Throws on unsafe input — identifiers must come from your schema map, never from request data.

This intentionally accepts only simple unquoted identifiers like id or created_at. It rejects dotted paths, quoted identifiers, function calls, whitespace, and semicolons. If you need computed expressions, wrap a server-owned string with keysetSqlExpression.

Parameter Type
identifier string

string

assertSqlIdentifier("created_at"); // ok
assertSqlIdentifier("created_at; DROP TABLE posts"); // throws