@@ -76,13 +76,19 @@ 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" ] == {"kind" : "dsse" , "version" : "0.0.1" }
91+
8692 # converting to a bundle and verifying as a bundle also works
8793 bundle = attestation .to_bundle ()
8894 Verifier .staging ().verify_dsse (bundle , policy .UnsafeNoOp ())
@@ -111,6 +117,8 @@ def in_validity_period(_: IdentityToken) -> bool:
111117 monkeypatch .setattr (IdentityToken , "in_validity_period" , in_validity_period )
112118
113119 trust_config = ClientTrustConfig .staging ()
120+ # Make sure we choose the rekor version: currently v1
121+ trust_config .force_tlog_version = 1
114122 sign_ctx = SigningContext .from_trust_config (trust_config )
115123
116124 with sign_ctx .signer (id_token , cache = False ) as signer :
@@ -130,6 +138,8 @@ def get_bundle(*_: Any) -> Bundle:
130138 monkeypatch .setattr (sigstore .sign .Signer , "sign_dsse" , get_bundle )
131139
132140 trust_config = ClientTrustConfig .staging ()
141+ # Make sure we choose the rekor version: currently v1
142+ trust_config .force_tlog_version = 1
133143 sign_ctx = SigningContext .from_trust_config (trust_config )
134144
135145 with pytest .raises (impl .AttestationError ):
@@ -240,6 +250,9 @@ def test_verify_with_timestamp(self) -> None:
240250 Verifier .production (offline = True ).verify_dsse (bundle , policy .UnsafeNoOp ())
241251
242252 def test_verify_with_timestamp_and_rekor2_entry (self ) -> None :
253+ # Note that the pypi-attestations does not currently create attestatations with rekor2
254+ # entries. This test still asserts that verification works
255+
243256 # Our checked-in asset has this identity.
244257 pol = policy .Identity (identity = "jku@goto.fi" , issuer = "https://github.com/login/oauth" )
245258
0 commit comments