Skip to content

Commit d026d58

Browse files
waleedlatif1claude
andcommitted
fix(quickbooks): strip string literals before WHERE keyword sanitization
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent aef9205 commit d026d58

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

apps/sim/tools/quickbooks/utils.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ export function sanitizeWhereClause(where: string | undefined): string | undefin
3333
if (!where) return undefined
3434
const trimmed = where.trim()
3535
if (!trimmed) return undefined
36-
if (FORBIDDEN_WHERE_KEYWORDS.test(trimmed)) {
36+
// Strip single-quoted string literals (QQL escapes a quote by doubling it: '')
37+
// before checking for forbidden keywords, so values like 'From Scratch Inc'
38+
// don't trigger false positives on FROM/SELECT/etc.
39+
const withoutLiterals = trimmed.replace(/'(?:''|[^'])*'/g, "''")
40+
if (FORBIDDEN_WHERE_KEYWORDS.test(withoutLiterals)) {
3741
throw new Error(
3842
'where clause may only contain predicate expressions — keywords like MAXRESULTS, STARTPOSITION, ORDER BY, SELECT, and FROM are not allowed'
3943
)

0 commit comments

Comments
 (0)