tabbed_sections: Fix a backtrack-able regex.

This REDOS was not exploitable, as its content is only read from
checked-in files; regardless, simplify it to not backtrack.  We also
do not actually have any location which use leading or trailing
whitespace, so remove those optional bits.
This commit is contained in:
Alex Vandiver 2023-09-07 21:06:59 +00:00 committed by Tim Abbott
parent 55e4be0939
commit 61262c7b9a
1 changed files with 1 additions and 1 deletions

View File

@ -9,7 +9,7 @@ from zerver.lib.markdown.priorities import PREPROCESSOR_PRIORITES
START_TABBED_SECTION_REGEX = re.compile(r"^\{start_tabs\}$")
END_TABBED_SECTION_REGEX = re.compile(r"^\{end_tabs\}$")
TAB_CONTENT_REGEX = re.compile(r"^\{tab\|\s*(.+?)\s*\}$")
TAB_CONTENT_REGEX = re.compile(r"^\{tab\|([^}]+)\}$")
TABBED_SECTION_TEMPLATE = """
<div class="tabbed-section {tab_class}" markdown="1">