Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

test(mcp-host): check safe-regex turned the ReDoS pattern away, not only the time

marcotebc950a7c46ddf
diff --git a/mcp-host/src/workflow/__tests__/internalTools.security.test.ts b/mcp-host/src/workflow/__tests__/internalTools.security.test.ts
index d62fbad05..c984dca71 100644
--- a/mcp-host/src/workflow/__tests__/internalTools.security.test.ts
+++ b/mcp-host/src/workflow/__tests__/internalTools.security.test.ts
@@ -433,7 +433,11 @@ describe('XLSX conditional-formatting regex bounds', () => {
)
const elapsed = Date.now() - start
expect(result.success).toBe(true)
- // A loose budget, so a slow machine passes; a true ReDoS would hang for minutes.
+ // The witness: safe-regex turned the pattern away, so it never ran.
+ expect(result.content).toContain(
+ 'conditionalFormatting[0].rules[0].regex has nested repetition that can hang the match'
+ )
+ // A loose bound, so a loaded machine passes; a pattern that ran would hang for minutes.
expect(elapsed).toBeLessThan(20_000)
}, 60_000)
})