zulip/frontend_tests
Alex Vandiver db934be064 CVE-2021-41115: Use re2 for user-supplied linkifier patterns.
Zulip attempts to validate that the regular expressions that admins
enter for linkifiers are well-formatted, and only contain a specific
subset of regex grammar.  The process of checking these
properties (via a regex!) can cause denial-of-service via
backtracking.

Furthermore, this validation itself does not prevent the creation of
linkifiers which themselves cause denial-of-service when they are
executed.  As the validator accepts literally anything inside of a
`(?P<word>...)` block, any quadratic backtracking expression can be
hidden therein.

Switch user-provided linkifier patterns to be matched in the Markdown
processor by the `re2` library, which is guaranteed constant-time.
This somewhat limits the possible features of the regular
expression (notably, look-head and -behind, and back-references);
however, these features had never been advertised as working in the
context of linkifiers.

A migration removes any existing linkifiers which would not function
under re2, after printing them for posterity during the upgrade; they
are unlikely to be common, and are impossible to fix automatically.

The denial-of-service in the linkifier validator was discovered by
@erik-krogh and @yoff, as GHSL-2021-118.
2021-10-04 21:26:24 +00:00
..
node_tests compose: Allow user to undo formatting. 2021-10-01 16:45:50 -07:00
puppeteer_lib js: Fix @typescript-eslint/restrict-template-expressions. 2021-09-22 18:06:06 -07:00
puppeteer_tests CVE-2021-41115: Use re2 for user-supplied linkifier patterns. 2021-10-04 21:26:24 +00:00
zjsunit settings: Add live update code for realm-level defaults settings. 2021-09-15 09:56:33 -07:00