modelcontextprotocol / modelcontextprotocol/php-sdk

[Schema] SEP-2106: Harden SchemaValidator against external $ref SSRF and composition DoS

Open
#358 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

2026-07-28 enhancement improves spec compliance Schema
Dominant language
PHP
Stars
1.6k
Forks
173
Avg merge
2d 49m
Merged PRs (30d)
23

Description

Implements the security hardening portion of SEP-2106 for the MCP Spec 2026-07-28 release.

Tracked by umbrella #337.

Spec rationale

Once $ref and rich composition land in inputSchema/outputSchema, naive validators are exposed to: SSRF via external $ref URIs, and DoS via pathological compositions / deep nesting / large subschema counts.

PHP SDK changes

  • SchemaValidator MUST NOT auto-dereference external $ref URIs (block any non-same-document reference by default).
  • Bound: schema depth, subschema count, validation time.
  • Configurable limits with sensible defaults (mirror existing session-store DoS limit ergonomics).
  • Add regression tests with adversarial schemas.

Related

  • Umbrella #337
  • Vocabulary sub-issue (introduces $ref support that this hardens)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at SchemaValidator and inspect the existing session-store DoS limit configuration for the intended limit ergonomics and defaults. Review current $ref handling, then add adversarial regression coverage for external references, deep nesting, large subschema counts, and validation time; done means external non-same-document references are blocked by default and the limits are configurable.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend-api-design, security
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.