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

Vulnerable Regular Expression in docstring #8172

Closed
yetingli opened this issue Sep 5, 2020 · 2 comments
Closed

Vulnerable Regular Expression in docstring #8172

yetingli opened this issue Sep 5, 2020 · 2 comments

Comments

@yetingli
Copy link

yetingli commented Sep 5, 2020

Type of Issue
Potential Regex Denial of Service (ReDoS)

Description
The vulnerable regular expression is located in

_google_typed_arg_regex = re.compile(r'\s*(.+?)\s*\(\s*(.*[^\s]+)\s*\)')

The regex with quantified overlapping adjacency and can be exploited with the following string
" " * 5000 + "!"

I think you can limit the input length or modify this regex.

@tk0miya
Copy link
Member

tk0miya commented Sep 20, 2020

Thank you for reporting.
I posted #8224 to fix this. Please check it if you have time.

@yetingli
Copy link
Author

Hi @tk0miya ,
Thank you for your reply. I think your fix is correct and safe :)

tk0miya added a commit that referenced this issue Sep 27, 2020
Fix #8172: napoleon: Potential of regex denial of service in google style docs
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants