Skip to content

Enforce canonical Base64 decoding across log, note, and policy - #294

Merged
mhutchinson merged 1 commit into
transparency-dev:mainfrom
mhutchinson:strict-base64
Nov 4, 2026
Merged

mhutchinson merged 1 commit into
transparency-dev:mainfrom
mhutchinson:strict-base64

Conversation

@mhutchinson

Copy link
Copy Markdown
Contributor

C2SP specs (tlog-checkpoint, signed-note, tlog-cosignature, and tlog-policy) require RFC 4648 Section 3.5 canonical Base64 encoding and mandate that decoders reject non-canonical encodings (non-zero padding bits).

Previously, proof.TLogProof.Unmarshal used base64.StdEncoding.Strict(), while log.Checkpoint.Unmarshal, note key/signature/checkpoint decoders, and policy.vkeyPublicKey used base64.StdEncoding.DecodeString, which silently ignored non-zero padding bits in checkpoint root hashes, ML-DSA-44/ECDSA/RFC6962 vkeys, and cosignature timestamps.

Switch all remaining production base64.StdEncoding.DecodeString calls to base64.StdEncoding.Strict().DecodeString and add tests across log, note, and policy.

C2SP specs (tlog-checkpoint, signed-note, tlog-cosignature, and tlog-policy) require RFC 4648 Section 3.5 canonical Base64 encoding and mandate that decoders reject non-canonical encodings (non-zero padding bits).

Previously, proof.TLogProof.Unmarshal used base64.StdEncoding.Strict(), while log.Checkpoint.Unmarshal, note key/signature/checkpoint decoders, and policy.vkeyPublicKey used base64.StdEncoding.DecodeString, which silently ignored non-zero padding bits in checkpoint root hashes, ML-DSA-44/ECDSA/RFC6962 vkeys, and cosignature timestamps.

Switch all remaining production base64.StdEncoding.DecodeString calls to base64.StdEncoding.Strict().DecodeString and add tests across log, note, and policy.
@mhutchinson
mhutchinson requested a review from a team as a code owner November 3, 2026 17:30
@mhutchinson
mhutchinson requested a review from phbnf November 3, 2026 17:30
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #294      +/-   ##
==========================================
+ Coverage   82.57%   90.16%   +7.58%     
==========================================
  Files           5       10       +5     
  Lines         241     1047     +806     
==========================================
+ Hits          199      944     +745     
- Misses         30      103      +73     
+ 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.

@mhutchinson
mhutchinson merged commit df19e0e into transparency-dev:main Nov 4, 2026
14 checks passed
@mhutchinson
mhutchinson deleted the strict-base64 branch November 4, 2026 11:39
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