pulp-python 3.19.4__py3-none-any.whl → 3.19.6__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 +5 -5
- pulp_python/tests/functional/api/test_crud_content_unit.py +2 -2
- pulp_python/tests/unit/test_simple_templates.py +51 -0
- {pulp_python-3.19.4.dist-info → pulp_python-3.19.6.dist-info}/METADATA +1 -1
- {pulp_python-3.19.4.dist-info → pulp_python-3.19.6.dist-info}/RECORD +10 -9
- {pulp_python-3.19.4.dist-info → pulp_python-3.19.6.dist-info}/WHEEL +1 -1
- {pulp_python-3.19.4.dist-info → pulp_python-3.19.6.dist-info}/entry_points.txt +0 -0
- {pulp_python-3.19.4.dist-info → pulp_python-3.19.6.dist-info}/licenses/LICENSE +0 -0
- {pulp_python-3.19.4.dist-info → pulp_python-3.19.6.dist-info}/top_level.txt +0 -0
pulp_python/app/__init__.py
CHANGED
pulp_python/app/utils.py
CHANGED
|
@@ -404,14 +404,14 @@ def python_content_to_download_info(content, base_path, domain=None):
|
|
|
404
404
|
|
|
405
405
|
def write_simple_index(project_names, streamed=False):
|
|
406
406
|
"""Writes the simple index."""
|
|
407
|
-
simple = Template(simple_index_template)
|
|
407
|
+
simple = Template(simple_index_template, autoescape=True)
|
|
408
408
|
context = {"projects": ((x, canonicalize_name(x)) for x in project_names)}
|
|
409
409
|
return simple.stream(**context) if streamed else simple.render(**context)
|
|
410
410
|
|
|
411
411
|
|
|
412
412
|
def write_simple_detail(project_name, project_packages, streamed=False):
|
|
413
413
|
"""Writes the simple detail page of a package."""
|
|
414
|
-
detail = Template(simple_detail_template)
|
|
414
|
+
detail = Template(simple_detail_template, autoescape=True)
|
|
415
415
|
context = {"project_name": project_name, "project_packages": project_packages}
|
|
416
416
|
return detail.stream(**context) if streamed else detail.render(**context)
|
|
417
417
|
|
|
@@ -425,12 +425,12 @@ class PackageIncludeFilter:
|
|
|
425
425
|
self._filter_excludes = self._parse_packages(self.remote.excludes)
|
|
426
426
|
|
|
427
427
|
def _parse_packages(self, packages):
|
|
428
|
+
"""Group requirements by project and whether they specify a version range."""
|
|
428
429
|
config = defaultdict(lambda: defaultdict(list))
|
|
429
430
|
for value in packages:
|
|
430
431
|
requirement = Requirement(value)
|
|
431
432
|
requirement.name = canonicalize_name(requirement.name)
|
|
432
433
|
if requirement.specifier:
|
|
433
|
-
requirement.specifier.prereleases = True
|
|
434
434
|
config["range"][requirement.name].append(requirement)
|
|
435
435
|
else:
|
|
436
436
|
config["full"][requirement.name].append(requirement)
|
|
@@ -465,7 +465,7 @@ class PackageIncludeFilter:
|
|
|
465
465
|
include_range = self._filter_includes.get("range", {})
|
|
466
466
|
if project_name in include_range:
|
|
467
467
|
for req in include_range[project_name]:
|
|
468
|
-
if
|
|
468
|
+
if req.specifier.contains(version, prereleases=True):
|
|
469
469
|
break
|
|
470
470
|
else:
|
|
471
471
|
return False
|
|
@@ -473,7 +473,7 @@ class PackageIncludeFilter:
|
|
|
473
473
|
exclude_range = self._filter_excludes.get("range", {})
|
|
474
474
|
if project_name in exclude_range:
|
|
475
475
|
for req in exclude_range[project_name]:
|
|
476
|
-
if
|
|
476
|
+
if req.specifier.contains(version, prereleases=True):
|
|
477
477
|
return False
|
|
478
478
|
|
|
479
479
|
return True
|
|
@@ -170,9 +170,9 @@ def test_upload_requires_python(python_content_factory):
|
|
|
170
170
|
@pytest.mark.parallel
|
|
171
171
|
def test_upload_metadata_24_spec(python_content_factory):
|
|
172
172
|
"""Test that packages using metadata spec 2.4 can be uploaded to pulp."""
|
|
173
|
-
filename = "
|
|
173
|
+
filename = "attrs-26.1.0.tar.gz"
|
|
174
174
|
with PyPISimple() as client:
|
|
175
|
-
page = client.get_project_page("
|
|
175
|
+
page = client.get_project_page("attrs")
|
|
176
176
|
for package in page.packages:
|
|
177
177
|
if package.filename == filename:
|
|
178
178
|
content = python_content_factory(filename, url=package.url)
|
|
@@ -0,0 +1,51 @@
|
|
|
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
|
+
"<img src=x onerror=alert(1)>",
|
|
43
|
+
'http://evil.com/"><script>alert(1)</script>',
|
|
44
|
+
"abc123",
|
|
45
|
+
)
|
|
46
|
+
]
|
|
47
|
+
page = write_simple_detail("safe-name", packages)
|
|
48
|
+
assert "<img src=x onerror=alert(1)>" not in page
|
|
49
|
+
assert "<img src=x onerror=alert(1)>" in page
|
|
50
|
+
assert 'http://evil.com/"><script>alert(1)</script>' not in page
|
|
51
|
+
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=KqzB8Xv22_mA6itx0N1tYg9qXgEhHiOkX1ookAaJB8g,7525
|
|
3
|
-
pulp_python/app/__init__.py,sha256=
|
|
3
|
+
pulp_python/app/__init__.py,sha256=LyJ2kaKMYDgHqazR0SO6via4OTomgBPDoUanwluLekU,2490
|
|
4
4
|
pulp_python/app/global_access_conditions.py,sha256=MZJtyoVsr-4hRaty6mKDqh3caOHd5UKJjEWLV2crOLs,1080
|
|
5
5
|
pulp_python/app/modelresource.py,sha256=4SFAdqk6lozi_cZz4uqDIqhqPAZF-7l5jJwPn-xGZFs,1249
|
|
6
6
|
pulp_python/app/models.py,sha256=Puvl1VhuCubtf_V0sq6U5nWAb94sUAVk_wTv-FkuvSs,11258
|
|
@@ -8,7 +8,7 @@ pulp_python/app/replica.py,sha256=cFMNdTDX_6k87PzEffDDN4Moh2iUu89rSqYgv0-Ta8c,18
|
|
|
8
8
|
pulp_python/app/serializers.py,sha256=zHFxpmKQPJrKWaBADVbUsZKpxLuGqjyKpCDm_CHxfzU,19712
|
|
9
9
|
pulp_python/app/settings.py,sha256=HXJK3rr0LVTOv1xBS5cZvVtz6j4SvFZl0PH3sLTcu2w,227
|
|
10
10
|
pulp_python/app/urls.py,sha256=bnuW89roIlPipROo3QcJktvRPAxikI1tV7-XX425QQg,1089
|
|
11
|
-
pulp_python/app/utils.py,sha256=
|
|
11
|
+
pulp_python/app/utils.py,sha256=t-SHNCXfjXj-IKhOqWeZL8rX41PMiImrmq2iLi0Z7k0,18434
|
|
12
12
|
pulp_python/app/viewsets.py,sha256=S0VQIv4_pmDYzpsEwlze-pvyQ2yaT4Hpq3GeBiUdL3g,25103
|
|
13
13
|
pulp_python/app/management/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
14
|
pulp_python/app/management/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -48,7 +48,7 @@ pulp_python/tests/functional/utils.py,sha256=pl8oyqPSRKvJl8jZY4cv-y0apgbP01s3QJn
|
|
|
48
48
|
pulp_python/tests/functional/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
49
49
|
pulp_python/tests/functional/api/test_auto_publish.py,sha256=uCIt4LsO61oMk3bDs3LMQDJI8zkKqvY0b1uX16bTxzM,1747
|
|
50
50
|
pulp_python/tests/functional/api/test_consume_content.py,sha256=-7b6KOrIT3NLSUafeu1tzXEXRPddDbS5VeMHxMIy2n8,999
|
|
51
|
-
pulp_python/tests/functional/api/test_crud_content_unit.py,sha256=
|
|
51
|
+
pulp_python/tests/functional/api/test_crud_content_unit.py,sha256=p9oA8YCsGQvKBcHnpajSG_S3mNlOldOy9hEvm6O8SDc,8024
|
|
52
52
|
pulp_python/tests/functional/api/test_crud_publications.py,sha256=3cuSDC9C9M1opt0lh5ObGj8t7gq5jUW-RWj6MrA4Teo,5647
|
|
53
53
|
pulp_python/tests/functional/api/test_crud_remotes.py,sha256=clFFhgG5udyKzWOLwxpmwjhiVz8r5JEPAQHkztcAf9w,5812
|
|
54
54
|
pulp_python/tests/functional/api/test_domains.py,sha256=vMm7rZD96nlmVdpU-Y7mZVtj5j9xHfTs_NYgLJuRhAc,10469
|
|
@@ -62,9 +62,10 @@ pulp_python/tests/functional/api/test_sync.py,sha256=oE2gJx9bnbQudq45dGVB7xE_ZBi
|
|
|
62
62
|
pulp_python/tests/functional/api/test_upload.py,sha256=XJ6zUffw9A1avOJND5CfwL4xM0_ejiL_NCWszPe7fZY,1853
|
|
63
63
|
pulp_python/tests/unit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
64
64
|
pulp_python/tests/unit/test_models.py,sha256=TBI0yKsrdbnJSPeBFfxSqhXK7zaNvR6qg5JehGH3Pds,229
|
|
65
|
-
pulp_python
|
|
66
|
-
pulp_python-3.19.
|
|
67
|
-
pulp_python-3.19.
|
|
68
|
-
pulp_python-3.19.
|
|
69
|
-
pulp_python-3.19.
|
|
70
|
-
pulp_python-3.19.
|
|
65
|
+
pulp_python/tests/unit/test_simple_templates.py,sha256=bFQXNH4fa9RHtRKq-WCfJpeEGlcqvCcPjAF2_750erU,1792
|
|
66
|
+
pulp_python-3.19.6.dist-info/licenses/LICENSE,sha256=2ylvL381vKOhdO-w6zkrOxe9lLNBhRQpo9_0EbHC_HM,18046
|
|
67
|
+
pulp_python-3.19.6.dist-info/METADATA,sha256=uoeMIzAnafOBQ4wj4VcZlFhZi04zpEL_MI2hhfdfBoM,1702
|
|
68
|
+
pulp_python-3.19.6.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
69
|
+
pulp_python-3.19.6.dist-info/entry_points.txt,sha256=HvqLEXjw_dS5jqAwnE5JiRZFE6f-y5SRtitKLPml2To,115
|
|
70
|
+
pulp_python-3.19.6.dist-info/top_level.txt,sha256=X0hXgXc_bpbiKqVrkt8jD5_QEiQviKbHDwveQcOcJjo,12
|
|
71
|
+
pulp_python-3.19.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|