Skip to content

Commit 1e3f93e

Browse files
committed
rekor/checkpoint: handle missing ancillary data (#891)
Signed-off-by: William Woodruff <william@trailofbits.com>
1 parent 8ac0049 commit 1e3f93e

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

sigstore/_internal/rekor/checkpoint.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class LogCheckpoint(BaseModel):
5858
- an origin, e.g. "rekor.sigstage.dev - 8050909264565447525"
5959
- the size of the log,
6060
- the hash of the log,
61-
- and any ancillary contants, e.g. "Timestamp: 1679349379012118479"
61+
- and any optional ancillary contants, e.g. "Timestamp: 1679349379012118479"
6262
6363
See: <https://github.com/transparency-dev/formats/blob/main/log/README.md>
6464
"""
@@ -75,7 +75,7 @@ def from_text(cls, text: str) -> LogCheckpoint:
7575
"""
7676

7777
lines = text.strip().split("\n")
78-
if len(lines) < 4:
78+
if len(lines) < 3:
7979
raise CheckpointError("Malformed LogCheckpoint: too few items in header!")
8080

8181
origin = lines[0]
@@ -99,12 +99,7 @@ def to_text(self) -> str:
9999
See class definition for a prose description of the format.
100100
"""
101101
return "\n".join(
102-
[
103-
self.origin,
104-
str(self.log_size),
105-
self.log_hash,
106-
]
107-
+ self.other_content
102+
[self.origin, str(self.log_size), self.log_hash, *self.other_content]
108103
)
109104

110105

0 commit comments

Comments
 (0)