pulp-python 3.27.7__py3-none-any.whl → 3.27.8__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.
@@ -12,7 +12,7 @@ class PulpPythonPluginAppConfig(PulpPluginAppConfig):
12
12
 
13
13
  name = "pulp_python.app"
14
14
  label = "python"
15
- version = "3.27.7"
15
+ version = "3.27.8"
16
16
  python_package_name = "pulp-python"
17
17
  domain_compatible = True
18
18
 
pulp_python/app/utils.py CHANGED
@@ -626,12 +626,12 @@ class PackageIncludeFilter:
626
626
  self._filter_excludes = self._parse_packages(self.remote.excludes)
627
627
 
628
628
  def _parse_packages(self, packages):
629
+ """Group requirements by project and whether they specify a version range."""
629
630
  config = defaultdict(lambda: defaultdict(list))
630
631
  for value in packages:
631
632
  requirement = Requirement(value)
632
633
  requirement.name = canonicalize_name(requirement.name)
633
634
  if requirement.specifier:
634
- requirement.specifier.prereleases = True
635
635
  config["range"][requirement.name].append(requirement)
636
636
  else:
637
637
  config["full"][requirement.name].append(requirement)
@@ -666,7 +666,7 @@ class PackageIncludeFilter:
666
666
  include_range = self._filter_includes.get("range", {})
667
667
  if project_name in include_range:
668
668
  for req in include_range[project_name]:
669
- if version in req.specifier:
669
+ if req.specifier.contains(version, prereleases=True):
670
670
  break
671
671
  else:
672
672
  return False
@@ -674,7 +674,7 @@ class PackageIncludeFilter:
674
674
  exclude_range = self._filter_excludes.get("range", {})
675
675
  if project_name in exclude_range:
676
676
  for req in exclude_range[project_name]:
677
- if version in req.specifier:
677
+ if req.specifier.contains(version, prereleases=True):
678
678
  return False
679
679
 
680
680
  return True
@@ -0,0 +1,54 @@
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>', "&lt;script&gt;"),
7
+ ("<img src=x onerror=alert(1)>", "&lt;img"),
8
+ ('" onclick="alert(1)"', "&#34;"),
9
+ ("a&b", "a&amp;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
+ "metadata_sha256": None,
47
+ "provenance": None,
48
+ }
49
+ ]
50
+ page = write_simple_detail("safe-name", packages)
51
+ assert "<img src=x onerror=alert(1)>" not in page
52
+ assert "&lt;img src=x onerror=alert(1)&gt;" in page
53
+ assert 'http://evil.com/"><script>alert(1)</script>' not in page
54
+ assert "http://evil.com/&#34;&gt;&lt;script&gt;alert(1)&lt;/script&gt;" in page
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pulp-python
3
- Version: 3.27.7
3
+ Version: 3.27.8
4
4
  Summary: pulp-python plugin for the Pulp Project
5
5
  Author-email: Pulp Team <pulp-list@redhat.com>
6
6
  Project-URL: Homepage, https://pulpproject.org
@@ -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=8H0KRiSHSLWmWPzyFmKYd2iVNeeOUx0poYBXBUSJwiA,2490
3
+ pulp_python/app/__init__.py,sha256=M7KNBgMewWjdaexK00BqJgKeVQjhcFBEQL4F7wd2VhI,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=VVyr8LjAtHeHvY6klFeokwHNnY90qUuMchalm-2Gtjk,14056
@@ -9,7 +9,7 @@ pulp_python/app/replica.py,sha256=qiWRP7tM_v4yP_XLIQfumfGolru-Jt6ZA0KVb-9g2cA,18
9
9
  pulp_python/app/serializers.py,sha256=8RpEeRSCLLD5rMd-Pz8fTXCglYmwDUWZNySGh6P3JuA,28669
10
10
  pulp_python/app/settings.py,sha256=HXJK3rr0LVTOv1xBS5cZvVtz6j4SvFZl0PH3sLTcu2w,227
11
11
  pulp_python/app/urls.py,sha256=NuNnyGc0lqa2HPtMpCpqJlMA0Hi4htOtZO_i8YPCc3k,1328
12
- pulp_python/app/utils.py,sha256=1Ff_HR-0i283cLubGvEXHaOIFHPC8yPW66unKdupZio,27431
12
+ pulp_python/app/utils.py,sha256=nNDsu0s70EYx5a9WPJfGgxFsCwr6cwbWoTiZXdVK6zQ,27510
13
13
  pulp_python/app/viewsets.py,sha256=R0vJSI-G9WBvaVPXdtBgTTlvddN_MFwoRUtWFwqBsaQ,28440
14
14
  pulp_python/app/management/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
15
  pulp_python/app/management/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -71,9 +71,10 @@ pulp_python/tests/functional/api/test_upload.py,sha256=f21Li9agJ5fdBqErVg1j6v5FD
71
71
  pulp_python/tests/functional/api/test_vulnerability_report.py,sha256=Rv492Wrvu1FY7O_moo9DTB6OkI-OZURj_fuTKbENLh8,1730
72
72
  pulp_python/tests/unit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
73
73
  pulp_python/tests/unit/test_models.py,sha256=TBI0yKsrdbnJSPeBFfxSqhXK7zaNvR6qg5JehGH3Pds,229
74
- pulp_python-3.27.7.dist-info/licenses/LICENSE,sha256=2ylvL381vKOhdO-w6zkrOxe9lLNBhRQpo9_0EbHC_HM,18046
75
- pulp_python-3.27.7.dist-info/METADATA,sha256=8nGKtyGJOC_S5U1xFOBrIVvkaPsU0d0cC42BA8Fdq2o,1743
76
- pulp_python-3.27.7.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
77
- pulp_python-3.27.7.dist-info/entry_points.txt,sha256=HvqLEXjw_dS5jqAwnE5JiRZFE6f-y5SRtitKLPml2To,115
78
- pulp_python-3.27.7.dist-info/top_level.txt,sha256=X0hXgXc_bpbiKqVrkt8jD5_QEiQviKbHDwveQcOcJjo,12
79
- pulp_python-3.27.7.dist-info/RECORD,,
74
+ pulp_python/tests/unit/test_simple_templates.py,sha256=_2ZmRhrVwy1vTHImiRFQd0u3G2GAwmaMpUO0UvMrku0,1927
75
+ pulp_python-3.27.8.dist-info/licenses/LICENSE,sha256=2ylvL381vKOhdO-w6zkrOxe9lLNBhRQpo9_0EbHC_HM,18046
76
+ pulp_python-3.27.8.dist-info/METADATA,sha256=RyIrV8nV5ePAY3YcHAOWWl2Yk6YeGOLp1cBYWQPIDDc,1743
77
+ pulp_python-3.27.8.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
78
+ pulp_python-3.27.8.dist-info/entry_points.txt,sha256=HvqLEXjw_dS5jqAwnE5JiRZFE6f-y5SRtitKLPml2To,115
79
+ pulp_python-3.27.8.dist-info/top_level.txt,sha256=X0hXgXc_bpbiKqVrkt8jD5_QEiQviKbHDwveQcOcJjo,12
80
+ pulp_python-3.27.8.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (84.0.0)
2
+ Generator: setuptools (84.2.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5