Skip to content

bug: schema validation does not detect circular $ref — can infinite loop #96

Description

@nfvelten

Migrated from nfvelten/arbitus#124

Summary

JSON Schema allows $ref to reference other schema definitions. If an upstream MCP server returns a schema with a circular $ref (A → B → A), the schema validation middleware could loop infinitely while resolving the reference chain.

Location

src/middleware/schema_validation.rs

Fix

Track visited $ref paths during schema resolution. Return an error (and block the request) if a cycle is detected.

References

  • PROPOSAL.md §4.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingp3Low priority

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions