Title: ssrf: validateExternalUrl fails open when DNS lookup returns empty A/AAAA records · Issue #381 · JavaScriptSolidServer/JavaScriptSolidServer · GitHub
Open Graph Title: ssrf: validateExternalUrl fails open when DNS lookup returns empty A/AAAA records · Issue #381 · JavaScriptSolidServer/JavaScriptSolidServer
X Title: ssrf: validateExternalUrl fails open when DNS lookup returns empty A/AAAA records · Issue #381 · JavaScriptSolidServer/JavaScriptSolidServer
Description: Surfaced during Copilot review of #379 (cors-proxy). `validateExternalUrl()` in `src/utils/ssrf.js` swallows individual record-type lookup failures with `.catch(() => [])` and only fails closed if the outer try/catch fires. The path that...
Open Graph Description: Surfaced during Copilot review of #379 (cors-proxy). `validateExternalUrl()` in `src/utils/ssrf.js` swallows individual record-type lookup failures with `.catch(() => [])` and only fails closed if ...
X Description: Surfaced during Copilot review of #379 (cors-proxy). `validateExternalUrl()` in `src/utils/ssrf.js` swallows individual record-type lookup failures with `.catch(() => [])` and only fails closed ...
Opengraph URL: https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/issues/381
X: @github
Domain: github.com
IPv4 address: 140.82.113.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ssrf: validateExternalUrl fails open when DNS lookup returns empty A/AAAA records","articleBody":"Surfaced during Copilot review of #379 (cors-proxy).\n\n\\`validateExternalUrl()\\` in \\`src/utils/ssrf.js\\` swallows individual record-type lookup failures with \\`.catch(() => [])\\` and only fails closed if the outer try/catch fires. The path that's *not* covered: both \\`dns.resolve4\\` and \\`dns.resolve6\\` succeed but return empty arrays, or both return empty due to transient DNS issues.\n\nIn that case the loop iterates over zero IPs, finds no private one, returns \\`{ valid: true }\\`. The subsequent \\`fetch()\\` then resolves the hostname via the OS resolver, which may pick up a different (possibly private) address. SSRF check is bypassed.\n\n## Reproduction sketch\n- Hostname with no A/AAAA but a CNAME chain that the OS follows but Node's \\`dns.resolve4/6\\` doesn't (rare but legal)\n- Forced DNS failure on resolve4/6 while the OS cache still has an entry\n- Adversarial nameserver returning empty records to the validating resolver but a real address to the OS resolver\n\n## Suggested fix\n\nIn \\`validateExternalUrl()\\`, when the host is a hostname (not an IP) and DNS lookup is required, treat \\`addresses.length === 0 && addresses6.length === 0\\` as failure (return \\`{ valid: false, error: ... }\\`).\n\n\\`\\`\\`js\nconst addresses = await dns.resolve4(hostname).catch(() => []);\nconst addresses6 = await dns.resolve6(hostname).catch(() => []);\nif (addresses.length === 0 && addresses6.length === 0) {\n return { valid: false, error: \\`No A/AAAA records for \\${hostname}\\`, url: null };\n}\n\\`\\`\\`\n\n## Scope / blast radius\n\n\\`validateExternalUrl\\` / \\`safeFetch\\` are called from:\n- \\`src/handlers/cors-proxy.js\\` (the new proxy in #379)\n- ActivityPub federation outbound calls (\\`src/ap/*\\`)\n- Image / media proxying (if any)\n- Webledger lookups\n- Any future SSRF-sensitive callsite\n\nEvery consumer is by definition SSRF-sensitive, so failing closed on lookup-empty is the correct default. The risk of breaking legitimate hostnames with quirky DNS configs is small — those calls were going to fail at \\`fetch()\\` anyway.\n\n## Refs\n\n- #379 (PR) — the cors-proxy work that surfaced this\n- Copilot review thread on #379, comment id 3209275355\n- \\`src/utils/ssrf.js\\` lines ~109-125 (the resolve4/resolve6 block)","author":{"url":"https://github.com/melvincarvalho","@type":"Person","name":"melvincarvalho"},"datePublished":"2026-05-08T14:42:35Z","url":"https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/issues/381"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:57e103d3-7229-ce60-116b-59c86781eab1 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B824:3C4D7:28B8E50:3601F4E:6B038A0D |
| html-safe-nonce | 3038fae96d404131d3f34f6db45b408d0c049b49d1e373194b04c9891f9d5007 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCODI0OjNDNEQ3OjI4QjhFNTA6MzYwMUY0RTo2QjAzOEEwRCIsInZpc2l0b3JfaWQiOiI1NDY3NTcwNDQ3MDg2NDg4MDc3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | d207c6bb192321906098771ae2635f4cda78f18be708f0595ef3eb5c81acd1f9 |
| hovercard-subject-tag | issue:4407213338 |
| github-keyboard-shortcuts | repository,issues,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/_view_fragments/issues/show/JavaScriptSolidServer/JavaScriptSolidServer/381/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7e6cc4814d45aa8815414ff2a63447a1aa0d7d390f7030b0ae2cd596019767b7/JavaScriptSolidServer/JavaScriptSolidServer/issues/381 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7e6cc4814d45aa8815414ff2a63447a1aa0d7d390f7030b0ae2cd596019767b7/JavaScriptSolidServer/JavaScriptSolidServer/issues/381 |
| og:image:alt | Surfaced during Copilot review of #379 (cors-proxy). `validateExternalUrl()` in `src/utils/ssrf.js` swallows individual record-type lookup failures with `.catch(() => [])` and only fails closed if ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | melvincarvalho |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/JavaScriptSolidServer/JavaScriptSolidServer git https://github.com/JavaScriptSolidServer/JavaScriptSolidServer.git |
| octolytics-dimension-user_id | 205442424 |
| octolytics-dimension-user_login | JavaScriptSolidServer |
| octolytics-dimension-repository_id | 958025407 |
| octolytics-dimension-repository_nwo | JavaScriptSolidServer/JavaScriptSolidServer |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 958025407 |
| octolytics-dimension-repository_network_root_nwo | JavaScriptSolidServer/JavaScriptSolidServer |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width