Skip to content

Commit 68ed795

Browse files
committed
Update conformance tests with DNS rebinding protection
Signed-off-by: Daniel Garnier-Moiroux <git@garnier.wf>
1 parent 9903b56 commit 68ed795

File tree

4 files changed

+6
-8
lines changed

4 files changed

+6
-8
lines changed

conformance-tests/VALIDATION_RESULTS.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,12 @@
1515
- **Resources (4/6):** list, read-text, read-binary, templates-read
1616
- **Prompts (4/4):** list, simple, with-args, embedded-resource, with-image
1717
- **SSE Transport (2/2):** Multiple streams
18-
- **Security (1/2):** Localhost validation passes
18+
- **Security (2/2):** Localhost validation passes, DNS rebinding protection
1919

2020
### Failing (3/40)
2121

2222
1. **resources-subscribe** - Not implemented in SDK
2323
2. **resources-unsubscribe** - Not implemented in SDK
24-
3. **dns-rebinding-protection** - Missing Host/Origin validation (1/2 checks)
2524

2625
## Client Test Results
2726

@@ -44,7 +43,6 @@
4443

4544
1. **Resource Subscriptions:** SDK doesn't implement `resources/subscribe` and `resources/unsubscribe` handlers
4645
2. **Client SSE Retry:** Client doesn't parse or respect the `retry:` field, reconnects immediately, and doesn't send Last-Event-ID header
47-
3. **DNS Rebinding Protection:** Missing Host/Origin header validation in server transport
4846

4947
## Running Tests
5048

conformance-tests/conformance-baseline.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ server:
66
# Resource subscription not implemented in SDK
77
- resources-subscribe
88
- resources-unsubscribe
9-
10-
# DNS rebinding protection missing Host/Origin validation
11-
- dns-rebinding-protection
129

1310
client:
1411
# SSE retry field handling not implemented

conformance-tests/server-servlet/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ The server has been validated against the official [MCP conformance test suite](
3232
**SSE Transport** (2/2)
3333
- Multiple streams support
3434

35-
⚠️ **Security** (1/2)
36-
- ⚠️ DNS rebinding protection (SDK limitation)
35+
**Security** (2/2)
36+
- DNS rebinding protection
3737

3838
## Features
3939

conformance-tests/server-servlet/src/main/java/io/modelcontextprotocol/conformance/server/ConformanceServlet.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import io.modelcontextprotocol.server.McpServer;
99
import io.modelcontextprotocol.server.McpServerFeatures;
10+
import io.modelcontextprotocol.server.transport.DefaultServerTransportSecurityValidator;
1011
import io.modelcontextprotocol.server.transport.HttpServletStreamableServerTransportProvider;
1112
import io.modelcontextprotocol.spec.McpSchema.AudioContent;
1213
import io.modelcontextprotocol.spec.McpSchema.BlobResourceContents;
@@ -66,6 +67,8 @@ public static void main(String[] args) throws Exception {
6667
.builder()
6768
.mcpEndpoint(MCP_ENDPOINT)
6869
.keepAliveInterval(Duration.ofSeconds(30))
70+
.securityValidator(
71+
DefaultServerTransportSecurityValidator.builder().allowedOrigin("http://localhost:*").build())
6972
.build();
7073

7174
// Build server with all conformance test features

0 commit comments

Comments
 (0)