Skip to content

Commit

Permalink
[3.9] bpo-46474: Avoid REDoS in EntryPoint.pattern (sync with importl…
Browse files Browse the repository at this point in the history
…ib_metadata 4.10.1) (GH-30803).

(cherry picked from commit 51c3e28)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
  • Loading branch information
jaraco committed Jan 23, 2022
1 parent d0852c4 commit 14fda9d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Lib/importlib/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ class EntryPoint(

pattern = re.compile(
r'(?P<module>[\w.]+)\s*'
r'(:\s*(?P<attr>[\w.]+))?\s*'
r'(?P<extras>\[.*\])?\s*$'
r'(:\s*(?P<attr>[\w.]+)\s*)?'
r'((?P<extras>\[.*\])\s*)?$'
)
"""
A regular expression describing the syntax for an entry point,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
In ``importlib.metadata.EntryPoint.pattern``, avoid potential REDoS by
limiting ambiguity in consecutive whitespace.

0 comments on commit 14fda9d

Please sign in to comment.