chaokunyang opened a new issue, #3414:
URL: https://github.com/apache/fory/issues/3414

   ### Feature Request
   
   Add configurable deserialization size guardrails in Fory JavaScript for 
untrusted payloads.
   
   ### Is your feature request related to a problem? Please describe
   
   There are currently no configurable limits for payload-driven lengths. 
Untrusted string/map/list lengths can trigger large allocations and memory 
pressure.
   
   ### Describe the solution you'd like
   
   Add configurable size limits to JavaScript deserialization and enforce them 
in list/map/string paths.
   
   Resolve task:
   - Add guardrail fields in `javascript/packages/fory/lib/type.ts` (`Config`) 
and wire them in `javascript/packages/fory/lib/fory.ts`.
   - Enforce collection length limits in deserialization codegen paths 
(`javascript/packages/fory/lib/gen/collection.ts` / 
`javascript/packages/fory/lib/gen/array.ts`).
   - Enforce map length limits in `javascript/packages/fory/lib/gen/map.ts`.
   - Enforce string byte-length limits in 
`javascript/packages/fory/lib/reader/index.ts` (and related readers).
   - Throw an error when a configured limit is exceeded.
   
   ### Describe alternatives you've considered
   
   Relying only on process-level memory limits and JS runtime behavior. This is 
late-failing and not protocol-aware.
   
   ### Additional context
   
   Medium: no configurable size guardrails for untrusted payloads 
(string/map/list lengths can drive large allocations).
   
   Related locations:
   - `javascript/packages/fory/lib/type.ts:263`
   - `javascript/packages/fory/lib/fory.ts:56`
   - `javascript/packages/fory/lib/gen/collection.ts:299`
   - `javascript/packages/fory/lib/gen/array.ts:44`
   - `javascript/packages/fory/lib/gen/map.ts:404`
   - `javascript/packages/fory/lib/reader/index.ts:191`
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to