Skip to content

[ISSUE]: Depth validation uses recursion, enabling CPU/resource exhaustion #471

Closed

Description

@Aditya8369

Description

Issue: _validate_depth() recursively traverses the entire JSON structure. Even with a depth cap, large payloads can still burn significant CPU/time and recursion overhead.

Fix: Replace recursion with an iterative traversal (explicit stack/queue), short-circuit immediately when depth exceeds MAX_NESTED_DEPTH, and add a performance-oriented test.

Additional Context

No response

Activity

  1. Aditya8369 commented on May 11, 2026

    @Aditya8369
    ContributorAuthor

    @devanshi14malhotra assign me please

  2. added
    NSoC'26For issues and PRs which are a part of the Nexus Spring of Code open source event
    on May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

NSoC'26For issues and PRs which are a part of the Nexus Spring of Code open source eventbackendlevel310 points

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions