/** * Prototype-poisoning guard for the JSON body lane - the check behind `c.boundedJson` and the * schema path. A single walk of the parsed value, never a reviver (a reviver taxes every key of * every parse, including the parses that carry no object at all). * * No raw-text pre-scan: the Fastify-style `text.includes('"__proto__"')` filter is a pessimization * on 2026 engines. A quoted-name search runs a general substring algorithm over the whole body, * while the walk only touches the nodes the parse already built. Measured on Node 26 and Bun 1.3, * three `includes()` calls cost 2-4x the walk on every body shape an API actually receives * (records, strings, nested objects); the scan only wins on a body that is mostly a flat array of * numbers, where it saves ~1.5us on a 9KB payload that spends 20us in `JSON.parse` regardless. * Dropping the tier also removes an escape-analysis obligation - the scan had to route every `\u` * to the walk, because `_` spells `_`. */ export type ProtoPoisoning = "reject" | "strip" | "ignore"; /** * `JSON.parse` + the poisoning policy. Returns the parsed value (stripped in place under * `"strip"`); throws on invalid JSON or - via the same catch path - on a rejected poisoning, so * a poisoned payload is indistinguishable from malformed JSON to the caller. */ export declare function parseJsonGuarded(text: string, policy: ProtoPoisoning): unknown; /** * The policy applied to an already-parsed value - the native-`json()` lane, which never holds the * raw text, and the transport codecs, which parse with their own decoder. Escapes are resolved by * the time a key is an own property, so a `\u`-spelled `__proto__` and a literal one look identical * here. Cost is one iterative pass over the value's object nodes; `"ignore"` skips even that. * Throws the reject singleton; callers map it to their lane's flat error. */ export declare function guardParsedValue(value: unknown, policy: ProtoPoisoning): unknown; //# sourceMappingURL=proto-guard.d.ts.map