Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use re2 instead of re #1415

Closed
MoritzWeber0 opened this issue Mar 11, 2024 · 0 comments · Fixed by #1971
Closed

Use re2 instead of re #1415

MoritzWeber0 opened this issue Mar 11, 2024 · 0 comments · Fixed by #1971
Assignees

Comments

@MoritzWeber0
Copy link
Member

MoritzWeber0 commented Mar 11, 2024

The Python re module is vulnerable to polynomial runtime due to backtracking.
Detailed information can be found on Sonarcloud: https://sonarcloud.io/organizations/dsd-dbs/rules?open=python%3AS5852&rule_key=python%3AS5852

Especially, this line of code can lead to DOS attacks: res = re.search(r"(?s:.*)^---(.*?)---$", logs, re.MULTILINE)

  • The input is user-controlled (log lines)
  • The log can be large, not a small amount of characters.

One solution is to use re2 instead: https://github.com/google/re2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant