Skip to content

Commit 0e6b229

Browse files
authored
Fix ReDoS vulnerability
In commit 87e50c6, they changed [^\[]+ → [^\[\s][^\[]*\s*. The PR description says [^\[]+ was overlapping with \s+. So they made the first char of the label exclude whitespace with [^\[\s]. But then [^\[]* (the rest of the label) still matches spaces, and \s* immediately follows it, same class of overlap.
1 parent 48409a5 commit 0e6b229

File tree

1 file changed

+1
-1
lines changed
  • src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring

1 file changed

+1
-1
lines changed

src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/outputMonitor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ export function detectsInputRequiredPattern(cursorLine: string): boolean {
469469
return [
470470
// PowerShell-style multi-option line (supports [?] Help and optional default suffix) ending
471471
// in whitespace
472-
/\s*(?:\[[^\]]\]\s+[^\[\s][^\[]*\s*)+(?:\(default is\s+"[^"]+"\):)?\s+$/,
472+
/\s*(?:\[[^\]]\]\s+[^\[\s][^\[\s]*\s*)+(?:\(default is\s+"[^"]+"\):)?\s+$/,
473473
// Bracketed/parenthesized yes/no pairs at end of line: (y/n), [Y/n], (yes/no), [no/yes]
474474
/(?:\(|\[)\s*(?:y(?:es)?\s*\/\s*n(?:o)?|n(?:o)?\s*\/\s*y(?:es)?)\s*(?:\]|\))\s+$/i,
475475
// Same as above but allows a preceding '?' or ':' and optional wrappers e.g.

0 commit comments

Comments
 (0)