json-schema-org / json-schema-org/website

🐛 Bug: Unbounded recursion in getPartsOfJson can cause stack overflow on deeply nested JSON

Open
#2,040 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

🐛 Bug Status: Triage
Dominant language
HTML
Stars
169
Forks
484
Avg merge
2d 2h
Merged PRs (30d)
6

Description

Describe the bug

lib/getPartsOfJson.ts

getPartsOfJson recursively processes nested objects and arrays.
There is currently no recursion depth limit or input size guard.

When deeply nested JSON is processed, this can lead to:

Stack overflow

UI freeze or crash

Unresponsive editor behavior

Steps To Reproduce
  1. Steps to Reproduce

  2. Call getPartsOfJson with deeply nested JSON, for example:

  3. {"a":{"a":{"a":{"a":{"a":{"a":{"a":1}}}}}}}

  4. Observe excessive recursion depth or runtime failure

Expected Behavior

Expected Behavior

Recursion should be bounded

Extremely deep JSON should fail gracefully or be handled iteratively

Runtime should remain responsive

Actual Behavior

Recursion depth is unbounded

Deep input can crash or freeze runtime

Screenshots

No response

Device Information [optional]
- OS:
- Browser:
- version:
Are you working on this issue?

Yes

Do you think this work might require an [Architectural Decision Record (ADR)]? (significant or noteworthy)

Yes

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with lib/getPartsOfJson.ts and reproduce the failure by calling getPartsOfJson with the deeply nested JSON shown in the issue. Determine the appropriate bounded or graceful behavior, including any architectural decision required; the work is done when deeply nested input no longer overflows the stack, freezes, or crashes the runtime.

Written by the indexing model from the issue text.

Assessment

Tech stack
json, typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.