Bound JSON nesting before json.loads on text from the network
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 58/100
Research direction
Read _token._shallow from #123, then trace _context.read_principal, _connector.py, and _jcs.py to identify every json.loads that receives network text. Add a linear depth check before parsing, using the stated limit of 64 as a reference. Done means all listed network parsing paths are bounded and the 1 MB thread test at 9,000 nesting levels confirms the process does not crash.
Written by the indexing model from the issue text.
Description
On Python 3.12 and 3.13 the json module's scanner is recursive in C, and it can exhaust a thread's stack before it raises RecursionError. On a thread with a 1 MB stack (the official Alpine images, and runserver's request threads there), a text nested about 8,000 to 9,000 levels deep crashes the process with SIGSEGV. except RecursionError is only a backstop, not a bound.
_context.read_principalreads an inboundNeolith-Principalwithjson.loadsand no depth bound first. It is reached from the network once provider endpoints land (step 5, task 6).- Every other
json.loadson text from a request or a response (_connector.py,_jcs.py) needs the same check once it receives text from a network (step 5, tasks 1 and 4). - Fix: check depth with a linear scan before
json.loads, as_token._shallowdoes in #123 (limit 64 for the token header), with a test on a 1 MB thread at 9,000 levels.
Found in the review of #123.
- Dominant language
- Python
- Stars
- 1
- Forks
- 0
- Avg merge
- 5h 30m
- Merged PRs (30d)
- 85
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from stack314/django-neolith
-
help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
stack314/django-neolith#142 · 1 comment ·
Maintainers usually reply within 1 day
-
help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
stack314/django-neolith#141 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
stack314/django-neolith#140 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
stack314/django-neolith#126 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
stack314/django-neolith#119 · 2 comments ·
Maintainers usually reply within 1 day
All issues in stack314/django-neolith
Similar issues
-
automated endpoint-dead needs-curation
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
almanac-data/climate-almanac#138 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
OceanDataTools/openrvdas#760 ·
Maintainers usually reply within 1 day
-
level/subtask type/enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
wazuh/wazuh-virtual-machines#1091 ·
Maintainers usually reply within 1 day
-
Python: Bug: ChatMessageContent.from_element drops AudioContent and BinaryContent into raw TextContentPossibly taken @halcyon-past claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
microsoft/semantic-kernel#14824 · 1 comment ·
Maintainers usually reply within 3 days
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
LedgerHQ/app-bitcoin-legacy#306 ·