Lukasz Lenart created WW-5618:
---------------------------------
Summary: Make JSON plugin more configurable
Key: WW-5618
URL: https://issues.apache.org/jira/browse/WW-5618
Project: Struts 2
Issue Type: Improvement
Components: Plugin - JSON
Reporter: Lukasz Lenart
Fix For: 6.9.0, 7.2.0
The JSON plugin currently provides limited configuration options for
controlling deserialization behavior. Other Struts components (e.g.,
{{fileUpload}} interceptor) offer fine-grained, per-action configurable limits,
but the JSON plugin has no equivalent controls.
This ticket adds the following configurable options:
- {{struts.json.maxElements}} — maximum number of elements in a single JSON
array or object (default: 10,000)
- {{struts.json.maxDepth}} — maximum nesting depth for JSON structures
(default: 64)
- {{struts.json.maxLength}} — maximum length of JSON input in characters
(default: 2,097,152 / 2MB)
- {{struts.json.maxStringLength}} — maximum length of an individual JSON string
value (default: 262,144 / 256KB)
- {{struts.json.maxKeyLength}} — maximum length of a JSON object key name
(default: 512)
These options should be:
1. Configurable globally via {{struts.xml}} constants
2. Overridable per-action via interceptor {{<param>}} elements (same pattern as
{{fileUpload}})
3. Exposed through `JSONConstants` and {{JSONConstantConfig}}
Additionally, {{JSONReader}} should be made injectable via the Struts Container
(matching the existing {{JSONWriter}} pattern), allowing users to provide
custom reader implementations.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)