Repository navigation
Conversation
|
This pull request contains three critical findings where the user 'svader0' modified sensitive codepaths in
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in
|
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/api_v2/serializers.py' matches configured sensitive codepath pattern 'dojo/api_v2/*.py' and was modified by 'svader0' (commit 97f1ad3) who is not in the allowed authors list. |
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/jira/api/serializers.py (drs_51d3fd76)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/jira/api/serializers.py' matches configured sensitive codepath pattern 'dojo/jira/**/*.py' and was modified by 'svader0' (commit 9a15b93) who is not in the allowed authors list. |
🔴 Configured Sensitive Codepath Modified by Non-Allowed Author in dojo/utils.py (drs_d5b3e202)
| Vulnerability | Configured Sensitive Codepath Modified by Non-Allowed Author |
|---|---|
| Description | File 'dojo/utils.py' matches configured sensitive codepath pattern 'dojo/utils.py' and was modified by 'svader0' (commit a4cefe2) who is not in the allowed authors list. |
We've notified @mtesauro.
Comment to provide feedback on these findings.
Report false positive: @dryrunsecurity fp [FINDING ID] [FEEDBACK]
Report low-impact: @dryrunsecurity nit [FINDING ID] [FEEDBACK]
Example: @dryrunsecurity fp drs_90eda195 This code is not user-facing
All finding details can be found in the DryRun Security Dashboard.
7 of 9 tasks
A tag list sent in string form goes through json.loads, and the field caught only ValueError. A deeply nested array makes the C decoder raise RecursionError instead, so the request failed with a 500. Catch it too, so the answer is the field's invalid_json 400.
…IRA fields The request_response req_resp field and the JIRA project custom_fields, close_transition_fields and reopen_transition_fields run json.loads on a string and catch only ValueError or JSONDecodeError. A deeply nested array makes the C decoder raise RecursionError, so the request failed with a 500. Catch it too, the same as the tag list field.
Python 3.14 raises RecursionError from json.loads only when the real C stack runs out, so the depth that fails depends on the host. A fixed limit of 10000 levels matches Go's encoding/json and stays inside what Postgres jsonb accepts.
The tag list, req_resp and JIRA project JSON fields now parse their string form with parse_json_string. Catching RecursionError alone gave a 400 on some hosts and a 500 on others: with a large stack, depth 100000 parsed and Postgres then failed with stack depth limit exceeded. The tests now also send depth 10001, which parses on any normal stack, so they fail the same way everywhere without the limit.
An empty req_resp string set data to a list and then passed that list to the JSON parser, which raised TypeError and answered a 500.
svader0
force-pushed
the
fix/tag-list-deep-json
branch
from
December 5, 2026 16:10
cd9f373 to
e418d84
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
A few API fields accept JSON as a string and parse it with
json.loads. If the string is a very deeply nested array, such as"[" * 100000 + "]" * 100000, the request fails with a 500.On Python 3.14,
json.loadsraisesRecursionErroronly when the real C stack runs out, so the depth that fails depends on the host. With a large stack, the string parses, and Postgres then fails withstack depth limit exceededwhen the value goes into a JSON column. So catchingRecursionErroralone is not enough.This PR adds
parse_json_stringindojo/utils.py. It refuses a string nested deeper than 10000 levels before it callsjson.loads. It also turns aRecursionErrorinto the sameJSONDecodeError. 10000 is the same limit as Go'sencoding/json, and Postgresjsonbaccepts that depth. Brackets inside JSON strings do not count. The depth scan only runs when the string holds more than 10000[and{characters.These fields now use it and answer a 400:
TagListSerializerField.to_internal_value(dojo/api_v2/serializers.py): thetagsfield on every serializer that uses it. It answers the field'sinvalid_jsonerror.RequestResponseSerializerField.to_internal_value(dojo/finding/api/serializer.py):req_responPOST /api/v2/findings/<id>/request_response/. It answers the field'sinvalid_jsonerror.JIRAProjectSerializer.validate(dojo/jira/api/serializers.py):custom_fields,close_transition_fieldsandreopen_transition_fields. They answer the existingInvalid JSON: ...error.It also fixes an empty
req_respstring. That code passed a list to the JSON parser, which raisedTypeErrorand answered a 500. It now answers the same as an empty list.Test results
unittests/test_utils.py:TestParseJsonString(depth 10000 parses, 10001 fails, nested objects, brackets and escaped quotes inside strings,RecursionError).unittests/test_tags.py:TagTests.test_finding_patch_tags_deeply_nested_string_is_invalid_jsonunittests/test_rest_framework.py:FindingRequestResponseTest.test_request_response_post_deeply_nested_string_is_invalid_json,FindingRequestResponseTest.test_request_response_post_empty_string_matches_empty_list,JiraProjectTest.test_json_field_deeply_nested_string_is_invalid_jsonThe API tests send depth 10001 and depth 100000. Without the fix, depth 10001 gets the wrong error (or a 201 for JIRA) and depth 100000 gets a 500. I also ran
test_tags,test_utils,test_rest_framework,test_apiv2_limit_reqresp,test_jira_config_engagementandtest_jira_helper: 976 tests, OK.ruff check .withruff==0.16.10passes.Not in this PR: if the request body itself is deeply nested (not a string), DRF's
JSONParsercan raise the sameRecursionError, or the value can reach a JSON column and fail in Postgres. That needs its own fix.Documentation
No documentation change. The API keeps the same error messages it already uses for bad JSON.
Checklist
dev.devbranch.