Skip to main content

Module recursion

Module recursion 

Source
Expand description

Recursion limits configuration for sqry.

This module enforces recursion depth limits to prevent resource exhaustion and stack overflow attacks from deeply nested code structures.

§Security Model

Defense-in-depth approach with multiple layers:

  1. Default limits: Conservative defaults (100 file ops, 1000 expr fuel)
  2. Configurable limits: Users can adjust based on their needs
  3. Hard caps: Absolute maximums that cannot be bypassed (200 file ops, 10,000 expr fuel)
  4. Validation: All values validated against hard caps to prevent config injection

§Attack Vectors Mitigated

  • Stack overflow: Deep recursion exhausting call stack
  • Resource exhaustion: Unbounded recursion consuming CPU/memory
  • Config injection: Malicious config files setting extreme limits
  • AST bombs: Pathological inputs with extreme nesting depth

Structs§

RecursionLimits
Recursion limits configuration