pulp-python 3.36.4__py3-none-any.whl → 3.36.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pulp_python/app/__init__.py +1 -1
- pulp_python/app/utils.py +3 -3
- pulp_python/tests/unit/test_simple_templates.py +56 -0
- {pulp_python-3.36.4.dist-info → pulp_python-3.36.5.dist-info}/METADATA +1 -1
- {pulp_python-3.36.4.dist-info → pulp_python-3.36.5.dist-info}/RECORD +9 -8
- {pulp_python-3.36.4.dist-info → pulp_python-3.36.5.dist-info}/WHEEL +1 -1
- {pulp_python-3.36.4.dist-info → pulp_python-3.36.5.dist-info}/entry_points.txt +0 -0
- {pulp_python-3.36.4.dist-info → pulp_python-3.36.5.dist-info}/licenses/LICENSE +0 -0
- {pulp_python-3.36.4.dist-info → pulp_python-3.36.5.dist-info}/top_level.txt +0 -0
pulp_python/app/__init__.py
CHANGED
pulp_python/app/utils.py
CHANGED
|
@@ -645,12 +645,12 @@ class PackageIncludeFilter:
|
|
|
645
645
|
self._filter_excludes = self._parse_packages(self.remote.excludes)
|
|
646
646
|
|
|
647
647
|
def _parse_packages(self, packages):
|
|
648
|
+
"""Group requirements by project and whether they specify a version range."""
|
|
648
649
|
config = defaultdict(lambda: defaultdict(list))
|
|
649
650
|
for value in packages:
|
|
650
651
|
requirement = Requirement(value)
|
|
651
652
|
requirement.name = canonicalize_name(requirement.name)
|
|
652
653
|
if requirement.specifier:
|
|
653
|
-
requirement.specifier.prereleases = True
|
|
654
654
|
config["range"][requirement.name].append(requirement)
|
|
655
655
|
else:
|
|
656
656
|
config["full"][requirement.name].append(requirement)
|
|
@@ -685,7 +685,7 @@ class PackageIncludeFilter:
|
|
|
685
685
|
include_range = self._filter_includes.get("range", {})
|
|
686
686
|
if project_name in include_range:
|
|
687
687
|
for req in include_range[project_name]:
|
|
688
|
-
if
|
|
688
|
+
if req.specifier.contains(version, prereleases=True):
|
|
689
689
|
break
|
|
690
690
|
else:
|
|
691
691
|
return False
|
|
@@ -693,7 +693,7 @@ class PackageIncludeFilter:
|
|
|
693
693
|
exclude_range = self._filter_excludes.get("range", {})
|
|
694
694
|
if project_name in exclude_range:
|
|
695
695
|
for req in exclude_range[project_name]:
|
|
696
|
-
if
|
|
696
|
+
if req.specifier.contains(version, prereleases=True):
|
|
697
697
|
return False
|
|
698
698
|
|
|
699
699
|
return True
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
|
|
3
|
+
from pulp_python.app.utils import write_simple_detail, write_simple_index
|
|
4
|
+
|
|
5
|
+
XSS_VECTORS = [
|
|
6
|
+
('<script>alert("xss")</script>', "<script>"),
|
|
7
|
+
("<img src=x onerror=alert(1)>", "<img"),
|
|
8
|
+
('" onclick="alert(1)"', """),
|
|
9
|
+
("a&b", "a&b"),
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def test_index_renders_valid_names():
|
|
14
|
+
"""Test that valid package names render correctly in the simple index page."""
|
|
15
|
+
page = write_simple_index(["aprojectname", "under_score", "da-sh", "ungefährlich"])
|
|
16
|
+
assert "aprojectname" in page
|
|
17
|
+
assert "under-score" in page
|
|
18
|
+
assert "da-sh" in page
|
|
19
|
+
assert "ungefährlich" in page
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@pytest.mark.parametrize("name,escaped", XSS_VECTORS)
|
|
23
|
+
def test_index_escapes_html(name, escaped):
|
|
24
|
+
"""Test that autoescape neutralizes HTML injection in the simple index page."""
|
|
25
|
+
page = write_simple_index([name])
|
|
26
|
+
assert name not in page
|
|
27
|
+
assert escaped in page
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@pytest.mark.parametrize("name,escaped", XSS_VECTORS)
|
|
31
|
+
def test_detail_escapes_html(name, escaped):
|
|
32
|
+
"""Test that autoescape neutralizes HTML injection in the simple detail page."""
|
|
33
|
+
page = write_simple_detail(name, [])
|
|
34
|
+
assert name not in page
|
|
35
|
+
assert escaped in page
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def test_detail_escapes_package_fields():
|
|
39
|
+
"""Test that autoescape neutralizes HTML injection in package metadata fields."""
|
|
40
|
+
packages = [
|
|
41
|
+
{
|
|
42
|
+
"filename": "<img src=x onerror=alert(1)>",
|
|
43
|
+
"url": 'http://evil.com/"><script>alert(1)</script>',
|
|
44
|
+
"sha256": "abc123",
|
|
45
|
+
"requires_python": None,
|
|
46
|
+
"yanked": False,
|
|
47
|
+
"yanked_reason": "",
|
|
48
|
+
"metadata_sha256": None,
|
|
49
|
+
"provenance": None,
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
page = write_simple_detail("safe-name", packages)
|
|
53
|
+
assert "<img src=x onerror=alert(1)>" not in page
|
|
54
|
+
assert "<img src=x onerror=alert(1)>" in page
|
|
55
|
+
assert 'http://evil.com/"><script>alert(1)</script>' not in page
|
|
56
|
+
assert "http://evil.com/"><script>alert(1)</script>" in page
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
pulp_python/__init__.py,sha256=GIuTLoBTc-07dSLJUh8xrZPRz8x-jJ61pfR0J1IjnzI,65
|
|
2
2
|
pulp_python/pytest_plugin.py,sha256=8Ko-O87JGPC79h8-Ecw2gJLxa6q1Ng8wD6WxbinOnVs,8573
|
|
3
|
-
pulp_python/app/__init__.py,sha256=
|
|
3
|
+
pulp_python/app/__init__.py,sha256=JOJBndLoQbxAKKw0NcHoDBnKXRbUdePIodZJAilt_bU,2552
|
|
4
4
|
pulp_python/app/cache.py,sha256=Zl2nb4uKyPYp5a3FBrdRZ_-cXfofNMQmIRaQ6dUZZ1g,1037
|
|
5
5
|
pulp_python/app/exceptions.py,sha256=mPNcWyuzF0XeOPybm-G6oDKtRqvfj4jyp41iaYqcqkA,1314
|
|
6
6
|
pulp_python/app/global_access_conditions.py,sha256=MZJtyoVsr-4hRaty6mKDqh3caOHd5UKJjEWLV2crOLs,1080
|
|
@@ -11,7 +11,7 @@ pulp_python/app/replica.py,sha256=qiWRP7tM_v4yP_XLIQfumfGolru-Jt6ZA0KVb-9g2cA,18
|
|
|
11
11
|
pulp_python/app/serializers.py,sha256=19viBO88VTKWfw9xaNpkPPQrxUmNnWiXAVJxigr0qNA,35110
|
|
12
12
|
pulp_python/app/settings.py,sha256=Cyc_p6U0HQjKpyrRL6JFrK3R7RMQJ9MAgNMJCfzPEiA,255
|
|
13
13
|
pulp_python/app/urls.py,sha256=szPHGWrxaWwMZ0QEsftAyFwisEMFfusfDS4lcYEt4nU,2064
|
|
14
|
-
pulp_python/app/utils.py,sha256
|
|
14
|
+
pulp_python/app/utils.py,sha256=E1GVLtRw4ZPcFHBM-IHG-sByspqy6dOrJdKvJS_YMEk,27882
|
|
15
15
|
pulp_python/app/viewsets.py,sha256=9ySqQFtpheVVYTLQ9LRRmr99zVHIOfHwYhFBnsqry28,36385
|
|
16
16
|
pulp_python/app/management/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
17
17
|
pulp_python/app/management/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -86,9 +86,10 @@ pulp_python/tests/functional/api/test_yank.py,sha256=qyZbAJ6bJO-4LPkVfVxKuWFjypJ
|
|
|
86
86
|
pulp_python/tests/unit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
87
87
|
pulp_python/tests/unit/test_feeds.py,sha256=EKrBBHPfrfUozckWcG9zJQSGJuU2uToofZzfC6oKT64,1400
|
|
88
88
|
pulp_python/tests/unit/test_models.py,sha256=TBI0yKsrdbnJSPeBFfxSqhXK7zaNvR6qg5JehGH3Pds,229
|
|
89
|
-
pulp_python
|
|
90
|
-
pulp_python-3.36.
|
|
91
|
-
pulp_python-3.36.
|
|
92
|
-
pulp_python-3.36.
|
|
93
|
-
pulp_python-3.36.
|
|
94
|
-
pulp_python-3.36.
|
|
89
|
+
pulp_python/tests/unit/test_simple_templates.py,sha256=ldiX2qJF-LUNkzb8WN2y2EOsgtgIelcFGfKdeGTfEmQ,1989
|
|
90
|
+
pulp_python-3.36.5.dist-info/licenses/LICENSE,sha256=2ylvL381vKOhdO-w6zkrOxe9lLNBhRQpo9_0EbHC_HM,18046
|
|
91
|
+
pulp_python-3.36.5.dist-info/METADATA,sha256=NuXFp4OeUrZY5nevkf2cItgXzjCzPQDmlZOdu6htG8k,1744
|
|
92
|
+
pulp_python-3.36.5.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
93
|
+
pulp_python-3.36.5.dist-info/entry_points.txt,sha256=HvqLEXjw_dS5jqAwnE5JiRZFE6f-y5SRtitKLPml2To,115
|
|
94
|
+
pulp_python-3.36.5.dist-info/top_level.txt,sha256=X0hXgXc_bpbiKqVrkt8jD5_QEiQviKbHDwveQcOcJjo,12
|
|
95
|
+
pulp_python-3.36.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|