inspector/server
Repository files (latest commit first)
Filename Latest commit message Latest commit date
manjunathbhaskar 9140789869 fix: prevent DNS-rebinding TOCTOU in safeProxyFetch by pinning resolved IPs
Previously assertSafeProxyTarget resolved the target hostname and validated
the IPs, but safeProxyFetch then passed the raw URL to node-fetch, which
performed its own DNS lookup. In the window between the two resolutions an
attacker who controls the domain's TTL could flip the record to
169.254.169.254 (cloud-metadata), causing fetch() to connect to the instance-
metadata service even though the block-list check passed.

Fix: assertSafeProxyTarget now returns the validated IP addresses. On each
hop of safeProxyFetch we call createPinnedAgent() to build an http/https.Agent
whose lookup hook unconditionally returns the pre-validated IP. node-fetch
uses that hook instead of the OS resolver, closing the TOCTOU window entirely.

Refactoring: isBlockedProxyAddress, assertSafeProxyTarget, and the new
createPinnedAgent are extracted to server/src/proxy-security.ts so they can
be unit-tested in isolation. A vitest suite is added to the server package
(the first unit tests for this package) with 26 cases covering the block-list,
DNS validation, IP-pinning, and the TOCTOU guarantee itself.
2026-07-21 12:46:25 +02:00
..
src fix: prevent DNS-rebinding TOCTOU in safeProxyFetch by pinning resolved IPs 2026-07-21 12:46:25 +02:00
static Add MCP Apps support to Inspector (#1044) 2026-02-05 20:02:20 -07:00
LICENSE fix: include LICENSE file in published npm packages 2026-02-04 12:37:55 +00:00
package.json fix: prevent DNS-rebinding TOCTOU in safeProxyFetch by pinning resolved IPs 2026-07-21 12:46:25 +02:00
tsconfig.json init server 2024-10-07 16:27:49 -07:00
vitest.config.ts fix: prevent DNS-rebinding TOCTOU in safeProxyFetch by pinning resolved IPs 2026-07-21 12:46:25 +02:00