/** * postgres-mcp - WHERE Clause Validation * * Validates WHERE clause parameters to prevent SQL injection. * Uses a blocklist approach to reject dangerous patterns while * allowing legitimate complex conditions. */ /** * Error thrown when an unsafe WHERE clause is detected */ export declare class UnsafeWhereClauseError extends Error { constructor(reason: string); } /** * Validates a WHERE clause for dangerous SQL patterns. * * This function uses a blocklist approach to detect and reject * common SQL injection patterns. It allows legitimate complex * conditions while blocking obvious attack vectors. * * Uses a two-phase approach for performance: * 1. Fast path: single combined regex test (covers 99%+ of safe queries) * 2. Slow path: individual pattern iteration for specific error messages * * @param where - The WHERE clause to validate * @throws UnsafeWhereClauseError if a dangerous pattern is detected * * @example * validateWhereClause("price > 10"); // OK * validateWhereClause("status = 'active' AND id < 100"); // OK * validateWhereClause("1=1; DROP TABLE users;--"); // Throws * validateWhereClause("1=1 UNION SELECT * FROM pg_shadow"); // Throws */ export declare function validateWhereClause(where: string): void; /** * Validates and returns a safe WHERE clause. * * @param where - The WHERE clause to sanitize * @returns The validated WHERE clause (unchanged if safe) * @throws UnsafeWhereClauseError if a dangerous pattern is detected */ export declare function sanitizeWhereClause(where: string): string; //# sourceMappingURL=where-clause.d.ts.map