fix(socks5-proxy-agent): use per-origin pools to prevent cross-origin… · nodejs/undici@a516f87 · GitHub
Skip to content

Commit a516f87

Browse files
deepview-autofixclaudeChALkeR
authored
fix(socks5-proxy-agent): use per-origin pools to prevent cross-origin routing (#5041)
The Socks5ProxyAgent stored a single Pool keyed implicitly to the first origin it saw and reused it for every subsequent request. When a second request targeted a different origin, it was dispatched through the existing pool whose connect callback tunnelled to the original origin, causing the request to reach the wrong host (and potentially leaking headers/credentials intended for origin B to origin A). Track pools in a Map keyed by origin so each origin gets its own pool and SOCKS5 tunnel. Signed-off-by: Nikita Skovoroda <chalkerx@gmail.com> Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Nikita Skovoroda <chalkerx@gmail.com>
1 parent b935c91 commit a516f87

2 files changed

Lines changed: 63 additions & 12 deletions

File tree

lib/dispatcher/socks5-proxy-agent.js

Lines changed: 21 additions & 12 deletions

test/socks5-proxy-agent.js

Lines changed: 42 additions & 0 deletions

0 commit comments

Comments
 (0)