L4YAML

4.2. ParserLimits🔗

The ParserLimits structure provides 11 configurable threat mitigations:

Parameter

Default

Purpose

nestingDepth

250

Maximum recursion depth — prevents billion-laugh expansion

maxStringLength

10 MB

Maximum scalar string length — DoS prevention

maxArrayLength

100,000

Maximum sequence element count

maxObjectSize

10 MB

Maximum total mapping size

maxAliasDepth

50

Maximum alias chain depth — recursive cycle protection

allowDuplicateKeys

false

Whether duplicate mapping keys are accepted

allowedTagHandles

customizable

Restricts which tag handles (!, !!, custom) are permitted

forbiddenTags

customizable

Explicit rejection of dangerous tags (e.g., !!python/object)

parseErrorPolicy

strict

Whether non-conformant input is rejected or best-effort parsed

commentEncoding

explicit

Character encoding validation for comments

literalNewlineHandling

standard

Newline normalization in literal scalars