@@ -219,7 +219,11 @@ def verifier(self, asset) -> Verifier:
219
219
verifier ._trusted_root ._inner .timestamp_authorities = [authority ._inner ]
220
220
return verifier
221
221
222
- def test_verifier_verify_timestamp (self , verifier , asset , null_policy ):
222
+ def test_verifier_verify_timestamp (self , verifier , asset , null_policy , monkeypatch ):
223
+ # asset is a rekor v1 bundle: set threshold to 2 so both integrated time and the
224
+ # TSA timestamp are required
225
+ monkeypatch .setattr ("sigstore.verify.verifier.VERIFY_TIMESTAMP_THRESHOLD" , 2 )
226
+
223
227
verifier .verify_artifact (
224
228
asset ("tsa/bundle.txt" ).read_bytes (),
225
229
Bundle .from_json (asset ("tsa/bundle.txt.sigstore" ).read_bytes ()),
@@ -296,15 +300,21 @@ def test_verifier_duplicate_timestamp(self, verifier, asset, null_policy):
296
300
)
297
301
298
302
def test_verifier_outside_validity_range (
299
- self , caplog , verifier , asset , null_policy
303
+ self , caplog , verifier , asset , null_policy , monkeypatch
300
304
):
305
+ # asset is a rekor v1 bundle: set threshold to 2 so both integrated time and the
306
+ # TSA timestamp are required
307
+ monkeypatch .setattr ("sigstore.verify.verifier.VERIFY_TIMESTAMP_THRESHOLD" , 2 )
308
+
301
309
# Set a date before the timestamp range
302
310
verifier ._trusted_root .get_timestamp_authorities ()[
303
311
0
304
312
]._inner .valid_for .end = datetime (2024 , 10 , 31 , tzinfo = timezone .utc )
305
313
306
314
with caplog .at_level (logging .DEBUG , logger = "sigstore.verify.verifier" ):
307
- with pytest .raises (VerificationError , match = "not enough timestamps" ):
315
+ with pytest .raises (
316
+ VerificationError , match = "not enough sources of verified time"
317
+ ):
308
318
verifier .verify_artifact (
309
319
asset ("tsa/bundle.txt" ).read_bytes (),
310
320
Bundle .from_json (asset ("tsa/bundle.txt.sigstore" ).read_bytes ()),
@@ -319,13 +329,19 @@ def test_verifier_outside_validity_range(
319
329
def test_verifier_rfc3161_error (
320
330
self , verifier , asset , null_policy , caplog , monkeypatch
321
331
):
332
+ # asset is a rekor v1 bundle: set threshold to 2 so both integrated time and the
333
+ # TSA timestamp are required
334
+ monkeypatch .setattr ("sigstore.verify.verifier.VERIFY_TIMESTAMP_THRESHOLD" , 2 )
335
+
322
336
def verify_function (* args ):
323
337
raise rfc3161_client .VerificationError ()
324
338
325
339
monkeypatch .setattr (rfc3161_client .verify ._Verifier , "verify" , verify_function )
326
340
327
341
with caplog .at_level (logging .DEBUG , logger = "sigstore.verify.verifier" ):
328
- with pytest .raises (VerificationError , match = "not enough timestamps" ):
342
+ with pytest .raises (
343
+ VerificationError , match = "not enough sources of verified time"
344
+ ):
329
345
verifier .verify_artifact (
330
346
asset ("tsa/bundle.txt" ).read_bytes (),
331
347
Bundle .from_json (asset ("tsa/bundle.txt.sigstore" ).read_bytes ()),
@@ -345,15 +361,21 @@ def test_verifier_no_authorities(self, asset, null_policy):
345
361
null_policy ,
346
362
)
347
363
348
- def test_late_timestamp (self , caplog , verifier , asset , null_policy ):
364
+ def test_late_timestamp (self , caplog , verifier , asset , null_policy , monkeypatch ):
349
365
"""
350
366
Ensures that verifying the signing certificate fails because the timestamp
351
367
is outside the certificate's validity window. The sample bundle
352
368
"tsa/bundle.txt.late_timestamp.sigstore" was generated by adding `time.sleep(12*60)`
353
369
into `sigstore.sign.Signer._finalize_sign()`, just after the entry is posted to Rekor
354
370
but before the timestamp is requested.
355
371
"""
356
- with pytest .raises (VerificationError , match = "not enough timestamps" ):
372
+ # asset is a rekor v1 bundle: set threshold to 2 so both integrated time and the
373
+ # TSA timestamp are required
374
+ monkeypatch .setattr ("sigstore.verify.verifier.VERIFY_TIMESTAMP_THRESHOLD" , 2 )
375
+
376
+ with pytest .raises (
377
+ VerificationError , match = "not enough sources of verified time"
378
+ ):
357
379
verifier .verify_artifact (
358
380
asset ("tsa/bundle.txt" ).read_bytes (),
359
381
Bundle .from_json (
@@ -370,8 +392,12 @@ def test_late_timestamp(self, caplog, verifier, asset, null_policy):
370
392
def test_verifier_not_enough_timestamp (
371
393
self , verifier , asset , null_policy , monkeypatch
372
394
):
373
- monkeypatch .setattr ("sigstore.verify.verifier.VERIFY_TIMESTAMP_THRESHOLD" , 2 )
374
- with pytest .raises (VerificationError , match = "not enough timestamps" ):
395
+ # asset is a rekor v1 bundle: set threshold to 3 so integrated time and one
396
+ # TSA timestamp are not enough
397
+ monkeypatch .setattr ("sigstore.verify.verifier.VERIFY_TIMESTAMP_THRESHOLD" , 3 )
398
+ with pytest .raises (
399
+ VerificationError , match = "not enough sources of verified time"
400
+ ):
375
401
verifier .verify_artifact (
376
402
asset ("tsa/bundle.txt" ).read_bytes (),
377
403
Bundle .from_json (asset ("tsa/bundle.txt.sigstore" ).read_bytes ()),
0 commit comments