fix: restrict browser origins, honor ListenAddress, tighten JSON-RPC handling (1.4.2)
- OriginPolicy: only localhost, private/loopback IP origins, ServerUrl origin and the new AllowedOrigins setting may call the MCP port from a browser; others get 403 (blocks cross-site reads and DNS rebinding). No more reflected origin with Allow-Credentials. - ListenAddress is now used for the HttpListener prefix; warn when the server listens on all interfaces without an API key. - JSON-RPC: implement ping, never answer notifications, acknowledge client responses, negotiate protocolVersion, return 405 for GET /mcp and 404 for paths other than /mcp. - Tests for origin policy, listen prefix and protocol handling. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
37eb8b8a4e
commit
5b3dbc2d04
10 files changed
+256
-30
No files matched your search
@@ -132,8 +132,9 @@ foreach(var t in tools.EnumerateArray()) if(t.GetProperty("inputSchema").GetProp
|
||||
rows.Clear();
|
||||
var emptySeries=Run(new {seriesId="100"});
|
||||
Check(emptySeries.GetProperty("total").GetInt32()==0 && emptySeries.GetProperty("returned").GetInt32()==0 && !emptySeries.GetProperty("hasMore").GetBoolean(), "Empty series");
|
||||
Check(typeof(SeriesInventory).Assembly.GetName().Version.ToString(3)=="1.4.1", "Release version");
|
||||
Check(typeof(SeriesInventory).Assembly.GetName().Version.ToString(3)=="1.4.2", "Release version");
|
||||
AdvancedTests.Run();
|
||||
ProtocolTests.Run();
|
||||
InventoryReplay.Run();
|
||||
Console.WriteLine($"PASS: {passed} assertions; 35 episodes in 5 pages, no per-episode detail lookup.");
|
||||
|
||||
|
||||
Reference in new issue
Block a user