File tree Expand file tree Collapse file tree 2 files changed +10
-20
lines changed
Expand file tree Collapse file tree 2 files changed +10
-20
lines changed Original file line number Diff line number Diff line change @@ -1004,22 +1004,3 @@ export function validateGoogleCalendarId(
10041004
10051005 return { isValid : true , sanitized : value }
10061006}
1007-
1008- /**
1009- * Escapes a value for use in single-quoted SQL string contexts
1010- *
1011- * Escapes single quotes by doubling them (SQL standard: `'` → `''`).
1012- * This prevents SQL injection because `''` inside a single-quoted string
1013- * represents a literal quote character, keeping the entire value as one string.
1014- *
1015- * @param value - The value to escape
1016- * @param maxLength - Maximum length allowed (default: 63)
1017- * @returns The escaped value safe for single-quoted SQL strings
1018- * @throws Error if value is empty or exceeds maxLength
1019- */
1020- export function escapeSqlString ( value : string , maxLength = 63 ) : string {
1021- if ( ! value || value . length > maxLength ) {
1022- throw new Error ( `Invalid value: ${ value } ` )
1023- }
1024- return value . replace ( / ' / g, "''" )
1025- }
Original file line number Diff line number Diff line change 11import { createLogger } from '@sim/logger'
2- import { escapeSqlString } from '@/lib/core/security/input-validation'
32import type {
43 SupabaseColumnSchema ,
54 SupabaseIntrospectParams ,
@@ -148,6 +147,16 @@ SELECT json_build_object(
148147) AS result;
149148`
150149
150+ /**
151+ * Escapes a value for single-quoted SQL strings by doubling single quotes
152+ */
153+ function escapeSqlString ( value : string ) : string {
154+ if ( ! value || value . length > 63 ) {
155+ throw new Error ( `Invalid value: ${ value } ` )
156+ }
157+ return value . replace ( / ' / g, "''" )
158+ }
159+
151160/**
152161 * SQL query filtered by specific schema
153162 */
You can’t perform that action at this time.
0 commit comments