Repository navigation
.NET/Python: Improve MCP skill resource validation - #8690
SergeyMenshykh merged 5 commits into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Critical encoded-delimiter traversal bypasses and additional URI/path validation issues remain unresolved.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 2
Open (3)
What changed in this PR
Improves MCP skill resource-name validation across .NET and Python while preserving supported URI schemes.
Changes:
- Adds layered decoding and unsafe-path validation.
- Expands cross-language tests and documentation.
- Adds .NET rejection logging.
| File | Description |
|---|---|
python/packages/core/tests/core/test_mcp_skills.py |
Expands validation and URI-scheme tests. |
python/packages/core/agent_framework/_skills.py |
Implements layered resource-name validation. |
dotnet/tests/Microsoft.Agents.AI.Mcp.UnitTests/Skills/AgentMcpSkillsSourceTests.cs |
Adds equivalent .NET test coverage. |
dotnet/src/Microsoft.Agents.AI.Mcp/Skills/Loaders/SkillMdEntryLoader.cs |
Propagates logging to MCP skills. |
dotnet/src/Microsoft.Agents.AI.Mcp/Skills/AgentMcpSkillsSource.cs |
Documents resource security behavior. |
dotnet/src/Microsoft.Agents.AI.Mcp/Skills/AgentMcpSkill.cs |
Adds validation and rejection logging. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
MAF Automated Review — Iteration 1
Result: Findings reported
Scope: full PR (1 commit(s)): e11dc4a66efb
Model: gpt-5.6-sol-fast
Overview
The PR adds cross-language validation for absolute paths, traversal at multiple percent-encoding depths, embedded URI forms, and control characters, with permissive-server tests confirming rejected names never reach the MCP transport. It also preserves valid resource identifiers and root schemes. Two gaps remain: encoded delimiters can hide encoded traversal from the segment check, and recursively decoding without a bound permits request-local CPU exhaustion.
Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
2 verified findings remained after source verification (2 medium) across 1 file. Details are attached to the affected lines below.
Affected areas: dotnet/src/Microsoft.Agents.AI.Mcp/Skills/AgentMcpSkill.cs
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Split names at the first literal query/fragment delimiter, then decode the path and suffix independently. Make the Python decoder recursive with a bounded LRU cache that preserves the decoding depth limit. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Eduard van Valkenburg (eavanvalkenburg)
left a comment
There was a problem hiding this comment.
LGTM for Python


Motivation & Context
Strengthen MCP skill resource-name validation while preserving supported resource identifiers and URI schemes
Description & Review Guide
Related Issue
N/A.
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.