diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2022-01-22 23:00:23 -0500 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2022-01-23 08:31:45 -0500 |
commit | 6e4eb09864aec1fb139f05612929cbe87a4ec694 (patch) | |
tree | f8c612492b6655280b577108de01747553786937 | |
parent | 7c5b01b5101923fc38274c491bd55239ee9f0416 (diff) | |
download | cpython-git-backport-51c3e28-3.8.tar.gz |
[3.8] bpo-46474: Avoid REDoS in EntryPoint.pattern (sync with importlib_metadata 4.10.1) (GH-30803).backport-51c3e28-3.8
(cherry picked from commit 51c3e28c8a163e58dc753765e3cc51d5a717e70d)
Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
-rw-r--r-- | Lib/importlib/metadata.py | 4 | ||||
-rw-r--r-- | Misc/NEWS.d/next/Library/2022-01-22-14-49-10.bpo-46474.eKQhvx.rst | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/Lib/importlib/metadata.py b/Lib/importlib/metadata.py index 9d2285cb4d..c8d533c5c2 100644 --- a/Lib/importlib/metadata.py +++ b/Lib/importlib/metadata.py @@ -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, diff --git a/Misc/NEWS.d/next/Library/2022-01-22-14-49-10.bpo-46474.eKQhvx.rst b/Misc/NEWS.d/next/Library/2022-01-22-14-49-10.bpo-46474.eKQhvx.rst new file mode 100644 index 0000000000..156b7de4f6 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2022-01-22-14-49-10.bpo-46474.eKQhvx.rst @@ -0,0 +1,2 @@ +In ``importlib.metadata.EntryPoint.pattern``, avoid potential REDoS by +limiting ambiguity in consecutive whitespace. |