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

   ### Feature Request
   
   Add configurable deserialization size guardrails in Fory Python 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 Python deserialization and enforce them in 
list/map/string paths (pure Python and Cython paths).
   
   Resolve task:
   - Add guardrail fields in Python runtime configuration 
(`python/pyfory/_fory.py` and Cython equivalent in 
`python/pyfory/serialization.pyx`).
   - Enforce collection length limits in `python/pyfory/collection.pxi` for 
list/tuple/set reads.
   - Enforce map length limits in `python/pyfory/collection.pxi` for dict/map 
reads.
   - Enforce string byte-length limits in `python/pyfory/buffer.pyx` (and 
pure-Python buffer path if needed).
   - Raise a deserialization exception when a configured limit is exceeded.
   
   ### Describe alternatives you've considered
   
   Relying only on process-level memory limits and interpreter/allocator 
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:
   - `python/pyfory/_fory.py:164`
   - `python/pyfory/serialization.pyx:1048`
   - `python/pyfory/collection.pxi:300`
   - `python/pyfory/collection.pxi:301`
   - `python/pyfory/collection.pxi:861`
   - `python/pyfory/collection.pxi:862`
   - `python/pyfory/buffer.pyx:542`
   


-- 
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