Skip to content

Commit d2d4cb6

Browse files
claude-code-bestdeepseek-v4-pro
andcommitted
fix: prevent ReDoS in extractMeta regex by anchoring to splice boundary
Co-Authored-By: deepseek-v4-pro <deepseek-ai@claude-code-best.win>
1 parent dfa70f6 commit d2d4cb6

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

packages/workflow-engine/src/engine/script.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,9 @@ export function extractMeta(source: string): {
8686
const meta = validateMeta(metaObj)
8787

8888
// Strip the meta statement (including trailing semicolon and extra blank lines)
89-
const body = (source.slice(0, match.index) + source.slice(i)).replace(
90-
/[ \t]*;[ \t]*\n/,
91-
'\n',
92-
)
89+
const body =
90+
source.slice(0, match.index) +
91+
source.slice(i).replace(/^[ \t]*;[ \t]*\n/, '\n')
9392
return { meta, body }
9493
}
9594

0 commit comments

Comments
 (0)