Checkpoint.Unmarshal accepts non-canonical base64 roots; C2SP now requires rejecting them

未关闭 适合新手
#285 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
72/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
go
领域
security

调研方向

阅读 log/checkpoint.go 第 68 行附近的代码,并检查 base64.StdEncoding.DecodeString 如何处理非规范的 root 编码。issue 提议采用严格解码,并可选择重新编码,以确保行具有精确的规范性;请将该行为与报告中引用的 C2SP 要求进行比较。完成标准是拒绝非规范的 root,同时仍能解析规范的 checkpoint。

由索引模型根据 Issue 内容生成。

描述

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

主要语言
Go
星标
14
派生
13
平均合并
2 天 7 小时
30 天内合并 PR
10

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。