Skip to content

Commit 6073770

Browse files
committed
fix(security): resolve ReDoS vulnerability in function execute tag pattern
Simplified regex to eliminate overlapping quantifiers that caused exponential backtracking on malformed input without closing delimiter.
1 parent 6ce299b commit 6073770

File tree

1 file changed

+1
-1
lines changed
  • apps/sim/app/api/function/execute

1 file changed

+1
-1
lines changed

apps/sim/app/api/function/execute/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ function resolveTagVariables(
494494
const undefinedLiteral = language === 'python' ? 'None' : 'undefined'
495495

496496
const tagPattern = new RegExp(
497-
`${REFERENCE.START}([a-zA-Z_](?:[a-zA-Z0-9_${REFERENCE.PATH_DELIMITER}]*[a-zA-Z0-9_])?)${REFERENCE.END}`,
497+
`${REFERENCE.START}([a-zA-Z_][a-zA-Z0-9_${REFERENCE.PATH_DELIMITER}]*)${REFERENCE.END}`,
498498
'g'
499499
)
500500
const tagMatches = resolvedCode.match(tagPattern) || []

0 commit comments

Comments
 (0)