@milkdown/crepe is vulnerable to Regular Expression Denial of Service (ReDoS)
28
Low Risk
The built-in OpenAI and Anthropic LLM providers in the crepe editor normalize a caller-supplied provider baseURL with a regular expression (replace(/\/+$/, '')) that strips trailing slashes. On inputs containing long runs of / that are not anchored at the very end, the \/+$ sub-expression backtracks quadratically, so an application that forwards untrusted input into the provider baseURL can be driven into O(n^2) CPU time and stalled. The regex was flagged by CodeQL as js/polynomial-redos. The fix replaces it with a linear stripTrailingSlashes helper that scans characters via charCodeAt without backtracking.
You are affected if you are using a version that falls within the vulnerable range and you enable the crepe AI feature with an OpenAI or Anthropic provider whose baseURL can be influenced by untrusted input.
@milkdown/crepe is vulnerable to Regular Expression Denial of Service (ReDoS) in versions 7.21.0 - 7.21.0.
Upgrade the @milkdown/crepe library to the patch version.
Connect your repositories to instantly see whether vulnerable or malicious packages exist in your codebase.
Free. No credit card required.

SOC 2Compliant
ISO 27001Compliant