Does SafeRegex in ColdFusion 2023 Update 26 silently fail when a regex is over 1000 characters?
Hi All,
After applying ColdFusion 2023 Update 26 (2023,0,26,331018)) to our application, I found that the ReReplace method stops matching when the regex pattern is over 1000 characters. This seems to be the new SafeRegex limit introduced in this patch https://guides.adobe.com/coldfusion/en/docs/install-and-configure-coldfusion/coldfusion-2023-release-update-26.html.
This has caused a bug in our application in a ReReplace method, which was using a regex more than 1000 characters long. The simple fix is to use something like Replace() instead.
Alternatively, the patch mentions:
-Dcoldfusion.saferegex.maxpatternlen, which defaults to 1000.
Setting the flag and increasing the limit beyond 1000 also fixes the issue.
My questions:
- Is this silent behaviour intended or is this a bug? It just returns the original string unchanged
- Why has a limit of 1000 been enforced for regex? Are there wider security repercussions for using longer regex patterns?
Thanks
