microsoft/TypeAgent

Public

mirrored from https://github.com/microsoft/TypeAgentAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
main

Branches

Tags

  • No tags available.
264Branches9Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

Commit

agent-flows: defuse polynomial-regex warnings in catalog/llm parsers

CodeQL flagged three regexes whose adjacent \s*/\s+ and lazy any-char quantifiers could share the same characters during backtracking:

- actionCatalog.ts: schema-header regex \s+(.+)$ could split trailing whitespace many ways. Anchor the capture with (\S.*) so the lead char is forced to be non-whitespace.

- llmResponse.ts: the  `json\s*([\s\S]*?)`  and  `(ts|js|...)?\s*([\s\S]*?)`  matchers had \s* adjacent to a lazy [\s\S]*?. Drop the redundant \s* (JSON.parse and the existing .trim() handle the leading whitespace).

Smoke-tested: normal/trailing-whitespace inputs unchanged; 50k-tab pathological inputs now complete in 0-2ms.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Changed files2Full changed-file index
Branches0Containing branches
Tags0Containing tags