Commit 150d9f9
Complete earlier fixes and align the reader further with reference parsers
Five earlier review threads were addressed for the case raised but not
its neighbour. This commit closes them properly:
- InMemoryMcpSkillCatalog now hands out copies from ListAsync and GetAsync,
not only on construction, so a mutated result cannot change later responses.
- URI validation decodes each path segment before checking for '.', '..',
and separators, since System.Uri (and therefore the resource collection)
treats "%2e%2e" as "..".
- An unterminated quoted scalar is malformed and no longer reaches the
explicit-frontmatter escape hatch; a quote closed on a later line is
still classified as unsupported multi-line YAML and remains bypassable.
- Directory loading reads each file with a buffer of the length it
checked and fails if the file changed size, so a file growing between
the check and the read can neither exceed the limit nor be served with
a manifest that does not describe it.
- URI aliases that differ only in scheme or authority case are rejected
even with identical content, because the resource collection would
serve one resource whose contents carry the first URI, failing a
verified read of the second.
Further alignment with reference YAML parsers, each confirmed against the
yaml npm package: plain mapping keys resolve like values ("TRUE:" is the
key "true", "0x10:" is "16"), flow mappings honour YAML's separator rules
("{version:1}" is the key "version:1" with a null value), a plain scalar
ended by a comment cannot continue on the next line, and only space and
tab are trimmed, so non-breaking spaces stay in scalars. Nesting is capped
at 32 levels so a hostile file cannot exhaust the stack.
Skill names accept Unicode lowercase and caseless letters, per the Agent
Skills wording "unicode lowercase alphanumeric characters". A test that
relied on reflection-based serialization now uses the SDK's options, so
the skills tests pass on net9.0 and net8.0 as well as net10.0.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P6omaTvQiryHtzFHRqUE3b1 parent 8e8379a commit 150d9f9
11 files changed
Lines changed: 338 additions & 52 deletions
File tree
- docs/concepts/skills
- src/ModelContextProtocol.Extensions.Skills
- Server
- tests/ModelContextProtocol.Tests/Server
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
92 | | - | |
| 91 | + | |
| 92 | + | |
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| |||
Lines changed: 7 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
| 14 | + | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | | - | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
95 | 98 | | |
96 | 99 | | |
97 | 100 | | |
| |||
112 | 115 | | |
113 | 116 | | |
114 | 117 | | |
115 | | - | |
116 | | - | |
| 118 | + | |
117 | 119 | | |
118 | 120 | | |
119 | 121 | | |
| |||
Lines changed: 30 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
484 | 484 | | |
485 | 485 | | |
486 | 486 | | |
487 | | - | |
| 487 | + | |
488 | 488 | | |
489 | 489 | | |
490 | 490 | | |
491 | 491 | | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
492 | 521 | | |
493 | 522 | | |
494 | 523 | | |
| |||
Lines changed: 13 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| |||
77 | 78 | | |
78 | 79 | | |
79 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
80 | 91 | | |
81 | 92 | | |
82 | 93 | | |
83 | | - | |
84 | | - | |
85 | | - | |
| 94 | + | |
86 | 95 | | |
87 | 96 | | |
88 | 97 | | |
| |||
0 commit comments