Scrapling icon indicating copy to clipboard operation
Scrapling copied to clipboard

[Bug]Session-level proxy silently ignored, leaks real IP

Open yetval opened this issue 6 months ago • 1 comments

Summary

FetcherSession(proxy=...) is silently ignored. Requests go direct and leak the real client IP. Passing proxy= per request on .get()/.post() works fine, only the session-level config is broken. Same bug on AsyncFetcherClient.

Reproduce

from scrapling.fetchers import FetcherSession
with FetcherSession(proxy='http://10.255.255.1:9999', timeout=8, retries=1) as s:
    r = s.get('http://httpbin.org/ip')
    print(r.status, r.body)

Expected: timeout, since 10.255.255.1 is unroutable. Actual: 200 b'{"origin": "<my real public IP>"}'.

Root cause

In scrapling/engines/static.py, _make_request always forwards proxy=proxy (often None) into _merge_request_args, so the session default never gets used:

"proxy": self._get_param(method_kwargs, "proxy", self._default_proxy),

The key is always present in method_kwargs, so the fallback branch is dead.

Fix

Only pass proxy into _merge_request_args when it's not None. Same thing needs fixing in the async path. Probably worth checking proxies and proxy_auth while you're in there.

Version

0.4.8, reproduces on main and dev.

yetval avatar May 25 '26 03:05 yetval

Thanks @yetval for catching this one. A fix has been pushed to the dev branch.

D4Vinci avatar Jun 07 '26 15:06 D4Vinci