Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rekor/checkpoint: handle missing ancillary data #891

Merged
merged 2 commits into from
Feb 4, 2024
Merged
Changes from all commits
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
11 changes: 3 additions & 8 deletions sigstore/_internal/rekor/checkpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class LogCheckpoint(BaseModel):
- an origin, e.g. "rekor.sigstage.dev - 8050909264565447525"
- the size of the log,
- the hash of the log,
- and any ancillary contants, e.g. "Timestamp: 1679349379012118479"
- and any optional ancillary contants, e.g. "Timestamp: 1679349379012118479"

See: <https://github.com/transparency-dev/formats/blob/main/log/README.md>
"""
Expand All @@ -75,7 +75,7 @@ def from_text(cls, text: str) -> LogCheckpoint:
"""

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

origin = lines[0]
Expand All @@ -99,12 +99,7 @@ def to_text(self) -> str:
See class definition for a prose description of the format.
"""
return "\n".join(
[
self.origin,
str(self.log_size),
self.log_hash,
]
+ self.other_content
[self.origin, str(self.log_size), self.log_hash, *self.other_content]
)


Expand Down
Loading