Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Inefficient regular expression #2138

@sebix

Description

@sebix

Found by CodeQL:

remove_comments = re.compile(r"<!--(.|\s|\n)*?-->")

This part of the regular expression may cause exponential backtracking on strings starting with '<!--' and containing many repetitions of '\n'.

Some regular expressions take a long time to match certain input strings to the point where the time it takes to match a string of length n is proportional to nk or even 2n. Such regular expressions can negatively affect performance, or even allow a malicious user to perform a Denial of Service ("DoS") attack by crafting an expensive input string for the regular expression to match.

Tracking issue for:

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviorcomponent: botssecurity

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions