PyCQA / bandit

Bandit is a tool designed to find common security issues in Python code.
https://bandit.readthedocs.io
Apache License 2.0
6.52k stars 612 forks source link

Find catastrophic `re` expressions #589

Open sobolevn opened 4 years ago

sobolevn commented 4 years ago

Is your feature request related to a problem? Please describe. Some re expressions might cause DoS. See: https://www.regular-expressions.info/catastrophic.html

Describe the solution you'd like I would like to have a linting rule for this. If bandit sees a regex that might cause DoS, it should raise an error.

Describe alternatives you've considered I have considered using dlint, it has this feature: https://github.com/dlint-py/dlint/blob/master/dlint/redos/detect.py

But, it has a lot of duplicating rules from bandit. And I don't want to mix them.

MartinThoma commented 3 years ago

More information about ReDoS: https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS