Skip to content

spec(vindex): count-bound value_root, freshness, pruning hook, and spec hardening - #207

Merged
mhutchinson merged 5 commits into
transparency-dev:mainfrom
mhutchinson:feat/vindex-spec-improvements
Dec 2, 2026
Merged

mhutchinson merged 5 commits into
transparency-dev:mainfrom
mhutchinson:feat/vindex-spec-improvements

Conversation

@mhutchinson

Copy link
Copy Markdown
Contributor

Pre-lock-in hardening of c2sp.org/tlog-vindex (vindex/docs/tlog-vindex.md) and aligned Go implementation/tests across 5 self-contained commits:

  1. Count-bound value_root (feat(vindex): bind value log leaf count into value_root):
    • Replace bare RFC 6962 MTH in the MPT with value_root = SHA-256(0x02 || uint64_be(count) || value_mth).
    • Prevents /values preceding count spoofing, enforces cross-page count continuity uniformly via NextPage(), and allows mpt_root to directly authenticate future pruned base-state snapshots without extra note signatures (compatible with ML-DSA-44 log keys).
  2. State commitment freshness & input-root trust boundary (docs(vindex): clarify state commitment freshness and input-root verification):
    • Document freshness checks (witness timestamps, monotonic sizes, independent input log checkpoint comparison) and tighten the MUST/SHOULD split for input log checkpoint consistency.
  3. Wire, origin, and HTTP query tightening (spec(vindex): tighten input-origin, split_bit, HTTP query, and normative invariants):
    • Cap input-origin at 1..255 printable ASCII bytes (permitting spaces/+ for legacy logs like go.sum database tree) and enforce c2sp.org/tlog-cosignature@v1.1.0 rules on <output-log-origin> (wire.ValidateOutputOrigin).
    • Tighten split_bit upper bound to 0 <= b <= 8191, require 400 Bad Request on duplicate/unknown query params, literal +, and malformed % escapes (plus hammer conformance probes), document optional gzip negotiation, and standardize c2sp.org/tlog-* prose references.
  4. Design Rationale & HTTP caching (docs(vindex): expand Design Rationale and HTTP caching notes):
    • Document torchwood/mpt wire compatibility, future paginated prefix extensibility, canonical key syntax trade-offs, CDN coalescing of hot-key Page 1 /values requests, out-of-band mapping semantics bound to <output-log-origin>, and explicit operator blame on unsubstantiated input-root conflicts.
  5. Minimal pruning hook (spec(vindex): add 410 Gone pruning hook and ErrPruned client sentinel):
    • Add 410 Gone + anchor-leaf retention semantics in ### values, 404 vs 410 client verification rules, ### Pruning rationale (deferring base-state snapshot format to a follow-up), and typed client.ErrPruned.

@mhutchinson
mhutchinson force-pushed the feat/vindex-spec-improvements branch from 4e32a37 to 4bea7a2 Compare December 1, 2026 11:26
Replace the bare RFC 6962 Merkle Tree Hash stored as each key's 32-byte
value_root in the MPT with a domain-separated, count-bound commitment:

    value_root = SHA-256(0x02 || uint64_be(count) || value_mth)

An RFC 6962 MTH without a leaf count does not uniquely bind preceding
when verifying partial ranges against unexpanded compact range hashes
(for example, preceding=1 vs preceding=2^20 before a single trailing
leaf share the same popcount and right-spine merge shape). Binding
count into value_root:

- Prevents /values count spoofing on Page 1 and enforces cross-page
  count continuity uniformly via NextPage() wrapping
  (preceding, fold(compact_range)) with 0x02.
- Allows mpt_root in the witnessed Output Log to directly authenticate
  pruned base-state compact-range snapshots without requiring separate
  note signatures (incompatible with ML-DSA-44 log keys).
- Keeps MPT values fixed at 32 bytes with zero wire-format changes to
  /keys or /values.
…ication

Clarify two trust boundaries in Verifying the state commitment:

- Document that index == output_size - 1 does not prove checkpoint
  recency or input log freshness, and recommend freshness checks
  (witness cosignature timestamps against replay, monotonic
  output_size/input_size for stateful monitors, and comparing
  input_size against an independent input log checkpoint to detect a
  stalled indexer).
- Replace the conditional 'MUST ..., unless ...' phrasing for input
  log checkpoint consistency with a clear MUST/SHOULD split that
  explicitly states the reliance on independent auditors and entry
  retrieval integrity when skipping input log consistency checks.
@mhutchinson
mhutchinson force-pushed the feat/vindex-spec-improvements branch from 4bea7a2 to 1b7f56f Compare December 1, 2026 11:54
…ive invariants

Tighten tlog-vindex specification and align Go validation:

- input-origin: cap at 1..255 bytes (wire.ValidateInputOrigin) and note
  explicitly that internal spaces are permitted for legacy input logs
  such as sum.golang.org ('go.sum database tree'), whereas
  <output-log-origin> follows c2sp.org/tlog-checkpoint@v1.1.0 and
  c2sp.org/tlog-cosignature@v1.1.0.
- split_bit: tighten upper bound from 8192 to 8191 in spec, READMEs,
  and mpt.validateProofWireBounds (bit 8192 is unreachable for
  1..1024-byte non-NUL canonical keys).
- Normative invariants: explicitly require monotonically non-decreasing
  input-size across output log entries, contiguous suffix semantics on
  /values responses, and canonical path_key + 32-byte path_val checks
  in non-inclusion verification.
- HTTP interface: require 400 Bad Request on duplicate/unknown query
  parameters, literal '+' characters (aligned in walkRFC3986Query), and
  malformed percent-encoding; document optional gzip compression via
  Accept-Encoding; standardize prose references to c2sp.org/tlog-*.
Pre-empt common C2SP review questions in tlog-vindex.md without
changing normative behavior:

- Document torchwood/mpt hash/wire compatibility for key padding and
  length-prefixed values, and note the MPT stays inline until a second
  C2SP consumer needs it.
- Note that unpaginated /keys?prefix= does not preclude future
  paginated range/subtree extensions without changing mpt_root.
- Add Design Rationale for 0x21..0x7E (1..1024 byte) canonical keys,
  including injective encoding guidance for arbitrary inputs.
- Explain CDN coalescing of hot-key Page 1 /values requests via the
  short /keys TTL alongside long-lived continuation pages.
- Replace the pre-1.0 Design Log note on map-fn with out-of-band
  binding to <output-log-origin> (matching tlog-cosignature) and make
  operator blame explicit for unsubstantiated input-root conflicts.
Specify minimal forward-compatible pruning semantics for /values while
deferring the late-joining base-state snapshot format to a follow-up:

- In ### values: require no pruning without an ecosystem retention
  policy; where pruned to horizon P (from <= P <= input_size), require
  200 OK for before >= P (retaining each key's highest occurrence < P
  for gapless boundary verification), allow 410 Gone for
  from < before < P, and preserve 404 Not Found for before <= from.
- In ## Design Rationale: explain why from stays immutable and how
  value-log + output-log pruning avoid origin/key/witness rotation,
  with count-bound value_root enabling future mpt_root-authenticated
  base-state snapshots.
- In vindex/client: map HTTP 410 Gone on /values to typed ErrPruned
  (distinct from ErrVerificationFailed on 404).
@mhutchinson
mhutchinson force-pushed the feat/vindex-spec-improvements branch from 1b7f56f to 25c6c79 Compare December 1, 2026 15:37
@mhutchinson
mhutchinson merged commit 6b7c371 into transparency-dev:main Dec 2, 2026
12 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.

2 participants