C# reference: one payload nesting bound (256) on read and write, nil arm slots refused, bounds vectors

CultPayloadDepth.Check walks MessagePack headers iteratively and refuses the first
container past CultMessagePackSecurity.MaximumPayloadDepth, read or skipped, called by
SerializeUntyped (on the bytes it produced) and DeserializeUntyped (before decoding).
UntrustedData's 500 is replaced by the same value as a backstop. CultUnionGuard refuses
[k, nil] arms. New vectors in tests/vectors/union-parity, with bounds-outcomes.msgpack
as their data; the gate now runs every Check-calling test body and fingerprints bytes
and write times. All commits build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-11 08:33:15 +02:00
commit abf624ab04
20 changed files with 465 additions and 21 deletions

View file

@ -217,6 +217,13 @@ Under `cultcache.store.v1` a record has exactly these four slots. A reader refus
header allows, naming the version or the record's key and schema id. It never skips a
slot it does not understand.
A record's payload nests at most 256 MessagePack containers. Every array and map
counts, whether a reader decodes it or skips past it, and the outermost array is
depth 1: a payload of depth 256 is accepted and one of depth 257 is refused. Every
runtime enforces the same bound on read and on write, and the refusal names the type,
the depth and the limit, never payload bytes. The vectors are in
`tests/vectors/union-parity` (`bounds-outcomes.msgpack`).
## Variant Records
A variant record is a record whose document is a base record's document with some