Skip to content

Commit a7a4ca4

Browse files
authored
[3.10] bpo-46474: Avoid REDoS in EntryPoint.pattern (sync with importlib_metadata 4.10.1) (GH-30803) (GH-30827)
(cherry picked from commit 51c3e28) Co-authored-by: Jason R. Coombs <[email protected]>
1 parent 633db1c commit a7a4ca4

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Lib/importlib/metadata/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ class EntryPoint(
132132

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

0 commit comments

Comments
 (0)