Add redirect protection to prevent SSRF attacks#19
Add redirect protection to prevent SSRF attacks#19auldsyababua wants to merge 1 commit intomcpjungle:mainfrom
Conversation
- Implement secure HTTP client with CheckRedirect function that blocks all redirects - Add comprehensive test coverage for both redirect blocking and normal operation - Prevents SSRF attacks and credential leakage through malicious redirects - Uses Go standard library http.ErrUseLastResponse pattern (industry best practice) - Zero performance overhead, follows OWASP security guidelines Security benefits: - Blocks redirects to prevent internal/external malicious service access - Protects Bearer tokens from leaking to unauthorized redirect targets - Ensures MCP connections go only to intended endpoints Test coverage: - TestCreateMcpServerConnBlocksRedirects: Verifies redirect blocking - TestCreateMcpServerConnWorksWithoutRedirects: Ensures no regression
|
@auldsyababua I tested the PR out, great work! What do you think about making the error message better? Currently, this is the output when I try to connect to a MCP server that redirects: The error message can be better, like Will be merging & releasing this in a few days. Reason I want to wait a few days to release this: Although the code works as intended, it is also rejecting genuine MCP servers written with the python SDK because of this issue and this one. Apparently when using streamable http, if the client makes a request to But this issue has been fixed in the latest mcp package release 1.12. So let's give people some time to upgrade their package to the latest. |
a6a3ae0 to
cbf8ba1
Compare
67f2579 to
6709e3a
Compare
e6f9f3d to
321f552
Compare
Security benefits:
Test coverage: