Checkpoint.Unmarshal accepts non-canonical base64 roots; C2SP now requires rejecting them
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
Research direction
Read log/checkpoint.go around line 68 and check how base64.StdEncoding.DecodeString handles non-canonical root encodings. The issue proposes strict decoding and optionally re-encoding for exact line canonicality; compare that behavior against the C2SP requirement cited in the report. Done means non-canonical roots are rejected while canonical checkpoints still parse.
Written by the indexing model from the issue text.
Description
log/checkpoint.go line 68 decodes the root line with base64.StdEncoding.DecodeString.
Go's default decoder ignores non-zero trailing bits, so ...Kjg= and ...Kjh= both
decode to the same 32 bytes and both parse as the same checkpoint.
As of C2SP/C2SP#370 (merged 2026-10-01, closing C2SP/C2SP#348) tlog-checkpoint and
signed-note say: "Encoders MUST generate canonical base64 according to RFC 4648,
Section 3.5, and decoders MUST reject non-canonical encodings."
Measured 2026-09-21 over the tlog-witness add-checkpoint interface against
transparency-dev/witness @55a5a0b: it cosigned both spellings of one root at size 25.
The two notes are byte-different, each carries a valid log signature, and each now carries
a witness cosignature. A log can collect a quorum across the two forms; a monitor keyed on
checkpoint bytes sees two checkpoints for one tree state. Reproduction:
https://github.com/MarkovianProtocol/witness-gauntlet (case "non-canonical base64 root").
Fix is one call: base64.StdEncoding.Strict().DecodeString(...), which rejects non-zero
trailing bits (missing padding is already an error in StdEncoding). Go's decoder still
skips CR and LF even in strict mode, so a re-encode-and-compare closes that last gap if you
want the line to be exactly one spelling. Happy to send the PR if you'd rather not.
Markovian Protocol
- Dominant language
- Go
- Stars
- 14
- Forks
- 13
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 10
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Similar issues
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 2 days
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
seaweedfs/seaweed-block#443 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
version-fox/vfox#825 ·
Maintainers usually reply within 1 day
-
HTTP `batch.Send` returns nil and inserts no rows when the block does not encodePossibly taken @Indian-boult claimed this today. Openbug queries
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
ClickHouse/clickhouse-go#2155 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
Maintainers usually reply within 1 day