#309
fix: verifyclaim regular expression injection regex body before compiling
fix this without breaking existing behavior, keep supporting /pattern/flags and plain string patterns, but validate the regex body before compiling to reject unsafe constructs commonly associated with catastrophic backtracking (for example nested quantifiers and backreferences), and continue escaping plain-string patterns.
Best single approach in the shown file:
- Edit
skills/vercel-optimize/lib/verify-claim.mjsincompilePattern(...)region. - Add a small helper (e.g.,
isSafeRegexSource) nearcompilePattern. - In the
/pattern/flagsbranch, call the helper onm[1]; if unsafe, throw an error (or reject) beforenew RegExp. - Keep existing flag-merging behavior and plain-string escaping behavior unchanged.
Activity
5vercel[bot]reviewed3mo ago
vercel[bot]reviewed3mo ago
@bjormpro is attempting to deploy a commit to the Vercel Team on Vercel.
A member of the Team first needs to authorize it.