pulp-python 3.36.3__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.
@@ -12,7 +12,7 @@ class PulpPythonPluginAppConfig(PulpPluginAppConfig):
12
12
 
13
13
  name = "pulp_python.app"
14
14
  label = "python"
15
- version = "3.36.3"
15
+ version = "3.36.5"
16
16
  python_package_name = "pulp-python"
17
17
  domain_compatible = True
18
18
 
pulp_python/app/utils.py CHANGED
@@ -556,7 +556,7 @@ def python_content_to_download_info(content, base_path, domain=None):
556
556
 
557
557
  def write_simple_index(project_names):
558
558
  """Writes the simple index."""
559
- simple = Template(simple_index_template)
559
+ simple = Template(simple_index_template, autoescape=True)
560
560
  context = {
561
561
  "SIMPLE_API_VERSION": SIMPLE_API_VERSION,
562
562
  "projects": ((x, canonicalize_name(x)) for x in project_names),
@@ -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 version in req.specifier:
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 version in req.specifier:
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>', "&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
+ "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 "&lt;img src=x onerror=alert(1)&gt;" in page
55
+ assert 'http://evil.com/"><script>alert(1)</script>' not in page
56
+ 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.36.3
3
+ Version: 3.36.5
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=V9cpl1SkIq9qq9wVH7bK9UGBC3jP3DJNKVy_r_ZFfyU,2552
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=13jUDe8BwfuN1m3-pAJ8Kip0vixQTHAiZZIn7xl0YUo,27786
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-3.36.3.dist-info/licenses/LICENSE,sha256=2ylvL381vKOhdO-w6zkrOxe9lLNBhRQpo9_0EbHC_HM,18046
90
- pulp_python-3.36.3.dist-info/METADATA,sha256=QExkNmG9fETySClWZzsUu3rtBaF-Z60j27dCnSd4wgU,1744
91
- pulp_python-3.36.3.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
92
- pulp_python-3.36.3.dist-info/entry_points.txt,sha256=HvqLEXjw_dS5jqAwnE5JiRZFE6f-y5SRtitKLPml2To,115
93
- pulp_python-3.36.3.dist-info/top_level.txt,sha256=X0hXgXc_bpbiKqVrkt8jD5_QEiQviKbHDwveQcOcJjo,12
94
- pulp_python-3.36.3.dist-info/RECORD,,
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,,
@@ -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