Title: fix(mcp): replace single-IP pinning with validate-at-connect SSRF guard by waleedlatif1 · Pull Request #5823 · simstudioai/sim · GitHub
Open Graph Title: fix(mcp): replace single-IP pinning with validate-at-connect SSRF guard by waleedlatif1 · Pull Request #5823 · simstudioai/sim
X Title: fix(mcp): replace single-IP pinning with validate-at-connect SSRF guard by waleedlatif1 · Pull Request #5823 · simstudioai/sim
Description: Summary Replaces the MCP transport + OAuth guard's single-IP pinning with the standard validate-at-connect SSRF pattern (LibreChat getSSRFConnect): DNS resolves normally, and every socket connect filters the resolved addresses against the private/reserved blocklist. No reference MCP client pins IPs; pinning welded each attempt to one address with no fallback and is the prime suspect in the headers-then-zero-body stalls (failed first attempt → instant retry via resolver rotation, 50/50 rotation proven). Adversarially security-reviewed before shipping (dedicated red-team pass with live undici tests). Verdict: the hostname rebinding/TOCTOU window is genuinely closed (proven), IPv6 embedded-private forms all blocked (NAT64/6to4/Teredo/v4-mapped verified against isPrivateOrReservedIP). Two findings — both closed in this PR: IP-literal redirect bypass (shared by the old pin, not a regression): Node skips a custom lookup for numeric hosts, so a 3xx to http://169.254.169.254/ dialed directly. Redirects are now followed manually with per-hop validation (protocol + IP-literal checks, 5-hop cap). Cross-origin header retention: undici keeps custom headers (e.g. x-api-key) across cross-origin redirects. Custom headers are now dropped on any cross-origin hop. Policy gating unchanged: guard activates exactly where the pin did (validateMcpServerSsrf non-null); allowlist mode / localhost-on-self-hosted remain unguarded; OAuth legs keep per-hop up-front validation. Non-MCP pinned-fetch consumers (LLM providers, A2A, probe) untouched. Type of Change Bug fix / security hardening Testing 397 tests green across the MCP + security suites, including new coverage: rebinding (public→private flip blocked on second connect), mixed private+public DNS answers filtered, redirect to metadata IP-literal blocked, bracketed IPv6 literal blocked, non-http(s) protocols blocked, hop cap, 303-POST→GET and 307 semantics, cross-origin header stripping, same-origin header retention. tsc + biome clean. Checklist Code follows project style guidelines Self-reviewed my changes Tests added/updated and passing No new warnings introduced I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)
Open Graph Description: Summary Replaces the MCP transport + OAuth guard's single-IP pinning with the standard validate-at-connect SSRF pattern (LibreChat getSSRFConnect): DNS resolves normally, and every socket conn...
X Description: Summary Replaces the MCP transport + OAuth guard's single-IP pinning with the standard validate-at-connect SSRF pattern (LibreChat getSSRFConnect): DNS resolves normally, and every socket ...
Opengraph URL: https://github.com/simstudioai/sim/pull/5823
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:088b0ea0-055c-1296-3885-c1efbd8d1cc5 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | BAD2:D440C:2543A5A:331B655:6A631770 |
| html-safe-nonce | 9b742b1de0d38a8ce9792e4174fb7102cfdb04e76859fd87786cb05de4cac2a0 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQUQyOkQ0NDBDOjI1NDNBNUE6MzMxQjY1NTo2QTYzMTc3MCIsInZpc2l0b3JfaWQiOiIzNTk4MTY5MzA1NjczNTcwMTYwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 6d1e7ccf89fef732d56990d543779167ff3f20d146240f9a3a773a8e80ffb2ac |
| hovercard-subject-tag | pull_request:4103758857 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/simstudioai/sim/pull/5823/files |
| twitter:image | https://avatars.githubusercontent.com/u/40672544?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/40672544?s=400&v=4 |
| og:image:alt | Summary Replaces the MCP transport + OAuth guard's single-IP pinning with the standard validate-at-connect SSRF pattern (LibreChat getSSRFConnect): DNS resolves normally, and every socket conn... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 1a6c056e02f174fffc096c521ec0ff6fb83e40a2ec8cb8875466ec1524872dd6 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/simstudioai/sim git https://github.com/simstudioai/sim.git |
| octolytics-dimension-user_id | 199344406 |
| octolytics-dimension-user_login | simstudioai |
| octolytics-dimension-repository_id | 912559512 |
| octolytics-dimension-repository_nwo | simstudioai/sim |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 912559512 |
| octolytics-dimension-repository_network_root_nwo | simstudioai/sim |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 6a93e25585f487ddff9e3996c06d5b869d6e1828 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width