mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-22 08:15:53 +00:00
fix: prevent ReDoS in extractMeta regex by anchoring to splice boundary
Co-Authored-By: deepseek-v4-pro <deepseek-ai@claude-code-best.win>
This commit is contained in:
@@ -86,10 +86,9 @@ export function extractMeta(source: string): {
|
|||||||
const meta = validateMeta(metaObj)
|
const meta = validateMeta(metaObj)
|
||||||
|
|
||||||
// Strip the meta statement (including trailing semicolon and extra blank lines)
|
// Strip the meta statement (including trailing semicolon and extra blank lines)
|
||||||
const body = (source.slice(0, match.index) + source.slice(i)).replace(
|
const body =
|
||||||
/[ \t]*;[ \t]*\n/,
|
source.slice(0, match.index) +
|
||||||
'\n',
|
source.slice(i).replace(/^[ \t]*;[ \t]*\n/, '\n')
|
||||||
)
|
|
||||||
return { meta, body }
|
return { meta, body }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user