Skip to content

MCP schema validator's additionalProperties check misses the omitted-key and empty-object equivalents of unbounded #2553

Closed

Description

@mstomar125

Problem

PR #2551's `validate_tool_schema`/`check_schema_depth` (`packages/cli/src/commands/mcp.rs`) enforces ADR-038's "no unbounded `additionalProperties`" requirement, but only rejects the explicit `additionalProperties: true` case.

Per the JSON Schema spec, an omitted `additionalProperties` key defaults to `true` (unbounded), and `additionalProperties: {}` (an unconstrained schema) is equally unbounded — neither is currently caught.

Why this wasn't a blocker for #2551

The schema currently validated is hardcoded (the single passthrough tool's own fixed schema), not externally supplied, so this gap isn't exploitable today. Flagged during adversarial review as worth closing before this validator is ever pointed at a genuinely external/registry-generated schema.

Acceptance criteria

  • `check_schema_depth` (or wherever the `additionalProperties` check lives) treats an omitted `additionalProperties` key and `additionalProperties: {}` as unbounded, same as `additionalProperties: true`
  • Tests covering both the omitted-key and empty-object cases (currently only `additionalProperties: true` is tested)
  • Tests pass (`bun run test:all`), code passes `bun run quality:fix`

Related

Activity

  1. self-assigned this
    on Sep 10, 2026
  2. mstomar125 commented on Sep 10, 2026

    @mstomar125
    ContributorAuthor

    Fixed in PR #2557.

    check_schema_depth now treats an omitted additionalProperties key and additionalProperties: {} as unbounded, same as the explicit true case, on any schema fragment that describes a JSON object ("type": "object" or a properties map).

    The real passthrough tool schema now carries an explicit additionalProperties: false (it previously relied on the omitted-key loophole this closes). Added 4 new tests covering the omitted-key and empty-object cases at both the top level and nested inside properties; all mutation-tested individually. Full bun run test:all is green.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions