Skip to main content

IPLD_MAX_DEPTH

Constant IPLD_MAX_DEPTH 

Source
pub const IPLD_MAX_DEPTH: usize = 64;
Expand description

Maximum depth of nested JSON objects / arrays json_to_ipld will walk. Beyond this, the conversion returns an error rather than recursing. Picked at 64 because legitimate agent-memory props rarely nest past ~6, while a malicious payload can cheaply ship arbitrary depth and stack-overflow the process.

This MUST stay equal to crate::codec::dagcbor::WALK_IPLD_MAX_DEPTH: a payload that clears the input-layer cap must also clear the decode-layer cap so there is no gap between “accepted on the wire” and “decodable after a round-trip through DAG-CBOR”.