-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Two things:
- Add a section on DNS rebinding protection in the README
- Return valid json rpc messages when the allowedHosts or allowedOrigins parameters block a request
Adding DNS Rebinding Explanation to README
The spec and the modelcontextprotocol/sdk make several mentions of DNS rebinding attacks, especially when running locally. There is a switch in their ts sdk:
const transport = new StreamableHTTPServerTransport({
sessionIdGenerator: () => randomUUID(),
enableDnsRebindingProtection: true,
allowedHosts: ['127.0.0.1', ...],
allowedOrigins: ['https://yourdomain.com', 'https://www.yourdomain.com']
});
We support allowed hosts and allowed origins already, which should be enough, but worth adding to the README.
As a note on the modelcontextprotocol sdk, disabling the flag enableDnsRebindingProtection
just neglects to check headers entirely
Returning JSON RPC when origin and host headers are not allowed
The modelcontextprotocol sdk responds with a json rpc message (see below), but right now we just do an http text response of Forbidden
res.writeHead(403).end(JSON.stringify({
jsonrpc: "2.0",
error: {
code: -32000,
message: validationError
},
id: null
}));
Metadata
Metadata
Assignees
Labels
No labels