René's URL Explorer Experiment


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

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:088b0ea0-055c-1296-3885-c1efbd8d1cc5
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idBAD2:D440C:2543A5A:331B655:6A631770
html-safe-nonce9b742b1de0d38a8ce9792e4174fb7102cfdb04e76859fd87786cb05de4cac2a0
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQUQyOkQ0NDBDOjI1NDNBNUE6MzMxQjY1NTo2QTYzMTc3MCIsInZpc2l0b3JfaWQiOiIzNTk4MTY5MzA1NjczNTcwMTYwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac6d1e7ccf89fef732d56990d543779167ff3f20d146240f9a3a773a8e80ffb2ac
hovercard-subject-tagpull_request:4103758857
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/simstudioai/sim/pull/5823/files
twitter:imagehttps://avatars.githubusercontent.com/u/40672544?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/40672544?s=400&v=4
og:image:altSummary 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_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None1a6c056e02f174fffc096c521ec0ff6fb83e40a2ec8cb8875466ec1524872dd6
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/simstudioai/sim git https://github.com/simstudioai/sim.git
octolytics-dimension-user_id199344406
octolytics-dimension-user_loginsimstudioai
octolytics-dimension-repository_id912559512
octolytics-dimension-repository_nwosimstudioai/sim
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id912559512
octolytics-dimension-repository_network_root_nwosimstudioai/sim
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release6a93e25585f487ddff9e3996c06d5b869d6e1828
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/simstudioai/sim/pull/5823/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F5823%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
Code QualityEnforce quality at mergehttps://github.com/features/code-quality
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F5823%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=simstudioai%2Fsim
Reloadhttps://github.com/simstudioai/sim/pull/5823/files
Reloadhttps://github.com/simstudioai/sim/pull/5823/files
Reloadhttps://github.com/simstudioai/sim/pull/5823/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/5823/files
simstudioai https://github.com/simstudioai
simhttps://github.com/simstudioai/sim
Notifications https://github.com/login?return_to=%2Fsimstudioai%2Fsim
Fork 3.7k https://github.com/login?return_to=%2Fsimstudioai%2Fsim
Star 29.2k https://github.com/login?return_to=%2Fsimstudioai%2Fsim
Code https://github.com/simstudioai/sim
Issues 111 https://github.com/simstudioai/sim/issues
Pull requests 119 https://github.com/simstudioai/sim/pulls
Actions https://github.com/simstudioai/sim/actions
Projects https://github.com/simstudioai/sim/projects
Security and quality 0 https://github.com/simstudioai/sim/security
Insights https://github.com/simstudioai/sim/pulse
Code https://github.com/simstudioai/sim
Issues https://github.com/simstudioai/sim/issues
Pull requests https://github.com/simstudioai/sim/pulls
Actions https://github.com/simstudioai/sim/actions
Projects https://github.com/simstudioai/sim/projects
Security and quality https://github.com/simstudioai/sim/security
Insights https://github.com/simstudioai/sim/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
waleedlatif1https://github.com/waleedlatif1
staginghttps://github.com/simstudioai/sim/tree/staging
fix/mcp-ssrf-validate-at-connecthttps://github.com/simstudioai/sim/tree/fix/mcp-ssrf-validate-at-connect
Conversation 32 https://github.com/simstudioai/sim/pull/5823
Commits 7 https://github.com/simstudioai/sim/pull/5823/commits
Checks 17 https://github.com/simstudioai/sim/pull/5823/checks
Files changed https://github.com/simstudioai/sim/pull/5823/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/5823/files
fix(mcp): replace single-IP pinning with validate-at-connect SSRF guard https://github.com/simstudioai/sim/pull/5823/files#top
Show all changes 7 commits https://github.com/simstudioai/sim/pull/5823/files
f6bd96b fix(mcp): replace single-IP pinning with validate-at-connect SSRF guard waleedlatif1 Jul 21, 2026 https://github.com/simstudioai/sim/pull/5823/commits/f6bd96b3688923377dd9050e2b271a7c288a54fd
a518963 fix(mcp): restore IPv4 preference and harden the guarded redirect fol… waleedlatif1 Jul 21, 2026 https://github.com/simstudioai/sim/pull/5823/commits/a518963f55f5116a17a76346b6cf28ed289808ee
b8c5552 Merge origin/staging (lockfile advisory fix + latest base) waleedlatif1 Jul 21, 2026 https://github.com/simstudioai/sim/pull/5823/commits/b8c55521c4127e285452a7912ad67274c252e661
b5adb51 fix(mcp): annotate headers double-cast and cancel redirect body befor… waleedlatif1 Jul 21, 2026 https://github.com/simstudioai/sim/pull/5823/commits/b5adb5197aa381c0541814c8ee2f6ad3e2e14792
ccde12e fix(mcp): keep self-hosted private-resolving hosts unguarded (old-pin… waleedlatif1 Jul 21, 2026 https://github.com/simstudioai/sim/pull/5823/commits/ccde12e54c50fee891e00d904ff7b4da3df189ac
8ada731 fix(mcp): pin (not skip) self-hosted private resolutions; refuse cros… waleedlatif1 Jul 21, 2026 https://github.com/simstudioai/sim/pull/5823/commits/8ada731f33cd1c52b6b777f6f1905e506dacbe0d
616abae chore(mcp): true up stale pinned-era doc comments waleedlatif1 Jul 21, 2026 https://github.com/simstudioai/sim/pull/5823/commits/616abae40424cb1b6b10a220770fad1a08044018
Clear filters https://github.com/simstudioai/sim/pull/5823/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/5823/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/5823/files
input-validation.server.ts https://github.com/simstudioai/sim/pull/5823/files#diff-6aff011dd9656fc3e2283ce7a33580a51622749a977dcacb0b75050284426798
ssrf-guarded-lookup.test.ts https://github.com/simstudioai/sim/pull/5823/files#diff-48ff37cd8c98deeac5957e331ceba4fdd0b7e6347e18ccd982441c37ecd72c41
client.test.ts https://github.com/simstudioai/sim/pull/5823/files#diff-3c669f1cfdbdbd74ae67141932035c61beea21909c92d6e0b8ad9f26b569dcab
client.ts https://github.com/simstudioai/sim/pull/5823/files#diff-25cb24353597fac644145b37622d21ec7315282c29ccb1c4275f3ccb46441e1a
revoke.test.ts https://github.com/simstudioai/sim/pull/5823/files#diff-9141de4ac0edfc2350705d5dcbdb47f819796bd1f692a6c1f81c4e5be91e3d95
pinned-fetch.test.ts https://github.com/simstudioai/sim/pull/5823/files#diff-eb3b541d290de33fb3e61f5b074e2cfdb26cfd7a770a0ce1566316334a5ffec9
pinned-fetch.ts https://github.com/simstudioai/sim/pull/5823/files#diff-762eddc0923a0e087da8b1ddba48178609b8d41572e63b65e0cc2d027e79648c
apps/sim/lib/core/security/input-validation.server.tshttps://github.com/simstudioai/sim/pull/5823/files#diff-6aff011dd9656fc3e2283ce7a33580a51622749a977dcacb0b75050284426798
View file https://github.com/simstudioai/sim/blob/616abae40424cb1b6b10a220770fad1a08044018/apps/sim/lib/core/security/input-validation.server.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/5823/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/5823/files#diff-6aff011dd9656fc3e2283ce7a33580a51622749a977dcacb0b75050284426798
https://github.com/simstudioai/sim/pull/5823/files#diff-6aff011dd9656fc3e2283ce7a33580a51622749a977dcacb0b75050284426798
https://github.com/simstudioai/sim/pull/5823/files#diff-6aff011dd9656fc3e2283ce7a33580a51622749a977dcacb0b75050284426798
Please reload this pagehttps://github.com/simstudioai/sim/pull/5823/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/5823/files
https://github.com/simstudioai/sim/pull/5823/files#diff-6aff011dd9656fc3e2283ce7a33580a51622749a977dcacb0b75050284426798
Please reload this pagehttps://github.com/simstudioai/sim/pull/5823/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/5823/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.