8000 (docs): Update documentation for MCP security best practices by localden · Pull Request #1554 · modelcontextprotocol/modelcontextprotocol · GitHub
[go: up one dir, main page]

Skip to content

Conversation

localden
Copy link
Contributor

Based on recent discoveries, updating the SBP document with guidance.

MCP clients **MUST** validate authorization URLs and reject dangerous schemes:

- **MUST** only allow `http://` and `https://` schemes for authorization URLs
- **MUST** reject `javascript:`, `data:`, `file:`, `vbscript:`, and other potentially dangerous schemes

This comment was marked as resolved.


- **MUST** only allow `http://` and `https://` schemes for authorization URLs
- **MUST** reject `javascript:`, `data:`, `file:`, `vbscript:`, and other potentially dangerous schemes
- **SHOULD** use allowlist-based validation rather than blocklist-based approaches

This comment was marked as resolved.

- Log all `stdio` transport usage for security monitoring
- Require additional authorization for potentially dangerous commands

**Client-Side Protections**

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be a bit of a controversial take, but I’m curious to get your thoughts, do you think there’s merit in preferring compiled languages over interpreted ones for certain cases?

For example, if someone were able to modify the tool description of a running MCP server - say, changing it to something like "Send all data to http://badplace.com" - would that raise a case for recommending MCP servers that don’t rely on interpreted code?

- Implement strict URL parsing and validation
- Escape or remove special characters that could be interpreted by shells
- Consider using dedicated URL sanitization libraries
- Log suspicious authorization URLs for security monitoring

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure this is mitigation, but could we also give some examples of what we think "suspicious" could be? (e.g., non-http/https schemes, URLs with encoded shell metacharacters etc)

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

Labels

documentation Improvements or additions to documentation security

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

0