fix(security): add SSRF protection for webhook and MCP server URLs#547
Open
JasonOA888 wants to merge 1 commit into
Open
fix(security): add SSRF protection for webhook and MCP server URLs#547JasonOA888 wants to merge 1 commit into
JasonOA888 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Vulnerability: Server-Side Request Forgery (SSRF) via Webhook and MCP Server URLs (P0)
Summary
Users can configure
webhookUrl(in project settings) andcustomMcpServers[].serverUrl(in MCP server config) to point to internal network addresses. The existingvalidateHttpHttpsUrlonly checks the protocol scheme but does not validate that the resolved IP address is not private/internal.Impact
http://169.254.169.254/latest/meta-data/(AWS/GCP/Azure metadata endpoint) to steal cloud credentials, IAM roles, and instance metadata.10.x.x.x,192.168.x.x,172.16-31.x.xranges.localhost/127.0.0.1can reach internal services not meant to be externally accessible.Fix
Created a shared SSRF validation utility (
apps/rowboat/app/lib/ssrf-protection.ts) that:10.0.0.0/8(Class A private)172.16.0.0/12(Class B private)192.168.0.0/16(Class C private)127.0.0.0/8(Loopback)169.254.0.0/16(Link-local / cloud metadata)::1(IPv6 loopback)fc00::/7(IPv6 unique local)Enhanced
validateHttpHttpsUrlinadd-custom-mcp-server.use-case.tsto call the SSRF validator before accepting a custom MCP server URL.Added SSRF check before the
fetch(project.webhookUrl, ...)call inagent-tools.tsto validate webhook URLs at invocation time.Test Plan
webhookUrltohttp://169.254.169.254/latest/meta-data/— should be rejectedwebhookUrltohttp://localhost:8080— should be rejectedwebhookUrltohttp://10.0.0.1/internal— should be rejectedwebhookUrltohttp://192.168.1.1/admin— should be rejectedwebhookUrlto a valid public URL — should work normallycustomMcpServers[].serverUrl