Skip to content

Commit 9235d1f

Browse files
committed
Inherit upstream Attestation to keep Sigstore path
1 parent 4714f77 commit 9235d1f

1 file changed

Lines changed: 8 additions & 17 deletions

File tree

pulp_python/app/provenance.py

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,8 @@
1010
from django.conf import settings
1111
from pydantic import BaseModel, ConfigDict, Field
1212
from pydantic.alias_generators import to_snake
13-
from pypi_attestations import (
14-
Distribution,
15-
Envelope,
16-
Publisher,
17-
VerificationError,
18-
VerificationMaterial,
19-
)
13+
from pypi_attestations import Attestation as _UpstreamAttestation
14+
from pypi_attestations import Distribution, Publisher, VerificationError, VerificationMaterial
2015
from sigstore.dsse import Envelope as DSSEEnvelope
2116
from sigstore.dsse import _pae
2217

@@ -57,24 +52,20 @@ def _as_policy(self):
5752
ExtendedPublisher = Annotated[_ExtendedPublisherUnion, Field(union_mode="left_to_right")]
5853

5954

60-
class Attestation(BaseModel):
61-
"""Attestation object as defined in PEP 740."""
62-
63-
version: Literal[1]
55+
class Attestation(_UpstreamAttestation):
6456
"""
65-
The attestation format's version, which is always 1.
57+
Attestation object as defined in PEP 740.
58+
59+
Inherits from the upstream pypi_attestations.Attestation to keep Sigstore
60+
verification methods (to_bundle, verify), but makes verification_material
61+
optional to support attestations signed with a custom key instead of Sigstore.
6662
"""
6763

6864
verification_material: VerificationMaterial | None = None
6965
"""
7066
Cryptographic materials used to verify `message_signature`.
7167
"""
7268

73-
envelope: Envelope
74-
"""
75-
The enveloped attestation statement and signature.
76-
"""
77-
7869

7970
class AttestationBundle(BaseModel):
8071
"""

0 commit comments

Comments
 (0)