|
24 | 24 | from sigstore._internal.trust import CertificateAuthority
|
25 | 25 | from sigstore.dsse import StatementBuilder, Subject
|
26 | 26 | from sigstore.errors import VerificationError
|
27 |
| -from sigstore.models import Bundle |
| 27 | +from sigstore.models import Bundle, LogEntry |
28 | 28 | from sigstore.verify import policy
|
29 | 29 | from sigstore.verify.verifier import Verifier
|
30 | 30 |
|
@@ -222,6 +222,35 @@ def test_verifier_no_validity_end(self, verifier, asset, null_policy):
|
222 | 222 | null_policy,
|
223 | 223 | )
|
224 | 224 |
|
| 225 | + @pytest.mark.parametrize( |
| 226 | + "fields_to_delete", |
| 227 | + ( |
| 228 | + [], |
| 229 | + ["inclusionPromise"], |
| 230 | + # integratedTime is required to verify the inclusionPromise. |
| 231 | + pytest.param(["integratedTime"], marks=pytest.mark.xfail), |
| 232 | + ["inclusionPromise", "integratedTime"], |
| 233 | + ), |
| 234 | + ) |
| 235 | + def test_vierifier_verify_no_inclusion_promise_and_integrated_time( |
| 236 | + self, verifier, asset, null_policy, fields_to_delete |
| 237 | + ): |
| 238 | + """ |
| 239 | + Ensure that we can still verify a Bundle with a rfc3161 timestamp if the SET can't be verified or isn't present. |
| 240 | + There is one exception: When inclusionPromise is present, but integratedTime is not, then we expect a failure |
| 241 | + because the integratedTime is required to verify the inclusionPromise. |
| 242 | + """ |
| 243 | + bundle = Bundle.from_json(asset("tsa/bundle.txt.sigstore").read_bytes()) |
| 244 | + _dict = bundle.log_entry._to_rekor().to_dict() |
| 245 | + for field in fields_to_delete: |
| 246 | + del _dict[field] |
| 247 | + bundle._log_entry = LogEntry._from_dict_rekor(_dict) |
| 248 | + verifier.verify_artifact( |
| 249 | + asset("tsa/bundle.txt").read_bytes(), |
| 250 | + bundle, |
| 251 | + null_policy, |
| 252 | + ) |
| 253 | + |
225 | 254 | def test_verifier_without_timestamp(
|
226 | 255 | self, verifier, asset, null_policy, monkeypatch
|
227 | 256 | ):
|
|
0 commit comments