You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
NO_PROXY domain suffix can be used to evade proxy by a non-subdomain #62907
In ProxyConfig#shouldUseProxy (the transitive helper that checkShouldUseProxy always delegates to), the .suffix bypass-list rule uses host.endsWith(suffix) after stripping the leading dot. This matches across domain-label boundaries: a NO_PROXY=.example.com rule causes checkShouldUseProxy(..., { host: 'evilexample.com' }) to return false (bypass proxy) because 'evilexample.com'.endsWith('example.com') is true. An attacker who can choose/influence the target hostname can therefore route traffic around a proxy that was meant to intercept all *.example.com traffic. The check should require the character immediately preceding the suffix to be . (or the host to equal the suffix exactly), e.g. host === suffix || host.endsWith('.' + suffix) — or reuse the same form as the *.example.com branch (which is already safe because its effective suffix retains the leading dot).
Hi, I'd like to work on this. I've looked some at the relevant code in lib/internal/http.js around line 161 in ProxyConfig#shouldUseProxy.
The fix seems straightforward : change the suffix check from:
jshost.endsWith(suffix)
to:
jshost === suffix || host.endsWith('.' + suffix)
This aligns with how the *.example.com branch already handles matching safely.
A couple of questions before I open a PR:
Should the fix also update the documentation to clarify that .example.com only matches actual subdomains (not suffix overlaps like evilexample.com)?
Are there existing tests for checkShouldUseProxy / shouldUseProxy I should extend, or should I add a new test file?
Happy to open a draft PR for early review if this direction looks good.
Activity
DivyanshuX9 commentedon Apr 26, 2026
Hi, I'd like to work on this. I've looked some at the relevant code in lib/internal/http.js around line 161 in ProxyConfig#shouldUseProxy.
The fix seems straightforward : change the suffix check from:
jshost.endsWith(suffix)
to:
jshost === suffix || host.endsWith('.' + suffix)
This aligns with how the *.example.com branch already handles matching safely.
A couple of questions before I open a PR:
Should the fix also update the documentation to clarify that .example.com only matches actual subdomains (not suffix overlaps like evilexample.com)?
Are there existing tests for checkShouldUseProxy / shouldUseProxy I should extend, or should I add a new test file?
Happy to open a draft PR for early review if this direction looks good.
joyeecheung commentedon Apr 29, 2026
I think this has been fixed by #62333