Skip to content

Limit eager ExtensionObject decode recursion#1745

Merged
kevinherron merged 1 commit into
eclipse-milo:mainfrom
kevinherron:codex/fix-recursive-dos-vulnerability-in-decoding
May 17, 2026
Merged

Limit eager ExtensionObject decode recursion#1745
kevinherron merged 1 commit into
eclipse-milo:mainfrom
kevinherron:codex/fix-recursive-dos-vulnerability-in-decoding

Conversation

@kevinherron
Copy link
Copy Markdown
Contributor

Motivation

  • Prevent a denial-of-service vector where dynamic eager decoding recursively decodes nested ExtensionObject bodies without honoring the configured recursion budget, causing stack or heap exhaustion.
  • Keep existing behavior of eagerly decoding known/expected dynamic types where safe, but ensure a shared recursion budget prevents unbounded nested decodes.

Description

  • Add a thread-local recursion guard EAGER_DECODE_DEPTH and helper eagerlyDecodeExtensionObject(...) to FieldUtil so eager decoding of scalar, array, matrix, and Variant-contained ExtensionObjects checks EncodingLimits.getMaxRecursionDepth() and increments/decrements a local depth counter.
  • Replace direct calls to xo.decode(...) in maybeEagerlyDecodeValue(...) with calls to eagerlyDecodeExtensionObject(...) so nested eager decodes share the same per-thread depth budget.
  • Add a regression test eagerExtensionObjectDecodeHonorsMaxRecursionDepth and helper nestedStructWithStructureScalarFields(...) in DynamicTypeSerializationTest that constructs nested ExtensionObjects and verifies eager decoding halts at the configured depth and leaves deeper values opaque.

Codex Task

@kevinherron kevinherron added this to the 1.1.4 milestone May 17, 2026
@kevinherron kevinherron merged commit f8b6034 into eclipse-milo:main May 17, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant