Skip to content

Fix Any recursion depth bypass in Python json_format.ParseDict (#25239)#25586

Merged
zhangskz merged 1 commit into33.xfrom
cp-python-json-recursion
Jan 29, 2026
Merged

Fix Any recursion depth bypass in Python json_format.ParseDict (#25239)#25586
zhangskz merged 1 commit into33.xfrom
cp-python-json-recursion

Conversation

@zhangskz
Copy link
Member

This fixes a security vulnerability where nested google.protobuf.Any messages could bypass the max_recursion_depth limit, potentially leading to denial of service via stack overflow.

The root cause was that _ConvertAnyMessage() was calling itself recursively via methodcaller() for nested well-known types, bypassing the recursion depth tracking in ConvertMessage().

The fix routes well-known type parsing through ConvertMessage() to ensure proper recursion depth accounting for all message types including nested Any.

Fixes #25070

Closes #25239

COPYBARA_INTEGRATE_REVIEW=#25239 from aviralgarg05:fix-any-recursion-depth-bypass 3cbbcbe PiperOrigin-RevId: 862740421

This fixes a security vulnerability where nested google.protobuf.Any messages could bypass the max_recursion_depth limit, potentially leading to denial of service via stack overflow.

The root cause was that _ConvertAnyMessage() was calling itself recursively via methodcaller() for nested well-known types, bypassing the recursion depth tracking in ConvertMessage().

The fix routes well-known type parsing through ConvertMessage() to ensure proper recursion depth accounting for all message types including nested Any.

Fixes #25070

Closes #25239

COPYBARA_INTEGRATE_REVIEW=#25239 from aviralgarg05:fix-any-recursion-depth-bypass 3cbbcbe
PiperOrigin-RevId: 862740421
@zhangskz zhangskz requested a review from a team as a code owner January 29, 2026 19:07
@zhangskz zhangskz requested review from ericsalo and removed request for a team January 29, 2026 19:07
@zhangskz zhangskz merged commit c4eda3e into 33.x Jan 29, 2026
220 of 222 checks passed
@zhangskz zhangskz deleted the cp-python-json-recursion branch January 29, 2026 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants