@@ -76,13 +76,22 @@ class TestAttestation:
7676 @online
7777 def test_roundtrip (self , id_token : IdentityToken ) -> None :
7878 trust_config = ClientTrustConfig .staging ()
79+ # Make sure we choose the rekor version: currently v1
80+ trust_config .force_tlog_version = 1
7981 sign_ctx = SigningContext .from_trust_config (trust_config )
8082
8183 with sign_ctx .signer (id_token ) as signer :
8284 attestation = impl .Attestation .sign (signer , dist )
8385
8486 attestation .verify (policy .UnsafeNoOp (), dist , staging = True )
8587
88+ # ensure we only produce attestations with rekor v1 entries for now:
89+ for entry in attestation .verification_material .transparency_entries :
90+ assert entry ["kindVersion" ] == {
91+ "kind" : "dsse" ,
92+ "version" : "0.0.1"
93+ }
94+
8695 # converting to a bundle and verifying as a bundle also works
8796 bundle = attestation .to_bundle ()
8897 Verifier .staging ().verify_dsse (bundle , policy .UnsafeNoOp ())
@@ -111,6 +120,8 @@ def in_validity_period(_: IdentityToken) -> bool:
111120 monkeypatch .setattr (IdentityToken , "in_validity_period" , in_validity_period )
112121
113122 trust_config = ClientTrustConfig .staging ()
123+ # Make sure we choose the rekor version: currently v1
124+ trust_config .force_tlog_version = 1
114125 sign_ctx = SigningContext .from_trust_config (trust_config )
115126
116127 with sign_ctx .signer (id_token , cache = False ) as signer :
@@ -130,6 +141,8 @@ def get_bundle(*_: Any) -> Bundle:
130141 monkeypatch .setattr (sigstore .sign .Signer , "sign_dsse" , get_bundle )
131142
132143 trust_config = ClientTrustConfig .staging ()
144+ # Make sure we choose the rekor version: currently v1
145+ trust_config .force_tlog_version = 1
133146 sign_ctx = SigningContext .from_trust_config (trust_config )
134147
135148 with pytest .raises (impl .AttestationError ):
@@ -240,6 +253,9 @@ def test_verify_with_timestamp(self) -> None:
240253 Verifier .production (offline = True ).verify_dsse (bundle , policy .UnsafeNoOp ())
241254
242255 def test_verify_with_timestamp_and_rekor2_entry (self ) -> None :
256+ # Note that the pypi-attestations does not currently create attestatations with rekor2
257+ # entries. This test still asserts that verification works
258+
243259 # Our checked-in asset has this identity.
244260 pol = policy .Identity (identity = "jku@goto.fi" , issuer = "https://github.com/login/oauth" )
245261
0 commit comments