Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions sigstore/verify/verifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,18 @@ def _verify_signed_timestamp(
for certificate_authority in cert_authorities:
certificates = certificate_authority.certificates(allow_expired=True)

builder = VerifierBuilder()
# We expect at least a signing cert and a root cert but there may be intermediates
if len(certificates) < 2:
_logger.debug("Unable to verify Timestamp: cert chain is incomplete")
continue

builder = (
VerifierBuilder()
.tsa_certificate(certificates.pop(0))
.add_root_certificate(certificates.pop())
)
for certificate in certificates:
builder.add_root_certificate(certificate)
builder = builder.add_intermediate_certificate(certificate)
Comment on lines +141 to +142
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flagging, nonblocking: we could add these with add_root_certificate instead, since they're semantically root certs ("root" meaning "in the root program," not "is a self-signed certificate"). That would be slightly faster, since our verification would then be one-hop (TSR -> TSA -> TSA-CA) rather than having to chain TSA-CA up to its "root."

In practice that's probably a marginal performance benefit, however.


verifier = builder.build()
try:
Expand Down
Loading