Files
modelcontextprotocol--pytho…/docs
Max Isbey c1a1787286 refactor: remove post-decode structural checks from UriTemplate.match
UriTemplate.match() no longer rejects decoded values containing
characters like /, ?, #, &. It now faithfully returns whatever
expand() would have encoded, so match(expand(x)) == x holds for all
inputs.

The previous check broke round-trip for legitimate values (a&b
expanded to a%26b but match rejected it) and was inconsistent with
every other MCP SDK. The spec's own canonical example file:///{path}
requires multi-segment values; Kotlin and C# already decode without
rejection and document handler-side validation as the security
contract.

Path-safety validation remains in ResourceSecurity (configurable) and
safe_join (the gold-standard check). The %2F path-traversal attack
vector is still blocked: ..%2Fetc%2Fpasswd decodes to ../etc/passwd,
which contains_path_traversal rejects. Tests confirm this end-to-end.

This aligns us with Kotlin's documented model: decode once, pass to
handler, handler validates.
2026-03-26 21:16:22 +00:00
..
2026-01-25 14:45:52 +01:00