{"record":{"id":"3a97139d677e2be0","repo":"Significant-Gravitas/AutoGPT","slug":"reviewed-data-is-too-large-max-1mb","errorCode":null,"errorMessage":"reviewed_data is too large (max 1MB)","messagePattern":"reviewed_data is too large \\(max 1MB\\)","errorType":"validation","errorClass":"ValueError","httpStatus":422,"severity":"error","filePath":"autogpt_platform/backend/backend/api/features/executions/review/model.py","lineNumber":173,"sourceCode":"                return True\n            elif isinstance(obj, dict):\n                return all(\n                    isinstance(k, str) and validate_safejson_type(v)\n                    for k, v in obj.items()\n                )\n            elif isinstance(obj, list):\n                return all(validate_safejson_type(item) for item in obj)\n            else:\n                return False\n\n        if not validate_safejson_type(v):\n            raise ValueError(\"reviewed_data contains non-SafeJson compatible types\")\n\n        # Validate data size to prevent DoS attacks\n        try:\n            json_str = json.dumps(v)\n            if len(json_str) > 1000000:  # 1MB limit\n                raise ValueError(\"reviewed_data is too large (max 1MB)\")\n        except (TypeError, ValueError) as e:\n            raise ValueError(f\"reviewed_data must be JSON serializable: {str(e)}\")\n\n        # Ensure no dangerous nested structures (prevent infinite recursion)\n        def check_depth(obj, max_depth=10, current_depth=0):\n            \"\"\"Recursively check object nesting depth to prevent stack overflow attacks.\"\"\"\n            if current_depth > max_depth:\n                raise ValueError(\"reviewed_data has excessive nesting depth\")\n\n            if isinstance(obj, dict):\n                for value in obj.values():\n                    check_depth(value, max_depth, current_depth + 1)\n            elif isinstance(obj, list):\n                for item in obj:\n                    check_depth(item, max_depth, current_depth + 1)\n\n        check_depth(v)\n        return v","sourceCodeStart":155,"sourceCodeEnd":191,"githubUrl":"https://github.com/Significant-Gravitas/AutoGPT/blob/9c8bb5550f446ba5d3046b78896578742495b3cf/autogpt_platform/backend/backend/api/features/executions/review/model.py#L155-L191","documentation":"ValueError raised inside the same field_validator when json.dumps(reviewed_data) exceeds 1,000,000 characters (~1MB). It is an explicit DoS guard: oversized review payloads are rejected at the API boundary before storage. Pydantic reports it as a 422.","triggerScenarios":"Submitting reviewed_data containing a large base64 blob, a full dataset dump, or a long log array whose serialized JSON crosses the 1MB character limit.","commonSituations":"Users pasting huge file contents into an AI-review data field; clients echoing back entire execution outputs as reviewed_data.","solutions":["Trim or summarize large payloads before submission (store big blobs elsewhere and pass a reference)","Check len(json.dumps(data)) client-side before posting","Split reviews across multiple ReviewItems if the data legitimately exceeds 1MB"],"exampleFix":"# before\nreviewed_data=big_blob  # ~2MB base64\n# after\nreviewed_data={\"blobRef\": upload_blob(big_blob), \"summary\": summarize(big_blob)}","handlingStrategy":"validation","validationCode":"const serialized = JSON.stringify(reviewedData);\nif (serialized.length > 1_000_000) throw new Error('reviewed_data too large');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check serialized size client-side before posting","Store large blobs out-of-band and pass references","Warn users pasting huge content into data fields"],"tags":["pydantic","validation","payload-limit","dos-guard"],"backgroundTag":null,"analyzedSha":"9c8bb5550f446ba5d3046b78896578742495b3cf","analyzedAt":"2026-08-14T17:17:21.957Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}