NewContext derives the context's WebRTC IP and timezone from the proxy's exit
IP. That lookup had two defects, and both left the context showing the
host's values while its traffic went through the proxy:
- It built its own proxy URL with urlparse, which reads a scheme-less server
such as "1.2.3.4:8080" (a form Playwright accepts) as scheme "1.2.3.4" with
no host. urllib could not use a SOCKS proxy at all.
- Any failure was swallowed, and the context opened without the values.
The URL is now built with Proxy.as_string(), which the geoip launch path
already uses (scheme-less means http). The lookup goes through requests,
which handles SOCKS, and a failed lookup raises InvalidIP, naming the two
options that skip it. The tests cover scheme-less, http and socks5 servers
with credentials, both failure modes, and the case where no lookup is needed,
for NewContext and AsyncNewContext.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
public_ip() called requests.get with verify=False and wrapped it in a
context manager that silenced urllib3's InsecureRequestWarning, so the
disabled verification produced no output either.
These requests are routed through the user's proxy, which is the exact
position an attacker occupies. A forged response controls the value
public_ip() returns, and that value is used to spoof the WebRTC IP --
so the leak the function exists to prevent becomes attacker-selectable.
validate_ip() bounds this to a well-formed address, but the address is
still theirs to choose.
Set verify=True and drop the warning suppression. requests raises
SSLError, a subclass of RequestException, which the existing loop
already catches -- a host with a bad certificate is now skipped in
favour of the next one in URLS instead of being trusted.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
(cherry picked from commit 9de97513b0)
passing a proxy to camoufox with the "bypass"-argument while using geoip=True runs into an exception.
extending the class attributes fixes the problem on my local machine
- Allow Browerforge fingerprints to override screen & viewport data.
- Set Camoufox's window dimensions to a fixed width/height generated from Browserforge.
- If the browser is headful, do not exceed 125% of the screen size.
Other changes:
- Allow public IP finder to work without verification.
- Add script to publish to pypi.
- More descriptive progress bars when downloading default addons.
- Bump to 0.2.2
- Added `geoip` parameter to automatically find the target IP's longitude, latitude, timezone, country, language/region locale, & spoof the WebRTC IP address. #5
- Added parameter to set the locale #16
- Automatically calculate the locale based on the distribution of speakers in the target geoip region.
- Added allow_webgl option #17
- By default, use the current version of Camoufox instead of Browserforge's Firefox versions #14.