Skip to content

One deeply nested resource freezes the whole resources file #13

Open

Description

@shreemaan-abhishek

Problem

Free-form fields accept arbitrary nesting: ProviderKey request.default_body_fields values, Model semantic.classifier.on_failure and semantic.on_embedding_failure. The gateway's YAML parser caps document depth (yaml-rust2 stores the level as a u8), and exceeding it is an unscoped (file) error (filesource/mod.rs#L417). Assemble then fails the whole document (assemble.go#L229).

Reproduce

250 nested objects under default_body_fields.x load; 251 fail with (file): YAML parse error: recursion limit exceeded. Every resource then shows ConfigurationRejected, and no change is written for anyone until the culprit is removed. The apiserver accepts far deeper bodies (about 10000 levels).

Impact

Anyone who can create a ProviderKey or Model can freeze configuration for the namespace. Serving continues on the last good file.

Scores

Reproducibility Likelihood Severity Existing mitigations Detectability Test coverage Fix cost vs benefit
10 2 6 1 6 2 8

Scores are out of 10. Higher is worse for likelihood and severity. Higher is better for mitigations, detectability, test coverage and cost vs benefit (10 = cheap fix, high value).

Fix

  • Cap nesting at render time (for example 128 levels per entry) with Rendered.Err, so only that resource falls back.
  • Follow-up: on an unscoped (file) error, validate halves to find the culprit. This also contains forged (file) lines (Newline in a display_name forges validator report lines #8).

Tests to add

A unit test for the cap, and a real-binary test at depth 251.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions