Skip to content

Enforce strict C2SP tlog-proof framing and verbatim checkpoint parsing - #298

Merged
mhutchinson merged 2 commits into
transparency-dev:mainfrom
mhutchinson:proof-framing
Nov 17, 2026
Merged

mhutchinson merged 2 commits into
transparency-dev:mainfrom
mhutchinson:proof-framing

Conversation

@mhutchinson

@mhutchinson mhutchinson commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Unmarshal previously tokenized the entire proof line-by-line and reassembled the checkpoint afterward, silently appending a missing final newline to the checkpoint and accepting truncated proofs with no checkpoint at all. Marshal also emitted an invalid empty extra line when ExtraData was a non-nil empty slice.

  • Guard Marshal() with len(p.ExtraData) > 0 so empty non-nil ExtraData omits the extra line per C2SP tlog-proof@v1.
  • Replace bufio.Scanner in Unmarshal() with strings.Cut so the raw Checkpoint bytes after the blank separator line are sliced and copied verbatim without reassembly, while requiring newline-terminated header/hash lines, rejecting empty extra data and missing checkpoints, avoiding receiver mutation on error, and incidentally lifting Scanner's 64 KiB line limit.

@mhutchinson
mhutchinson requested a review from a team as a code owner November 11, 2026 16:18
@mhutchinson
mhutchinson requested a review from AlCutter November 11, 2026 16:18
@codecov-commenter

codecov-commenter commented Nov 11, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.50%. Comparing base (fa00c16) to head (c9c5784).
⚠️ Report is 209 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #298      +/-   ##
==========================================
+ Coverage   82.57%   92.50%   +9.92%     
==========================================
  Files           5       10       +5     
  Lines         241     1107     +866     
==========================================
+ Hits          199     1024     +825     
- Misses         30       83      +53     
+ Partials       12        0      -12     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread proof/tlog_proof.go Resolved
Comment thread proof/tlog_proof.go Resolved
Comment thread proof/tlog_proof.go Resolved
Unmarshal previously tokenized the entire proof line-by-line and reassembled the checkpoint afterward, silently appending a missing final newline to the checkpoint and accepting truncated proofs with no checkpoint at all. Marshal also emitted an invalid empty extra line when ExtraData was a non-nil empty slice.

- Guard Marshal() with len(p.ExtraData) > 0 so empty non-nil ExtraData omits the extra line per C2SP tlog-proof@v1.
- Replace bufio.Scanner in Unmarshal() with bytes.Cut so the raw Checkpoint bytes after the blank separator line are sliced and cloned verbatim without reassembly, while requiring newline-terminated header/hash lines, rejecting empty extra data and missing checkpoints, avoiding receiver mutation on error, and incidentally lifting Scanner's 64 KiB line limit.
@mhutchinson
mhutchinson merged commit c8fd7e8 into transparency-dev:main Nov 17, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants