Skip to content

fix: limit extends chain depth to prevent stack overflow DoS#91

Open
Jaro-c wants to merge 1 commit into
developfrom
fix/extends-depth-limit
Open

fix: limit extends chain depth to prevent stack overflow DoS#91
Jaro-c wants to merge 1 commit into
developfrom
fix/extends-depth-limit

Conversation

@Jaro-c

@Jaro-c Jaro-c commented Jun 10, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds MAX_EXTENDS_DEPTH = 16 constant
  • Both resolve_one_extends and resolve_one_extends_in_memory check the depth counter on entry and return a clear ComposeError::Extends if exceeded — no unbounded recursion on crafted compose files
  • Two new tests: chain of 15 hops accepted, chain of 16 hops rejected with an "exceeds maximum depth" error message

Closes #80

Test plan

  • cargo test passes (446 tests)
  • extends_chain_within_depth_limit passes
  • extends_chain_exceeds_depth_limit passes

Closes #80

Adds a MAX_EXTENDS_DEPTH (16) guard to both resolve_one_extends and
resolve_one_extends_in_memory. Any extends chain deeper than 16 levels
returns a clear error instead of recursing until stack exhaustion.
Two tests cover the boundary: 15 hops accepted, 16 hops rejected.

Signed-off-by: Jaro-c <75870284+Jaro-c@users.noreply.github.com>
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.

1 participant