pulp-python 3.36.4__tar.gz → 3.37.1__tar.gz
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-3.36.4 → pulp_python-3.37.1}/CHANGES.md +15 -4
- {pulp_python-3.36.4 → pulp_python-3.37.1}/PKG-INFO +3 -4
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/__init__.py +1 -1
- pulp_python-3.37.1/pulp_python/app/migrations/0025_pythonremote_vulnerabilities.py +16 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/models.py +6 -1
- pulp_python-3.37.1/pulp_python/app/osv.py +42 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/pypi/serializers.py +3 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/serializers.py +6 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/tasks/__init__.py +1 -1
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/tasks/sync.py +33 -38
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/tasks/vulnerability_report.py +11 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/utils.py +22 -1
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/viewsets.py +2 -9
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/tests/functional/api/test_download_content.py +1 -1
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/tests/functional/api/test_pypi_apis.py +4 -1
- pulp_python-3.37.1/pulp_python/tests/functional/api/test_pypi_json_vulnerabilities.py +171 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/tests/functional/api/test_vulnerability_report.py +7 -10
- pulp_python-3.37.1/pulp_python/tests/unit/test_vulnerabilities.py +84 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python.egg-info/PKG-INFO +3 -4
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python.egg-info/SOURCES.txt +5 -1
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python.egg-info/requires.txt +1 -1
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pyproject.toml +4 -5
- {pulp_python-3.36.4 → pulp_python-3.37.1}/COMMITMENT +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/COPYRIGHT +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/LICENSE +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/MANIFEST.in +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/README.md +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/functest_requirements.txt +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/__init__.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/cache.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/exceptions.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/global_access_conditions.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/management/__init__.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/management/commands/__init__.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/management/commands/repair-python-metadata.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/migrations/0001_initial.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/migrations/0001_squashed_0010_update_json_field.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/migrations/0002_pythonpackagecontent_python_version.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/migrations/0003_new_sync_filters.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/migrations/0004_DATA_swap_distribution_model.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/migrations/0005_pythonpackagecontent_sha256.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/migrations/0006_pythonrepository_autopublish.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/migrations/0007_pythonpackagecontent_mv-2-1.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/migrations/0008_pythonpackagecontent_unique_sha256.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/migrations/0009_pythondistribution_allow_uploads.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/migrations/0010_update_json_field.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/migrations/0011_alter_pythondistribution_distribution_ptr_and_more.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/migrations/0012_add_domain.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/migrations/0013_add_rbac_permissions.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/migrations/0014_pythonpackagecontent_dynamic_and_more.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/migrations/0015_alter_pythonpackagecontent_options.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/migrations/0016_pythonpackagecontent_metadata_sha256.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/migrations/0017_pythonpackagecontent_size.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/migrations/0018_packageprovenance.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/migrations/0019_create_missing_metadata_artifacts.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/migrations/0020_pythonpackagecontent_name_normalized.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/migrations/0021_pythonrepository_upload_duplicate_filenames.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/migrations/0022_pythonblocklistentry.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/migrations/0023_packageyank.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/migrations/0024_pythonrepository_error_on_reject.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/migrations/__init__.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/modelresource.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/provenance.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/pypi/__init__.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/pypi/feeds.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/pypi/views.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/replica.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/settings.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/tasks/publish.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/tasks/repair.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/tasks/upload.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/tasks/yank.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/urls.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/webserver_snippets/__init__.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/webserver_snippets/apache.conf +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/webserver_snippets/nginx.conf +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/pytest_plugin.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/tests/__init__.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/tests/functional/__init__.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/tests/functional/api/__init__.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/tests/functional/api/test_attestations.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/tests/functional/api/test_auto_publish.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/tests/functional/api/test_blocklist.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/tests/functional/api/test_consume_content.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/tests/functional/api/test_crud_content_unit.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/tests/functional/api/test_crud_publications.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/tests/functional/api/test_crud_remotes.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/tests/functional/api/test_domains.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/tests/functional/api/test_export_import.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/tests/functional/api/test_full_mirror.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/tests/functional/api/test_pypi_feeds.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/tests/functional/api/test_pypi_simple_api.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/tests/functional/api/test_rbac.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/tests/functional/api/test_repair.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/tests/functional/api/test_simple_cache.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/tests/functional/api/test_sync.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/tests/functional/api/test_upload.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/tests/functional/api/test_version_specifier_filter.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/tests/functional/api/test_yank.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/tests/functional/constants.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/tests/functional/utils.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/tests/unit/__init__.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/tests/unit/test_feeds.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/tests/unit/test_models.py +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python.egg-info/dependency_links.txt +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python.egg-info/entry_points.txt +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python.egg-info/top_level.txt +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/setup.cfg +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/test_requirements.txt +0 -0
- {pulp_python-3.36.4 → pulp_python-3.37.1}/unittest_requirements.txt +0 -0
|
@@ -8,18 +8,29 @@
|
|
|
8
8
|
|
|
9
9
|
[//]: # (towncrier release notes start)
|
|
10
10
|
|
|
11
|
-
## 3.
|
|
11
|
+
## 3.37.1 (2026-10-08) {: #3.37.1 }
|
|
12
12
|
|
|
13
|
-
#### Bugfixes {: #3.
|
|
13
|
+
#### Bugfixes {: #3.37.1-bugfix }
|
|
14
14
|
|
|
15
15
|
- Fixed quoting mistake in simple html index pages that can lead to a possible XSS attack given a carefully crafted package name. CVE-2026-103871
|
|
16
16
|
|
|
17
17
|
---
|
|
18
18
|
|
|
19
|
-
## 3.
|
|
19
|
+
## 3.37.0 (2026-10-07) {: #3.37.0 }
|
|
20
20
|
|
|
21
|
-
####
|
|
21
|
+
#### Features {: #3.37.0-feature }
|
|
22
22
|
|
|
23
|
+
- Added a `vulnerabilities` field to the PyPI JSON API, populated from OSV scan reports. Remotes can opt in to scan the new repository version after sync.
|
|
24
|
+
[#1360](https://github.com/pulp/pulp_python/issues/1360)
|
|
25
|
+
- Updated minimum required python version to >=3.12.
|
|
26
|
+
- Upgraded Bandersnatch to 8.0. Full-index syncs now list packages from either the JSON or HTML representation of the Simple API.
|
|
27
|
+
|
|
28
|
+
#### Bugfixes {: #3.37.0-bugfix }
|
|
29
|
+
|
|
30
|
+
- Prefer the PyPI Simple API JSON response when clients such as pip and uv advertise JSON alongside HTML.
|
|
31
|
+
[#1370](https://github.com/pulp/pulp_python/issues/1370)
|
|
32
|
+
- RSS feeds now reflect the most recently added file for each release, produce unique guids when content is updated, and support up to 500 entries in `updates.xml`.
|
|
33
|
+
[#1374](https://github.com/pulp/pulp_python/issues/1374)
|
|
23
34
|
- RSS feed GUIDs are now stable when additional platform wheels arrive for the same release. GUIDs only change when a new PEP 427 build tag is introduced, preventing feed readers from showing duplicate entries for multi-architecture builds.
|
|
24
35
|
[#1381](https://github.com/pulp/pulp_python/issues/1381)
|
|
25
36
|
- Fixed the Integrity API evaluating the entire repository's content query before filtering.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pulp-python
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.37.1
|
|
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
|
|
@@ -14,15 +14,14 @@ Classifier: Development Status :: 5 - Production/Stable
|
|
|
14
14
|
Classifier: Framework :: Django
|
|
15
15
|
Classifier: Programming Language :: Python
|
|
16
16
|
Classifier: Programming Language :: Python :: 3
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
18
17
|
Classifier: Programming Language :: Python :: 3.12
|
|
19
18
|
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
-
Requires-Python: >=3.
|
|
19
|
+
Requires-Python: >=3.12
|
|
21
20
|
Description-Content-Type: text/markdown
|
|
22
21
|
License-File: LICENSE
|
|
23
22
|
Requires-Dist: pulpcore<3.130,>=3.105.0
|
|
24
23
|
Requires-Dist: pkginfo<1.13.0,>=1.12.0
|
|
25
|
-
Requires-Dist: bandersnatch<
|
|
24
|
+
Requires-Dist: bandersnatch<8.1,>=8.0.0
|
|
26
25
|
Requires-Dist: pypi-simple<2.0,>=1.8.0
|
|
27
26
|
Requires-Dist: pypi-attestations==0.0.28
|
|
28
27
|
Dynamic: license-file
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from django.db import migrations, models
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class Migration(migrations.Migration):
|
|
5
|
+
|
|
6
|
+
dependencies = [
|
|
7
|
+
("python", "0024_pythonrepository_error_on_reject"),
|
|
8
|
+
]
|
|
9
|
+
|
|
10
|
+
operations = [
|
|
11
|
+
migrations.AddField(
|
|
12
|
+
model_name="pythonremote",
|
|
13
|
+
name="vulnerabilities",
|
|
14
|
+
field=models.BooleanField(default=False),
|
|
15
|
+
),
|
|
16
|
+
]
|
|
@@ -130,7 +130,11 @@ class PythonDistribution(Distribution, AutoAddObjPermsMixin):
|
|
|
130
130
|
if not settings.DOMAIN_ENABLED:
|
|
131
131
|
domain = None
|
|
132
132
|
json_body = python_content_to_json(
|
|
133
|
-
self.base_path,
|
|
133
|
+
self.base_path,
|
|
134
|
+
package_content,
|
|
135
|
+
version=version,
|
|
136
|
+
domain=domain,
|
|
137
|
+
repository_version=self.publication.repository_version,
|
|
134
138
|
)
|
|
135
139
|
if json_body:
|
|
136
140
|
return json_response(json_body, headers=headers)
|
|
@@ -350,6 +354,7 @@ class PythonRemote(Remote, AutoAddObjPermsMixin):
|
|
|
350
354
|
models.CharField(max_length=10, blank=True), choices=PLATFORMS, default=list
|
|
351
355
|
)
|
|
352
356
|
provenance = models.BooleanField(default=False)
|
|
357
|
+
vulnerabilities = models.BooleanField(default=False)
|
|
353
358
|
|
|
354
359
|
def get_remote_artifact_url(self, relative_path=None, request=None):
|
|
355
360
|
"""Get url for remote_artifact"""
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
from packaging.version import InvalidVersion, Version
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def _osv_fixed_in(vuln):
|
|
5
|
+
"""Extract PEP 440 fixed versions from an OSV vulnerability record."""
|
|
6
|
+
fixed = []
|
|
7
|
+
seen = set()
|
|
8
|
+
for affected in vuln.get("affected") or []:
|
|
9
|
+
for range_ in affected.get("ranges") or []:
|
|
10
|
+
for event in range_.get("events") or []:
|
|
11
|
+
if "fixed" not in event:
|
|
12
|
+
continue
|
|
13
|
+
version = event["fixed"]
|
|
14
|
+
if version in seen:
|
|
15
|
+
continue
|
|
16
|
+
try:
|
|
17
|
+
Version(version)
|
|
18
|
+
except InvalidVersion:
|
|
19
|
+
continue
|
|
20
|
+
seen.add(version)
|
|
21
|
+
fixed.append(version)
|
|
22
|
+
return fixed
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def osv_to_pypi_vulnerabilities(vulns):
|
|
26
|
+
"""Trim OSV vulnerability records to the Warehouse JSON API shape."""
|
|
27
|
+
seen = {}
|
|
28
|
+
for vuln in vulns or []:
|
|
29
|
+
vuln_id = vuln.get("id")
|
|
30
|
+
if not vuln_id or vuln_id in seen:
|
|
31
|
+
continue
|
|
32
|
+
seen[vuln_id] = {
|
|
33
|
+
"id": vuln_id,
|
|
34
|
+
"source": "osv",
|
|
35
|
+
"link": f"https://osv.dev/vulnerability/{vuln_id}",
|
|
36
|
+
"aliases": vuln.get("aliases") or [],
|
|
37
|
+
"details": vuln.get("details"),
|
|
38
|
+
"summary": vuln.get("summary"),
|
|
39
|
+
"fixed_in": _osv_fixed_in(vuln),
|
|
40
|
+
"withdrawn": vuln.get("withdrawn"),
|
|
41
|
+
}
|
|
42
|
+
return list(seen.values())
|
|
@@ -35,6 +35,9 @@ class PackageMetadataSerializer(serializers.Serializer):
|
|
|
35
35
|
info = serializers.JSONField(help_text=_("Core metadata of the package"))
|
|
36
36
|
releases = serializers.JSONField(help_text=_("List of all the releases of the package"))
|
|
37
37
|
urls = serializers.JSONField()
|
|
38
|
+
vulnerabilities = serializers.JSONField(
|
|
39
|
+
help_text=_("Known vulnerabilities for the selected package version."),
|
|
40
|
+
)
|
|
38
41
|
|
|
39
42
|
|
|
40
43
|
class PackageUploadSerializer(serializers.Serializer):
|
|
@@ -789,6 +789,11 @@ class PythonRemoteSerializer(core_serializers.RemoteSerializer):
|
|
|
789
789
|
help_text=_("Whether to sync available provenances for Python packages."),
|
|
790
790
|
default=False,
|
|
791
791
|
)
|
|
792
|
+
vulnerabilities = serializers.BooleanField(
|
|
793
|
+
required=False,
|
|
794
|
+
help_text=_("Whether to scan the new repository version for vulnerabilities after a sync."),
|
|
795
|
+
default=False,
|
|
796
|
+
)
|
|
792
797
|
|
|
793
798
|
def validate_includes(self, value):
|
|
794
799
|
"""Validates the includes"""
|
|
@@ -821,6 +826,7 @@ class PythonRemoteSerializer(core_serializers.RemoteSerializer):
|
|
|
821
826
|
"keep_latest_packages",
|
|
822
827
|
"exclude_platforms",
|
|
823
828
|
"provenance",
|
|
829
|
+
"vulnerabilities",
|
|
824
830
|
)
|
|
825
831
|
model = python_models.PythonRemote
|
|
826
832
|
|
|
@@ -6,5 +6,5 @@ from .publish import publish # noqa:F401
|
|
|
6
6
|
from .repair import repair # noqa:F401
|
|
7
7
|
from .sync import sync # noqa:F401
|
|
8
8
|
from .upload import upload, upload_group # noqa:F401
|
|
9
|
-
from .vulnerability_report import get_repo_version_content # noqa:F401
|
|
9
|
+
from .vulnerability_report import dispatch_scan, get_repo_version_content # noqa:F401
|
|
10
10
|
from .yank import aunyank_package, ayank_package # noqa:F401
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import asyncio
|
|
2
|
+
import json
|
|
2
3
|
import logging
|
|
3
4
|
from functools import partial
|
|
4
|
-
from urllib.parse import
|
|
5
|
+
from urllib.parse import urlparse
|
|
5
6
|
|
|
6
|
-
from aiohttp import ClientError, ClientResponseError
|
|
7
7
|
from bandersnatch.configuration import BandersnatchConfig
|
|
8
8
|
from bandersnatch.master import Master
|
|
9
9
|
from bandersnatch.mirror import Mirror
|
|
10
|
-
from lxml.etree import LxmlError
|
|
11
10
|
from packaging.requirements import Requirement
|
|
12
|
-
from pypi_simple import IndexPage
|
|
11
|
+
from pypi_simple import ACCEPT_ANY, IndexPage, UnsupportedContentTypeError
|
|
13
12
|
|
|
14
13
|
from pulpcore.plugin.download import HttpDownloader
|
|
15
14
|
from pulpcore.plugin.exceptions import SyncError
|
|
@@ -29,6 +28,7 @@ from pulp_python.app.models import (
|
|
|
29
28
|
PythonRemote,
|
|
30
29
|
)
|
|
31
30
|
from pulp_python.app.provenance import Provenance
|
|
31
|
+
from pulp_python.app.tasks.vulnerability_report import dispatch_scan
|
|
32
32
|
from pulp_python.app.utils import PYPI_LAST_SERIAL, aget_remote_simple_page, parse_metadata
|
|
33
33
|
|
|
34
34
|
logger = logging.getLogger(__name__)
|
|
@@ -56,7 +56,9 @@ def sync(remote_pk, repository_pk, mirror):
|
|
|
56
56
|
raise SyncError("A remote must have a url attribute to sync.")
|
|
57
57
|
|
|
58
58
|
first_stage = PythonBanderStage(remote)
|
|
59
|
-
DeclarativeVersion(first_stage, repository, mirror).create()
|
|
59
|
+
new_version = DeclarativeVersion(first_stage, repository, mirror).create()
|
|
60
|
+
if new_version and remote.vulnerabilities:
|
|
61
|
+
dispatch_scan(repository, new_version)
|
|
60
62
|
|
|
61
63
|
|
|
62
64
|
def create_bandersnatch_config(remote):
|
|
@@ -169,41 +171,34 @@ class PulpMirror(Mirror):
|
|
|
169
171
|
|
|
170
172
|
async def determine_packages_to_sync(self):
|
|
171
173
|
"""
|
|
172
|
-
|
|
173
|
-
so try to get all of the packages from Mirror (hopefully PyPi)
|
|
174
|
+
Called when includes wasn't specified. List all projects from the remote's simple index.
|
|
174
175
|
"""
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
176
|
+
logger.info("Syncing all packages from %s", self.master.url)
|
|
177
|
+
url = f"{self.remote.url.rstrip('/')}/simple/"
|
|
178
|
+
downloader = self.remote.get_downloader(url=url)
|
|
179
|
+
result = await downloader.run(
|
|
180
|
+
extra_data={"request_kwargs": {"headers": {"Accept": ACCEPT_ANY}}}
|
|
181
|
+
)
|
|
182
|
+
|
|
183
|
+
content_type = result.headers.get("Content-Type", "text/html").partition(";")[0].lower()
|
|
184
|
+
with open(result.path, "rb") as f:
|
|
185
|
+
content = f.read()
|
|
186
|
+
|
|
187
|
+
if content_type == "application/vnd.pypi.simple.v1+json":
|
|
188
|
+
index = IndexPage.from_json_data(json.loads(content))
|
|
189
|
+
elif content_type in {"application/vnd.pypi.simple.v1+html", "text/html"}:
|
|
190
|
+
index = IndexPage.from_html(content)
|
|
191
|
+
else:
|
|
192
|
+
raise UnsupportedContentTypeError(url, content_type)
|
|
193
|
+
|
|
194
|
+
self.packages_to_sync = {project: 0 for project in index.projects}
|
|
195
|
+
last_serial = index.last_serial
|
|
196
|
+
if last_serial is None:
|
|
197
|
+
last_serial = result.headers.get(PYPI_LAST_SERIAL)
|
|
198
|
+
if last_serial is None:
|
|
199
|
+
self.target_serial = self.synced_serial
|
|
198
200
|
else:
|
|
199
|
-
|
|
200
|
-
url = urljoin(self.remote.url, "simple/")
|
|
201
|
-
downloader = self.remote.get_downloader(url=url)
|
|
202
|
-
result = await downloader.run()
|
|
203
|
-
with open(result.path) as f:
|
|
204
|
-
index = IndexPage.from_html(f.read())
|
|
205
|
-
self.packages_to_sync.update({p: 0 for p in index.projects})
|
|
206
|
-
self.target_serial = result.headers.get(PYPI_LAST_SERIAL, 0)
|
|
201
|
+
self.target_serial = max(self.synced_serial, int(last_serial))
|
|
207
202
|
|
|
208
203
|
self._filter_packages()
|
|
209
204
|
if self.target_serial:
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from pulpcore.plugin.models import RepositoryVersion
|
|
2
2
|
from pulpcore.plugin.sync import sync_to_async_iterable
|
|
3
|
+
from pulpcore.plugin.tasking import check_content, dispatch
|
|
3
4
|
|
|
4
5
|
from pulp_python.app.models import PythonPackageContent
|
|
5
6
|
|
|
@@ -28,3 +29,13 @@ def _build_osv_data(name, ecosystem, version=None):
|
|
|
28
29
|
if version:
|
|
29
30
|
osv_data["version"] = version
|
|
30
31
|
return osv_data
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def dispatch_scan(repository, repository_version):
|
|
35
|
+
"""Dispatch a vulnerability scan for a repository version."""
|
|
36
|
+
func = f"{get_repo_version_content.__module__}.{get_repo_version_content.__name__}"
|
|
37
|
+
return dispatch(
|
|
38
|
+
check_content,
|
|
39
|
+
shared_resources=[repository],
|
|
40
|
+
args=[func, [str(repository_version.pk)]],
|
|
41
|
+
)
|
|
@@ -21,9 +21,11 @@ from packaging.version import InvalidVersion, parse
|
|
|
21
21
|
from pypi_simple import ACCEPT_JSON_PREFERRED, ProjectPage
|
|
22
22
|
|
|
23
23
|
from pulpcore.plugin.exceptions import TimeoutException
|
|
24
|
-
from pulpcore.plugin.models import Artifact, Remote
|
|
24
|
+
from pulpcore.plugin.models import Artifact, Remote, VulnerabilityReport
|
|
25
25
|
from pulpcore.plugin.util import get_domain
|
|
26
26
|
|
|
27
|
+
from pulp_python.app.osv import osv_to_pypi_vulnerabilities
|
|
28
|
+
|
|
27
29
|
log = logging.getLogger(__name__)
|
|
28
30
|
|
|
29
31
|
|
|
@@ -377,6 +379,7 @@ def python_content_to_json(
|
|
|
377
379
|
last_serial: int
|
|
378
380
|
releases: Dict
|
|
379
381
|
urls: Dict
|
|
382
|
+
vulnerabilities: List
|
|
380
383
|
|
|
381
384
|
Returns None if version is specified but not found within content_query
|
|
382
385
|
"""
|
|
@@ -407,9 +410,27 @@ def python_content_to_json(
|
|
|
407
410
|
full_metadata["info"] = python_content_to_info(latest_content[0])
|
|
408
411
|
full_metadata["releases"] = python_content_to_releases(all_content, base_path, domain)
|
|
409
412
|
full_metadata["urls"] = python_content_to_urls(latest_content, base_path, domain)
|
|
413
|
+
full_metadata["vulnerabilities"] = _vulnerabilities_for_content(
|
|
414
|
+
latest_content, repository_version
|
|
415
|
+
)
|
|
410
416
|
return full_metadata
|
|
411
417
|
|
|
412
418
|
|
|
419
|
+
def _vulnerabilities_for_content(contents, repository_version=None):
|
|
420
|
+
"""Load VulnerabilityReports scanned for this repository version and trim to Warehouse shape."""
|
|
421
|
+
if not contents or repository_version is None:
|
|
422
|
+
return []
|
|
423
|
+
reports = VulnerabilityReport.objects.filter(
|
|
424
|
+
content_id__in=[c.pk for c in contents],
|
|
425
|
+
repo_versions=repository_version,
|
|
426
|
+
)
|
|
427
|
+
merged = []
|
|
428
|
+
for vulns in reports.values_list("vulns", flat=True):
|
|
429
|
+
if vulns:
|
|
430
|
+
merged.extend(vulns)
|
|
431
|
+
return osv_to_pypi_vulnerabilities(merged)
|
|
432
|
+
|
|
433
|
+
|
|
413
434
|
def latest_content_version(all_content, version):
|
|
414
435
|
"""
|
|
415
436
|
Walks through the content list and finds the instances that are the latest version.
|
|
@@ -26,7 +26,7 @@ from pulpcore.plugin.serializers import (
|
|
|
26
26
|
RepositoryAddRemoveContentSerializer,
|
|
27
27
|
RepositorySyncURLSerializer,
|
|
28
28
|
)
|
|
29
|
-
from pulpcore.plugin.tasking import
|
|
29
|
+
from pulpcore.plugin.tasking import dispatch
|
|
30
30
|
from pulpcore.plugin.util import extract_pk
|
|
31
31
|
|
|
32
32
|
from pulp_python.app import models as python_models
|
|
@@ -356,14 +356,7 @@ class PythonRepositoryVersionViewSet(core_viewsets.RepositoryVersionViewSet):
|
|
|
356
356
|
Scan a repository version for vulnerabilities.
|
|
357
357
|
"""
|
|
358
358
|
repository_version = self.get_object()
|
|
359
|
-
|
|
360
|
-
f"{tasks.get_repo_version_content.__module__}.{tasks.get_repo_version_content.__name__}"
|
|
361
|
-
)
|
|
362
|
-
task = dispatch(
|
|
363
|
-
check_content,
|
|
364
|
-
shared_resources=[repository_version.repository],
|
|
365
|
-
args=[func, [repository_version.pk]],
|
|
366
|
-
)
|
|
359
|
+
task = tasks.dispatch_scan(repository_version.repository, repository_version)
|
|
367
360
|
return core_viewsets.OperationPostponedResponse(task, request)
|
|
368
361
|
|
|
369
362
|
|
{pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/tests/functional/api/test_download_content.py
RENAMED
|
@@ -48,7 +48,7 @@ def test_full_fixtures_to_pulp_sync(
|
|
|
48
48
|
):
|
|
49
49
|
"""
|
|
50
50
|
This test checks that Pulp can fully sync another Python Package repository that is not
|
|
51
|
-
PyPI. This
|
|
51
|
+
PyPI. This lists projects from the remote's Simple API index.
|
|
52
52
|
"""
|
|
53
53
|
# Repository we are syncing from is the fixtures (default url)
|
|
54
54
|
remote = python_remote_factory(includes=[], prereleases=True)
|
{pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/tests/functional/api/test_pypi_apis.py
RENAMED
|
@@ -324,6 +324,7 @@ def assert_pypi_json(package):
|
|
|
324
324
|
package["releases"][version],
|
|
325
325
|
"Failed to match version",
|
|
326
326
|
)
|
|
327
|
+
assert package["vulnerabilities"] == []
|
|
327
328
|
|
|
328
329
|
|
|
329
330
|
def assert_download_info(expected, received, message="Failed to match"):
|
|
@@ -377,6 +378,8 @@ def test_upload_time_reflects_repo_addition(
|
|
|
377
378
|
# JSON API
|
|
378
379
|
json_resp = requests.get(urljoin(distro.base_url, "pypi/twine/json"))
|
|
379
380
|
assert json_resp.status_code == 200
|
|
380
|
-
|
|
381
|
+
package = json_resp.json()
|
|
382
|
+
json_time = datetime.fromisoformat(package["urls"][0]["upload_time"])
|
|
381
383
|
assert json_time > content_created
|
|
382
384
|
assert json_time == simple_time
|
|
385
|
+
assert package["vulnerabilities"] == []
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
from urllib.parse import urljoin, urlsplit
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
import requests
|
|
5
|
+
|
|
6
|
+
from pulp_python.tests.functional.constants import (
|
|
7
|
+
PYPI_URL,
|
|
8
|
+
VULNERABILITY_REPORT_TEST_PACKAGE_NAME,
|
|
9
|
+
VULNERABILITY_REPORT_TEST_PACKAGES,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
WAREHOUSE_VULN_KEYS = {
|
|
13
|
+
"id",
|
|
14
|
+
"source",
|
|
15
|
+
"link",
|
|
16
|
+
"aliases",
|
|
17
|
+
"details",
|
|
18
|
+
"summary",
|
|
19
|
+
"fixed_in",
|
|
20
|
+
"withdrawn",
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def _index_url(distro, bindings_cfg):
|
|
25
|
+
"""Build the index URL using the same origin the API client uses."""
|
|
26
|
+
path = urlsplit(distro.base_url).path
|
|
27
|
+
if not path.endswith("/"):
|
|
28
|
+
path += "/"
|
|
29
|
+
return bindings_cfg.host.rstrip("/") + path
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _wait_for_child_tasks(pulpcore_bindings, monitor_task, parent_task):
|
|
33
|
+
parent = pulpcore_bindings.TasksApi.read(parent_task.pulp_href)
|
|
34
|
+
children = parent.child_tasks or []
|
|
35
|
+
assert children, "expected a follow-up vulnerability scan task"
|
|
36
|
+
for child in children:
|
|
37
|
+
href = child if isinstance(child, str) else child.pulp_href
|
|
38
|
+
monitor_task(href)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def _assert_warehouse_vulnerabilities(package):
|
|
42
|
+
vulns = package["vulnerabilities"]
|
|
43
|
+
assert vulns
|
|
44
|
+
ids = [vuln["id"] for vuln in vulns]
|
|
45
|
+
assert len(ids) == len(set(ids))
|
|
46
|
+
for vuln in vulns:
|
|
47
|
+
assert WAREHOUSE_VULN_KEYS <= vuln.keys()
|
|
48
|
+
assert vuln["source"] == "osv"
|
|
49
|
+
assert vuln["id"]
|
|
50
|
+
assert vuln["link"] == f"https://osv.dev/vulnerability/{vuln['id']}"
|
|
51
|
+
assert isinstance(vuln["aliases"], list)
|
|
52
|
+
assert isinstance(vuln["fixed_in"], list)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
@pytest.mark.parallel
|
|
56
|
+
def test_pypi_json_vulnerabilities_from_manual_scan(
|
|
57
|
+
bindings_cfg,
|
|
58
|
+
pulpcore_bindings,
|
|
59
|
+
python_bindings,
|
|
60
|
+
python_remote_factory,
|
|
61
|
+
python_repo,
|
|
62
|
+
python_repo_factory,
|
|
63
|
+
python_distribution_factory,
|
|
64
|
+
monitor_task,
|
|
65
|
+
):
|
|
66
|
+
"""A remote without vulnerabilities does not scan; a later scan fills the JSON API."""
|
|
67
|
+
remote = python_remote_factory(url=PYPI_URL, includes=VULNERABILITY_REPORT_TEST_PACKAGES)
|
|
68
|
+
sync_task = monitor_task(
|
|
69
|
+
python_bindings.RepositoriesPythonApi.sync(
|
|
70
|
+
python_repo.pulp_href, dict(remote=remote.pulp_href)
|
|
71
|
+
).task
|
|
72
|
+
)
|
|
73
|
+
assert not sync_task.child_tasks
|
|
74
|
+
|
|
75
|
+
repo = python_bindings.RepositoriesPythonApi.read(python_repo.pulp_href)
|
|
76
|
+
distro = python_distribution_factory(repository=repo)
|
|
77
|
+
name = VULNERABILITY_REPORT_TEST_PACKAGE_NAME.lower()
|
|
78
|
+
index = _index_url(distro, bindings_cfg)
|
|
79
|
+
version_url = urljoin(index, f"pypi/{name}/5.2.1/json")
|
|
80
|
+
project_url = urljoin(index, f"pypi/{name}/json")
|
|
81
|
+
|
|
82
|
+
scan_task = python_bindings.RepositoriesPythonVersionsApi.scan(repo.latest_version_href)
|
|
83
|
+
monitor_task(scan_task.task)
|
|
84
|
+
|
|
85
|
+
project = requests.get(project_url).json()
|
|
86
|
+
version = requests.get(version_url).json()
|
|
87
|
+
_assert_warehouse_vulnerabilities(project)
|
|
88
|
+
_assert_warehouse_vulnerabilities(version)
|
|
89
|
+
assert [v["id"] for v in project["vulnerabilities"]] == [
|
|
90
|
+
v["id"] for v in version["vulnerabilities"]
|
|
91
|
+
]
|
|
92
|
+
|
|
93
|
+
packages = python_bindings.ContentPackagesApi.list(
|
|
94
|
+
name=VULNERABILITY_REPORT_TEST_PACKAGE_NAME,
|
|
95
|
+
repository_version=repo.latest_version_href,
|
|
96
|
+
)
|
|
97
|
+
assert packages.count >= 2
|
|
98
|
+
hrefs = []
|
|
99
|
+
for content in packages.results:
|
|
100
|
+
assert content.vuln_report is not None
|
|
101
|
+
report = pulpcore_bindings.VulnReportApi.read(content.vuln_report)
|
|
102
|
+
assert report.vulns
|
|
103
|
+
assert "affected" in report.vulns[0]
|
|
104
|
+
hrefs.append(content.pulp_href)
|
|
105
|
+
|
|
106
|
+
other = python_repo_factory()
|
|
107
|
+
monitor_task(
|
|
108
|
+
python_bindings.RepositoriesPythonApi.modify(
|
|
109
|
+
other.pulp_href, {"add_content_units": hrefs}
|
|
110
|
+
).task
|
|
111
|
+
)
|
|
112
|
+
other = python_bindings.RepositoriesPythonApi.read(other.pulp_href)
|
|
113
|
+
other_distro = python_distribution_factory(repository=other)
|
|
114
|
+
other_json = requests.get(
|
|
115
|
+
urljoin(_index_url(other_distro, bindings_cfg), f"pypi/{name}/json")
|
|
116
|
+
).json()
|
|
117
|
+
assert other_json["vulnerabilities"] == []
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
@pytest.mark.parallel
|
|
121
|
+
def test_sync_dispatches_vulnerability_scan(
|
|
122
|
+
bindings_cfg,
|
|
123
|
+
pulpcore_bindings,
|
|
124
|
+
python_bindings,
|
|
125
|
+
python_remote_factory,
|
|
126
|
+
python_repo,
|
|
127
|
+
python_distribution_factory,
|
|
128
|
+
monitor_task,
|
|
129
|
+
):
|
|
130
|
+
"""A remote with vulnerabilities=True scans the new repository version after sync."""
|
|
131
|
+
remote = python_remote_factory(
|
|
132
|
+
url=PYPI_URL,
|
|
133
|
+
includes=VULNERABILITY_REPORT_TEST_PACKAGES,
|
|
134
|
+
vulnerabilities=True,
|
|
135
|
+
)
|
|
136
|
+
sync_task = monitor_task(
|
|
137
|
+
python_bindings.RepositoriesPythonApi.sync(
|
|
138
|
+
python_repo.pulp_href, dict(remote=remote.pulp_href)
|
|
139
|
+
).task
|
|
140
|
+
)
|
|
141
|
+
_wait_for_child_tasks(pulpcore_bindings, monitor_task, sync_task)
|
|
142
|
+
|
|
143
|
+
repo = python_bindings.RepositoriesPythonApi.read(python_repo.pulp_href)
|
|
144
|
+
distro = python_distribution_factory(repository=repo)
|
|
145
|
+
name = VULNERABILITY_REPORT_TEST_PACKAGE_NAME.lower()
|
|
146
|
+
package = requests.get(urljoin(_index_url(distro, bindings_cfg), f"pypi/{name}/json")).json()
|
|
147
|
+
_assert_warehouse_vulnerabilities(package)
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
@pytest.mark.parallel
|
|
151
|
+
def test_uploaded_package_json_vulnerabilities_empty_until_scan(
|
|
152
|
+
bindings_cfg,
|
|
153
|
+
python_bindings,
|
|
154
|
+
python_content_factory,
|
|
155
|
+
python_repo_factory,
|
|
156
|
+
python_distribution_factory,
|
|
157
|
+
monitor_task,
|
|
158
|
+
):
|
|
159
|
+
"""Uploaded packages have an empty vulnerabilities list until a scan runs."""
|
|
160
|
+
repo = python_repo_factory()
|
|
161
|
+
python_content_factory(repository=repo)
|
|
162
|
+
distro = python_distribution_factory(repository=repo)
|
|
163
|
+
url = urljoin(_index_url(distro, bindings_cfg), "pypi/shelf-reader/json")
|
|
164
|
+
|
|
165
|
+
package = requests.get(url).json()
|
|
166
|
+
assert package["vulnerabilities"] == []
|
|
167
|
+
|
|
168
|
+
repo = python_bindings.RepositoriesPythonApi.read(repo.pulp_href)
|
|
169
|
+
monitor_task(python_bindings.RepositoriesPythonVersionsApi.scan(repo.latest_version_href).task)
|
|
170
|
+
package = requests.get(url).json()
|
|
171
|
+
assert isinstance(package["vulnerabilities"], list)
|
|
@@ -28,21 +28,18 @@ def test_vulnerability_report(
|
|
|
28
28
|
)
|
|
29
29
|
monitor_task(response.task)
|
|
30
30
|
|
|
31
|
-
# checks
|
|
32
|
-
vulns_list = pulpcore_bindings.VulnReportApi.list()
|
|
33
|
-
assert len(vulns_list.results) > 0
|
|
34
|
-
for results in vulns_list.results:
|
|
35
|
-
assert len(results.vulns) > 0
|
|
36
|
-
for vuln in results.vulns:
|
|
37
|
-
assert VULNERABILITY_REPORT_TEST_PACKAGE_NAME.lower() in (
|
|
38
|
-
affected["package"]["name"] for affected in vuln["affected"]
|
|
39
|
-
)
|
|
40
|
-
|
|
41
31
|
repo_version = python_bindings.RepositoriesPythonVersionsApi.read(latest_version_href)
|
|
42
32
|
assert repo_version.vuln_report is not None
|
|
43
33
|
|
|
44
34
|
python_packages = python_bindings.ContentPackagesApi.list(
|
|
45
35
|
name=VULNERABILITY_REPORT_TEST_PACKAGE_NAME, repository_version=latest_version_href
|
|
46
36
|
)
|
|
37
|
+
assert python_packages.count > 0
|
|
47
38
|
for content in python_packages.results:
|
|
48
39
|
assert content.vuln_report is not None
|
|
40
|
+
report = pulpcore_bindings.VulnReportApi.read(content.vuln_report)
|
|
41
|
+
assert len(report.vulns) > 0
|
|
42
|
+
for vuln in report.vulns:
|
|
43
|
+
assert VULNERABILITY_REPORT_TEST_PACKAGE_NAME.lower() in (
|
|
44
|
+
affected["package"]["name"] for affected in vuln["affected"]
|
|
45
|
+
)
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
from pulp_python.app.osv import osv_to_pypi_vulnerabilities
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def test_osv_to_pypi_maps_fixed_versions_and_skips_git_shas():
|
|
5
|
+
vulns = [
|
|
6
|
+
{
|
|
7
|
+
"id": "PYSEC-2020-35",
|
|
8
|
+
"aliases": ["CVE-2020-7471"],
|
|
9
|
+
"details": "SQL injection",
|
|
10
|
+
"summary": None,
|
|
11
|
+
"withdrawn": None,
|
|
12
|
+
"affected": [
|
|
13
|
+
{
|
|
14
|
+
"package": {"name": "django", "ecosystem": "PyPI"},
|
|
15
|
+
"ranges": [
|
|
16
|
+
{
|
|
17
|
+
"type": "ECOSYSTEM",
|
|
18
|
+
"events": [
|
|
19
|
+
{"introduced": "3.0"},
|
|
20
|
+
{"fixed": "3.0.3"},
|
|
21
|
+
{"fixed": "eb31d845323618d688ad429479c6dda973056136"},
|
|
22
|
+
],
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
result = osv_to_pypi_vulnerabilities(vulns)
|
|
31
|
+
|
|
32
|
+
assert result == [
|
|
33
|
+
{
|
|
34
|
+
"id": "PYSEC-2020-35",
|
|
35
|
+
"source": "osv",
|
|
36
|
+
"link": "https://osv.dev/vulnerability/PYSEC-2020-35",
|
|
37
|
+
"aliases": ["CVE-2020-7471"],
|
|
38
|
+
"details": "SQL injection",
|
|
39
|
+
"summary": None,
|
|
40
|
+
"fixed_in": ["3.0.3"],
|
|
41
|
+
"withdrawn": None,
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def test_osv_to_pypi_deduplicates_by_id():
|
|
47
|
+
vulns = [
|
|
48
|
+
{"id": "GHSA-aaaa", "aliases": ["CVE-1"], "details": "first"},
|
|
49
|
+
{"id": "GHSA-aaaa", "aliases": ["CVE-1"], "details": "duplicate"},
|
|
50
|
+
{"id": "GHSA-bbbb", "aliases": [], "details": "other"},
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
result = osv_to_pypi_vulnerabilities(vulns)
|
|
54
|
+
|
|
55
|
+
assert [v["id"] for v in result] == ["GHSA-aaaa", "GHSA-bbbb"]
|
|
56
|
+
assert result[0]["details"] == "first"
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def test_osv_to_pypi_preserves_withdrawn_and_missing_summary():
|
|
60
|
+
vulns = [
|
|
61
|
+
{
|
|
62
|
+
"id": "PYSEC-2022-XXX",
|
|
63
|
+
"aliases": ["CVE-2022-XXXXX"],
|
|
64
|
+
"details": "A long description.",
|
|
65
|
+
"withdrawn": "2022-06-28T16:39:06Z",
|
|
66
|
+
"affected": [
|
|
67
|
+
{
|
|
68
|
+
"ranges": [{"events": [{"fixed": "1.2.3"}]}],
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
|
|
74
|
+
result = osv_to_pypi_vulnerabilities(vulns)
|
|
75
|
+
|
|
76
|
+
assert result[0]["summary"] is None
|
|
77
|
+
assert result[0]["withdrawn"] == "2022-06-28T16:39:06Z"
|
|
78
|
+
assert result[0]["fixed_in"] == ["1.2.3"]
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def test_osv_to_pypi_empty_and_missing_ids():
|
|
82
|
+
assert osv_to_pypi_vulnerabilities(None) == []
|
|
83
|
+
assert osv_to_pypi_vulnerabilities([]) == []
|
|
84
|
+
assert osv_to_pypi_vulnerabilities([{"details": "no id"}]) == []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pulp-python
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.37.1
|
|
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
|
|
@@ -14,15 +14,14 @@ Classifier: Development Status :: 5 - Production/Stable
|
|
|
14
14
|
Classifier: Framework :: Django
|
|
15
15
|
Classifier: Programming Language :: Python
|
|
16
16
|
Classifier: Programming Language :: Python :: 3
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
18
17
|
Classifier: Programming Language :: Python :: 3.12
|
|
19
18
|
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
-
Requires-Python: >=3.
|
|
19
|
+
Requires-Python: >=3.12
|
|
21
20
|
Description-Content-Type: text/markdown
|
|
22
21
|
License-File: LICENSE
|
|
23
22
|
Requires-Dist: pulpcore<3.130,>=3.105.0
|
|
24
23
|
Requires-Dist: pkginfo<1.13.0,>=1.12.0
|
|
25
|
-
Requires-Dist: bandersnatch<
|
|
24
|
+
Requires-Dist: bandersnatch<8.1,>=8.0.0
|
|
26
25
|
Requires-Dist: pypi-simple<2.0,>=1.8.0
|
|
27
26
|
Requires-Dist: pypi-attestations==0.0.28
|
|
28
27
|
Dynamic: license-file
|
|
@@ -22,6 +22,7 @@ pulp_python/app/exceptions.py
|
|
|
22
22
|
pulp_python/app/global_access_conditions.py
|
|
23
23
|
pulp_python/app/modelresource.py
|
|
24
24
|
pulp_python/app/models.py
|
|
25
|
+
pulp_python/app/osv.py
|
|
25
26
|
pulp_python/app/provenance.py
|
|
26
27
|
pulp_python/app/replica.py
|
|
27
28
|
pulp_python/app/serializers.py
|
|
@@ -57,6 +58,7 @@ pulp_python/app/migrations/0021_pythonrepository_upload_duplicate_filenames.py
|
|
|
57
58
|
pulp_python/app/migrations/0022_pythonblocklistentry.py
|
|
58
59
|
pulp_python/app/migrations/0023_packageyank.py
|
|
59
60
|
pulp_python/app/migrations/0024_pythonrepository_error_on_reject.py
|
|
61
|
+
pulp_python/app/migrations/0025_pythonremote_vulnerabilities.py
|
|
60
62
|
pulp_python/app/migrations/__init__.py
|
|
61
63
|
pulp_python/app/pypi/__init__.py
|
|
62
64
|
pulp_python/app/pypi/feeds.py
|
|
@@ -90,6 +92,7 @@ pulp_python/tests/functional/api/test_export_import.py
|
|
|
90
92
|
pulp_python/tests/functional/api/test_full_mirror.py
|
|
91
93
|
pulp_python/tests/functional/api/test_pypi_apis.py
|
|
92
94
|
pulp_python/tests/functional/api/test_pypi_feeds.py
|
|
95
|
+
pulp_python/tests/functional/api/test_pypi_json_vulnerabilities.py
|
|
93
96
|
pulp_python/tests/functional/api/test_pypi_simple_api.py
|
|
94
97
|
pulp_python/tests/functional/api/test_rbac.py
|
|
95
98
|
pulp_python/tests/functional/api/test_repair.py
|
|
@@ -101,4 +104,5 @@ pulp_python/tests/functional/api/test_vulnerability_report.py
|
|
|
101
104
|
pulp_python/tests/functional/api/test_yank.py
|
|
102
105
|
pulp_python/tests/unit/__init__.py
|
|
103
106
|
pulp_python/tests/unit/test_feeds.py
|
|
104
|
-
pulp_python/tests/unit/test_models.py
|
|
107
|
+
pulp_python/tests/unit/test_models.py
|
|
108
|
+
pulp_python/tests/unit/test_vulnerabilities.py
|
|
@@ -7,7 +7,7 @@ build-backend = 'setuptools.build_meta'
|
|
|
7
7
|
|
|
8
8
|
[project]
|
|
9
9
|
name = "pulp-python"
|
|
10
|
-
version = "3.
|
|
10
|
+
version = "3.37.1"
|
|
11
11
|
description = "pulp-python plugin for the Pulp Project"
|
|
12
12
|
readme = "README.md"
|
|
13
13
|
authors = [
|
|
@@ -20,15 +20,14 @@ classifiers=[
|
|
|
20
20
|
"Framework :: Django",
|
|
21
21
|
"Programming Language :: Python",
|
|
22
22
|
"Programming Language :: Python :: 3",
|
|
23
|
-
"Programming Language :: Python :: 3.11",
|
|
24
23
|
"Programming Language :: Python :: 3.12",
|
|
25
24
|
"Programming Language :: Python :: 3.13",
|
|
26
25
|
]
|
|
27
|
-
requires-python = ">=3.
|
|
26
|
+
requires-python = ">=3.12"
|
|
28
27
|
dependencies = [
|
|
29
28
|
"pulpcore>=3.105.0,<3.130",
|
|
30
29
|
"pkginfo>=1.12.0,<1.13.0",
|
|
31
|
-
"bandersnatch>=
|
|
30
|
+
"bandersnatch>=8.0.0,<8.1",
|
|
32
31
|
"pypi-simple>=1.8.0,<2.0",
|
|
33
32
|
"pypi-attestations==0.0.28", # API is not stable
|
|
34
33
|
]
|
|
@@ -79,7 +78,7 @@ ignore = [
|
|
|
79
78
|
[tool.bumpversion]
|
|
80
79
|
# This section is managed by the plugin template. Do not edit manually.
|
|
81
80
|
|
|
82
|
-
current_version = "3.
|
|
81
|
+
current_version = "3.37.1"
|
|
83
82
|
commit = false
|
|
84
83
|
tag = false
|
|
85
84
|
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<alpha>0a)?(?P<patch>\\d+)(\\.(?P<release>[a-z]+))?"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/migrations/0003_new_sync_filters.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/migrations/0010_update_json_field.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/migrations/0013_add_rbac_permissions.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/migrations/0018_packageprovenance.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/app/migrations/0022_pythonblocklistentry.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/tests/functional/api/test_attestations.py
RENAMED
|
File without changes
|
{pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/tests/functional/api/test_auto_publish.py
RENAMED
|
File without changes
|
{pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/tests/functional/api/test_blocklist.py
RENAMED
|
File without changes
|
{pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/tests/functional/api/test_consume_content.py
RENAMED
|
File without changes
|
{pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/tests/functional/api/test_crud_content_unit.py
RENAMED
|
File without changes
|
{pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/tests/functional/api/test_crud_publications.py
RENAMED
|
File without changes
|
{pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/tests/functional/api/test_crud_remotes.py
RENAMED
|
File without changes
|
|
File without changes
|
{pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/tests/functional/api/test_export_import.py
RENAMED
|
File without changes
|
{pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/tests/functional/api/test_full_mirror.py
RENAMED
|
File without changes
|
{pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/tests/functional/api/test_pypi_feeds.py
RENAMED
|
File without changes
|
{pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/tests/functional/api/test_pypi_simple_api.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pulp_python-3.36.4 → pulp_python-3.37.1}/pulp_python/tests/functional/api/test_simple_cache.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|