Skip to content

Commit

Permalink
bpo-46474: Avoid REDoS in EntryPoint.pattern (sync with importlib_met…
Browse files Browse the repository at this point in the history
…adata 4.10.1) (GH-30803)
  • Loading branch information
jaraco authored Jan 23, 2022
1 parent b0898f4 commit 51c3e28
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/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ class EntryPoint(DeprecatedTuple):

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 51c3e28

Please sign in to comment.