From 43a9c9bfa6aa626ec2a22540bea28d2ca77964be Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 4 Nov 2022 13:47:53 -0400 Subject: [PATCH] Limit the amount of whitespace to search/backtrack. Fixes #3659. --- setuptools/package_index.py | 2 +- setuptools/tests/test_packageindex.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/setuptools/package_index.py b/setuptools/package_index.py index 5619e4da72..362e26f3e1 100644 --- a/setuptools/package_index.py +++ b/setuptools/package_index.py @@ -217,7 +217,7 @@ def wrapper(*args, **kwargs): return wrapper -REL = re.compile(r"""<([^>]*\srel\s*=\s*['"]?([^'">]+)[^>]*)>""", re.I) +REL = re.compile(r"""<([^>]*\srel\s{0,10}=\s{0,10}['"]?([^'" >]+)[^>]*)>""", re.I) """ Regex for an HTML tag with 'rel="val"' attributes. """ diff --git a/setuptools/tests/test_packageindex.py b/setuptools/tests/test_packageindex.py index babc119721..7b0bf1124d 100644 --- a/setuptools/tests/test_packageindex.py +++ b/setuptools/tests/test_packageindex.py @@ -307,7 +307,6 @@ def test_percent_in_password(self, temp_home): assert cred.password == 'pity%' -@pytest.mark.xfail(reason="#3659") @pytest.mark.timeout(1) def test_REL_DoS(): """