Skip to content

Commit f25a78c

Browse files
committed
tuf: allow missing expiries in key validity period
1 parent 40ea116 commit f25a78c

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

sigstore/_internal/tuf.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def _timerange_valid_for_status(period: TimeRange | None, status: KeyStatus) ->
110110
return False
111111

112112
# If we want Expired keys, we don't care. Otherwise, check that we are within range.
113-
return status == KeyStatus.Expired or (period.end is not None and now < period.end)
113+
return status == KeyStatus.Expired or (period.end is None or now < period.end)
114114

115115

116116
class TrustUpdater:
@@ -318,13 +318,10 @@ def get_fulcio_certs(self) -> list[Certificate]:
318318
]
319319
)
320320
else:
321-
certs = [
322-
load_pem_x509_certificate(c)
323-
for c in self._get(
324-
KeyUsage.Fulcio, [KeyStatus.Active, KeyStatus.Expired]
325-
)
326-
]
327-
321+
certs = (
322+
self._get(KeyUsage.Fulcio, [KeyStatus.Active, KeyStatus.Expired]) or []
323+
)
324+
certs = [load_pem_x509_certificate(c) for c in certs]
328325
if not certs:
329326
raise MetadataError("Fulcio certificates not found in TUF metadata")
330327
return certs

0 commit comments

Comments
 (0)