mirror of
https://github.com/OpenRouterTeam/spawn.git
synced 2026-05-19 08:01:17 +00:00
fix(security): add length guard against ReDoS in markdown table regex (#3240)
Fixes #3199 Agent: security-auditor Co-authored-by: B <6723574+louisgv@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
8c73bb9713
commit
3d31f1e328
1 changed files with 5 additions and 0 deletions
|
|
@ -686,6 +686,11 @@ export function extractMarkdownTables(raw: string): {
|
|||
clean: string;
|
||||
tables: string[];
|
||||
} {
|
||||
if (raw.length > 50_000)
|
||||
return {
|
||||
clean: raw,
|
||||
tables: [],
|
||||
};
|
||||
const tables: string[] = [];
|
||||
MARKDOWN_TABLE_RE.lastIndex = 0;
|
||||
const clean = raw.replace(MARKDOWN_TABLE_RE, (match) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue