Files
Raúl MarínandClaude Opus 4.8 bebe59d8b0 Poco JSON: bound parser depth by default (defense in depth)
Defense-in-depth follow-up to the per-format depth fixes. `Poco::JSON::Parser`
defaulted to unlimited nesting depth, and many sites parse untrusted JSON
through it without calling `setDepth` - datalake metadata (Delta/Iceberg/
Paimon) and their REST/Unity catalogs, the Confluent/Avro schema registry,
HTTP/cloud responses, and ~30 other sites across src/. Any of them could
overflow the native stack on a deeply nested document.

Rather than chase each call site, default `ParserImpl`'s depth to
`JSON_DEFAULT_DEPTH` (1000) so every Poco JSON parse is bounded; callers that
genuinely need more can opt in via `setDepth`. The enforcement itself was
wired into Poco's `handleArray`/`handleObject` recursion in the previous
commit; this just changes the default. 1000 is far above any legitimate JSON
(real nesting is well under 100, and ClickHouse's JSON type uses simdjson/
rapidjson, not Poco), and part metadata (`serialization.json`) is a flat
structure, so internal use is unaffected (verified by a nested-type part
round-trip).

This subsumes the explicit Delta/Iceberg/Paimon `setDepth` calls added
earlier, which are removed here as redundant; the datalake regression test
(04340) now passes via the default and additionally covers catalogs, schema
registry, and the other Poco JSON parsers.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-06-12 14:48:36 +00:00
..