Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

attestations: allow upload of SLSA provenances #17121

Merged
merged 2 commits into from
Nov 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion warehouse/attestations/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@
from warehouse.packaging.models import File


SUPPORTED_ATTESTATION_TYPES = {
AttestationType.PYPI_PUBLISH_V1,
AttestationType.SLSA_PROVENANCE_V1,
}


def _extract_attestations_from_request(request: Request) -> list[Attestation]:
"""
Extract well-formed attestation objects from the given request's payload.
Expand Down Expand Up @@ -177,7 +183,7 @@ def parse_attestations(
f"Unknown error while trying to verify included attestations: {e}",
)

if predicate_type != AttestationType.PYPI_PUBLISH_V1:
if predicate_type not in SUPPORTED_ATTESTATION_TYPES:
self.metrics.increment(
"warehouse.upload.attestations.failed_unsupported_predicate_type"
)
Expand Down