Skip to content

Enforce C2SP decimal integer rules and bounds across parsers - #293

Open
mhutchinson wants to merge 1 commit into
transparency-dev:mainfrom
mhutchinson:strict-decimal-int
Open

mhutchinson wants to merge 1 commit into
transparency-dev:mainfrom
mhutchinson:strict-decimal-int

Conversation

@mhutchinson

Copy link
Copy Markdown
Contributor

C2SP specs (tlog-proof@v1, tlog-checkpoint, tlog-cosignature, and tlog-policy) define decimal integers as base-10 representations without leading zeros (except for 0 itself), with tlog-proof leaf indices bounded to 0..2^63-1 and tlog-policy group thresholds bounded to 1..n (with n >= 1).

Previously:

  • proof.TLogProof.Unmarshal used strconv.ParseUint(idxStr, 10, 64), accepting leading zeros (e.g. 007) and indices >= 2^63.
  • log.Checkpoint.Unmarshal and note.formatRFC6962STH accepted leading zeros on the checkpoint tree size line.
  • policy.TLogPolicy.Unmarshal and witness.ParsePolicy accepted leading zeros on numeric group thresholds.
  • witness.ParsePolicy accepted group thresholds of 0 and groups with 0 members, producing a Group{N: 0} that trivially satisfied any checkpoint.

Reject leading zeros across all decimal integer parsers, bound tlog-proof leaf indices to 63 bits, and require group thresholds in witness.ParsePolicy to satisfy 1 <= k <= n with at least one member.

@mhutchinson
mhutchinson requested a review from a team as a code owner November 3, 2026 16:43
@mhutchinson
mhutchinson requested a review from roger2hk November 3, 2026 16:43
@codecov-commenter

codecov-commenter commented Nov 3, 2026 •

Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #293      +/-   ##
==========================================
+ Coverage   82.57%   90.44%   +7.87%     
==========================================
  Files           5       10       +5     
  Lines         241     1057     +816     
==========================================
+ Hits          199      956     +757     
- Misses         30      101      +71     
+ 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.

C2SP specs (tlog-proof@v1, tlog-checkpoint, tlog-cosignature, and tlog-policy) define decimal integers as base-10 representations without leading zeros (except for 0 itself), with tlog-proof leaf indices bounded to 0..2^63-1 and tlog-policy group thresholds bounded to 1..n (with n >= 1).

Previously:
- proof.TLogProof.Unmarshal used strconv.ParseUint(idxStr, 10, 64), accepting leading zeros (e.g. 007) and indices >= 2^63.
- log.Checkpoint.Unmarshal and note.formatRFC6962STH accepted leading zeros on the checkpoint tree size line.
- policy.TLogPolicy.Unmarshal and witness.ParsePolicy accepted leading zeros on numeric group thresholds.
- witness.ParsePolicy accepted group thresholds of 0 and groups with 0 members, producing a Group{N: 0} that trivially satisfied any checkpoint.

Reject leading zeros across all decimal integer parsers, bound tlog-proof leaf indices to 63 bits, and require group thresholds in witness.ParsePolicy to satisfy 1 <= k <= n with at least one member.
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.

2 participants