Skip to content

Commit 6f60475

Browse files
waleedlatif1claude
andcommitted
fix(audit): escape LIKE wildcards in audit log search query
Escape %, _, and \ characters in the search parameter before embedding in the LIKE pattern to prevent unintended broad matches. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 231df15 commit 6f60475

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

apps/sim/app/api/v1/audit-logs/query.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ export function buildFilterConditions(params: AuditLogFilterParams): SQL<unknown
4545
if (params.actorEmail) conditions.push(eq(auditLog.actorEmail, params.actorEmail))
4646

4747
if (params.search) {
48-
const searchTerm = `%${params.search}%`
48+
const escaped = params.search.replace(/[%_\\]/g, '\\$&')
49+
const searchTerm = `%${escaped}%`
4950
conditions.push(
5051
or(
5152
ilike(auditLog.action, searchTerm),

0 commit comments

Comments
 (0)