Skip to content

Commit

Permalink
attestations: allow upload of SLSA provenances (#17121)
Browse files Browse the repository at this point in the history
Signed-off-by: Facundo Tuesca <facundo.tuesca@trailofbits.com>
Co-authored-by: Dustin Ingram <di@users.noreply.github.com>
  • Loading branch information
facutuesca and di authored Nov 19, 2024
1 parent 1de7977 commit dde8b3d
Showing 1 changed file with 7 additions and 1 deletion.
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

0 comments on commit dde8b3d

Please sign in to comment.