Skip to content

Commit 8ba3b10

Browse files
committed
CodeQL fix
1 parent 3ba4269 commit 8ba3b10

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/backend/src/runner.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ const FRAMEWORK_FILTERS: Record<
4343
if (payload.entryType === 'test' && payload.fullTitle) {
4444
// Cucumber fullTitle format: "1: Scenario name" or "2: Scenario name"
4545
// Extract the row number and scenario name
46-
const rowMatch = payload.fullTitle.match(/^(\d+):\s*(.+)$/)
46+
// Use non-greedy match and avoid catastrophic backtracking
47+
const rowMatch = payload.fullTitle.match(/^(\d+):\s*(.*)$/)
4748
if (rowMatch) {
4849
const [, rowNumber, scenarioName] = rowMatch
4950
// Use spec file filter
@@ -184,7 +185,11 @@ class TestRunner {
184185
? this.#buildSpecArgument(specFile, payload)
185186
: undefined
186187

187-
const builder = FRAMEWORK_FILTERS[framework] || DEFAULT_FILTERS
188+
const builderCandidate = FRAMEWORK_FILTERS[framework]
189+
const builder =
190+
typeof builderCandidate === 'function'
191+
? builderCandidate
192+
: DEFAULT_FILTERS
188193
return builder({ specArg, payload })
189194
}
190195

0 commit comments

Comments
 (0)