-
Notifications
You must be signed in to change notification settings - Fork 422
fix: validate server names to allow only single slash (#471) #476
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: validate server names to allow only single slash (#471) #476
Conversation
7964d83
to
c9ae434
Compare
75aafc5
to
10350ea
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Maybe we could actually add it as regex validation on the API types, which would show up in the docs and align the specs more?
Happy to merge this for now though
Hi @domdomegg, Thanks for the review and the great suggestion! I've added the regex validation directly to the API types as you recommended. The pattern ^[^/]+/[^/]+$ is now on the Name field in pkg/api/v0/types.go, which should make the validation visible in the API documentation and align the specs with the backend validation. This complements the existing validation logic nicely - clients can now see the expected format in the API docs, and we still have the detailed error handling in the backend. Let me know if this looks good to you! new PR here: #479 |
Add proper boundary validation to prevent domains like micro.com from claiming permissions for com.microsoft/* through prefix overlap attacks. Changes: - Add delimiter checking after domain prefix (must be . or /) - Enforce single-slash rule for server names per PR modelcontextprotocol#476 - Add comprehensive test cases for prefix attack scenarios - Update existing tests to align with new validation rules The validation now ensures name patterns have proper delimiters and follow the established server naming conventions.
…tprotocol#481) Implements optional n=<pattern> parameter in DNS TXT records to allow fine-grained permission scoping for server names. This enables DNS controllers to delegate limited namespaces to different teams while maintaining security isolation. Key changes: - Added DNSAuthRecord struct to support name patterns alongside public keys - Collect all valid DNS records instead of stopping at first match - Validate name patterns must start with reverse domain to prevent cross-domain privilege escalation - Add delimiter checking after domain prefix (must be . or /) - Enforce single-slash rule for server names per PR modelcontextprotocol#476 - Added comprehensive tests for all scoping scenarios Example usage: v=MCPv1; k=ed25519; p=<key>; n=com.example/team-foo-* This change addresses Microsoft's requirement for granular permission control within path portions while preserving existing behavior for records without the n= parameter. Fixes modelcontextprotocol#481
Summary
Added validation to reject server names with multiple slashes, ensuring consistency between JSON schema pattern and API validation.
Motivation and Context
Fixes #471. The JSON schema regex pattern
^[^/]+/[^/]+$
only allows a single slash in server names, but the API validation was not enforcing this constraint. This inconsistencyallowed invalid server names like
com.example/server/path
to be published.How Has This Been Tested?
Breaking Changes
None. This change only adds validation to reject previously invalid server names that shouldn't have been accepted.
Types of changes
Checklist
Additional context
namespace/name
(e.g.,com.example/my-server
)com.example//server
,com.example/server/
, anda/b/c/d/e/f