mirror of
https://github.com/daijro/camoufox.git
synced 2026-11-19 00:07:28 +00:00
b8db95563b3a77e46bbd19db84176558b25b697e
4
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
e90abccee6 |
Firefox 159: stock parity for a driven browser (#997)
* Firefox 159: stock parity for a driven browser A page driven through Camoufox should read like stock Firefox in a person's hands. This brings the Firefox 159 port up to that. Stock defaults - Remote Settings, Safe Browsing, region detection, Push, connectivity checks and the new tab keep Firefox's defaults; Nimbus is tied to Normandy so the new tab starts without it. - No policies.json: any policy file puts Firefox in enterprise mode, which a page can see (DNS over HTTPS stands down). - Firefox's 100% release rollouts are default prefs; stock's search engines are back. - WebGL, devicePixelRatio and worker getters cost what stock's do; Linux builds use --enable-stdcxx-compat, as Mozilla's do. Juggler - Driver code defines no interfaces on the page's window, isolated and main-world evaluates included. - Input arrives as a person's: click hold, hover dwell and double-click gap; fill() and insert_text() type key by key; the wheel turns notches; moves coalesce per frame; drags behave as a GTK drag session. Input waits for Firefox's user-input gate. - Focus, Fission and bfcache stay Firefox's unless a driver needs them. - Screenshots and document.fonts.ready leave the page alone. Humanize - One engine per channel (mouse, keyboard, scroll) behind one seam in Juggler, a seed for repeatable input, and custom(fn) engines run in the caller's process (Python). The build lists its engines in humanize-engines.json. Network - A SOCKS5 proxy with a username and password works for the launch and per context. - The User-Agent header follows the context's identity. - WebRTC UDP goes through a SOCKS5 proxy's UDP ASSOCIATE relay (webrtc-socks5-udp.patch), so a page's STUN server sees the exit and the srflx is real. Nothing goes around the proxy: a page with no HTTP-loaded document behind it counts as proxied, a proxy that carries no UDP gets none, and a relay address inside the proxy's own NAT is replaced by the proxy's public one. Identity - Bundled fonts and speech voices follow the drawn identity. - The window holds the identity's size and position through startup, and on a virtual display a window outside the root is neither occluded nor refused focus. CI runs every new guard. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BLGoGNeymhNcr3EAQX5hJE * Paste inserted text; draw input delays from one normal helper fill() and keyboard.insert_text() typed the text key by key, a quarter of a second per character, which ran past Playwright's timeouts and is not how a person enters a whole string. They now paste: the paste shortcut (Ctrl+V, Cmd+V for a Mac platform) goes down, Firefox's own paste runs with the text through nsIEditor.pasteTransferable (a trusted paste event with the text as clipboardData, then beforeinput/input insertFromPaste), and the shortcut comes up. The shortcut's keypress, where Firefox would read the system clipboard, is cancelled in the system group, which content cannot observe; the system clipboard is never used. A page that cancels the paste or the shortcut gets nothing, and the call fails saying so. input/HumanDelay.js holds normalDelay(mean, sd, min, max), the one draw for the delays between a person's input events: the click hold (normal around 110 ms, SD 30, never under 50 ms, with no ceiling), the double-click gap, the hover dwell, the paste key's hold, and the Shift and paste modifiers' lead and trail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BLGoGNeymhNcr3EAQX5hJE * Fix driven input and headless parity * Headless with a display uses that display's GL A headless probe that failed to load EGL still recorded TEST_TYPE EGL, so Firefox refused GLX and every headless WebGL context died. Probe EGL only when there is no display, and only claim it when that probe initialized. Move spacing starts when the move is sent, so a steps path stays a 125 Hz mouse instead of one move per frame. * Fix focus, humanize-off, and WebRTC proxy parity - A stock identity mirror adds no humanize keys when humanize is off. - Keep the real focus and run the upstream focus tests. - Add the per-context WebRTC proxy flag; do not fabricate a srflx behind a proxy. - Refresh the Python/TypeScript parity tests, skiplist and docs. - Install Mesa DRI so the software WebGL guards can run. * Fix TypeScript humanize float encoding Encode humanize option values as PyFloat so a duration serializes as 1.0, matching Python, and apply Biome's import formatting. * Close a relay overflow, stop inventing srflx, and fix driven input gaps WebRTC: - A SOCKS5 relay read larger than the caller's buffer overran the stack buffer. A page-named STUN server could send one. Drop the datagram. - Remove the fabricated srflx candidate; a srflx now only comes from a STUN answer, and the guards run against a server that answers. - Juggler records each proxy it sets, so a caller's own new_context(proxy=...) cannot gather around it. This replaces the launcher's webrtc:proxied key and its page-visible setter. - Headless GL probes use the surfaceless platform without launcher plumbing. Input: - A wheel without a scroll engine takes the activation slot per notch, so a long scroll no longer stalls input in every other context. - Paste and fill work inside an iframe. - Python fill honours the caller's timeout. TypeScript humanize matches Python: off, seeds, duplicate options and the scroll warning. Guards with a missing prerequisite fail rather than pass. Add navigation-preconnect-proxied. Move the tweened click test to a skiplist pattern entry, since whether it passes depends on machine speed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Check the tweened click entry with its guard, not the audit Whether test_click_with_tweened_mouse_movement passes depends on machine speed: 0 of 20 runs on all cores here, 3 of 15 on two, and it passed on CI. The audit cannot demand a failure from it, and a pattern entry would leave its reason unchecked. A skiplist entry's checked_by now names the patch guard that checks the reason, here driven-move-coalescing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Ask the display-less GL probe for a pbuffer config Mesa's surfaceless platform has only pbuffer configs. The probe asked for the default window surface type, so eglChooseConfig matched nothing and eglCreateContext got an uninitialized config. With no GPU, a display-less headless launch then had an empty gfxInfo: no WebGL and no WebRTC H264. A host where NVIDIA's EGL answers first never reaches Mesa here, so the guards only failed on machines without a GPU. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Open about:blank for a driver and run first-page init scripts after PageAgent A headed persistent launch opened about:home once the start page prefs went back to stock. browser.startup.page now becomes 0 only when a driver attaches, so a browser nobody drives keeps Firefox's start page. Init scripts on a page's initial document ran before PageAgent existed, so their binding calls and console messages had no listener and were lost. They now run after PageAgent has reported the page's execution contexts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Warm up the crash growth test past Firefox 159's timed startup work The parent holds up to 400 MB more for a while at fixed times after launch, in stock Firefox 159 as well. Two RSS readings taken across one of those peaks read as growth or shrinkage, and pushed the test over its limit with no leak. Warm up by time instead of by context count. The metric and limit are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Close WebRTC paths around a proxy, stop background traffic, fix driven input WebRTC behind a proxy no longer shows the host's address: ICE uses the proxy's SOCKS5 UDP relay when it has one, and UDP is dropped otherwise. A page on the bypass list behind a forced proxy is blocked on UDP and ICE TCP. A proxy hanging up straight after CONNECT no longer crashes the parent process. Remote Settings stops polling, with the page-visible lists bundled as a snapshot pinned by scripts/remote_settings.py, and Push connects on demand. fill clicks an unfocused text field and types when a page blocks paste. Click throughput across contexts is restored. The TypeScript launcher gains custom humanize engines and driver defaults, in step with Python, and caps WebGL2 MAX_UNIFORM_BLOCK_SIZE at Firefox 159's 64 KiB. docs/input-dispatch.md records a person's wheel on macOS, which is one line a notch where the driven wheel sends three. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Leave the humanize engine system for its own pull request Per-channel engines, seeded streams, custom() and the keyboard and scroll-into-view plans are a separate feature. humanize keeps main's meaning here: a human cursor move, on or off, with an optional duration cap, planned by CursorTrajectory.js and paced by Pacer.js. The five per-channel config keys were declared on this branch, so they stay declared as removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Warn, not raise, on a browser that cannot read voices:speechd A new package has to launch an older build (#835, and the install gate launches the last release). A Linux identity there reports no voices, so it warns and the warning cannot be silenced. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Give a macOS identity macOS's wheel A person's notched mouse on macOS sends one line for a slow notch, with no native tick, and accelerates a faster turn from there. Driven input sent Linux's three ticked lines. A macOS identity now sends lines at 16 px each, starting at one and growing, and stock's per-OS system scroll override follows the identity. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Install the tracking lists where a clean build's reader looks A relative wildcard keeps its directory under recursive make and drops it under faster make. The clean build nested the attachments one directory too deep, so the classifier had no tables. An incremental objdir hid this with old links. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Make two guards deterministic: the wheel's OS and a dropped relay A launch without `os` draws one, and a macOS draw now gets macOS's wheel, so the guards asserting three notches failed by the draw. They assert Linux's now. The browser flushes queued datagrams when UDP ASSOCIATE is granted, so a relay closed just after the grant could forward one, and the STUN server heard the proxy's own relay port as if it had gone around the proxy. It closes first now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
813d9bb199 |
Behave as on an IPv4-only network when the host's IPv6 disagrees with geoip (#857)
* Behave as on an IPv4-only network when the host's IPv6 disagrees with geoip (#849) With geoip and an IPv4 address, both launchers set network.dns.disableIPv6. That stops AAAA lookups only, so IPv6-only sites failed with NS_ERROR_UNKNOWN_HOST (#849), while a URL with an IPv6 literal still connected and WebRTC still gathered IPv6 candidates. A page could read the host's IPv6 address, and no real network resolves names to IPv4 only while IPv6 literals connect. Without a proxy, sites see this host's own addresses, and the identity comes from its IPv4 address. The launcher now looks up the host's public IPv6 address too. When it geolocates to the identity's timezone and region, IPv6 stays on, as on any dual-stack network. Otherwise, or when the host has no IPv6 route, it sets the new network:ipv4Only config key, with a LeakWarning when an IPv6 address was found elsewhere. Behind a proxy nothing changes: the browser reaches sites only through it. network:ipv4Only makes the browser behave as a host with no IPv6 route: lookups return IPv4 addresses only, TCP connections to a routable IPv6 address fail with PR_NETWORK_UNREACHABLE_ERROR as the kernel's would, HTTP/3 refuses IPv6 peers, and ICE gathers no routable IPv6 address. Loopback, link-local and IPv4-mapped addresses keep working, as they do on such a host. NetAddr::IsUnreachableOnIPv4OnlyNetwork is the one definition all of these use. ipv4-only-network.py checks it in a network namespace with a dual-stack interface: with the key off every IPv6 path works, with it on IPv6 literals and AAAA-only names fail at once, dual-stack names use IPv4, and WebRTC offers no IPv6 candidate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Allow user namespaces for the IPv4-only network guard in CI Ubuntu 24.04's AppArmor denies unprivileged user namespaces to programs without a profile, so the guard's `unshare -rnm` failed on the runner. The spoofing leg now lifts that restriction on the throwaway runner, and the guard says which setting to change when it is denied locally. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
0bb4f14b74 |
Keep the caller's launch inputs unchanged, and claim the avail screen and touch points baseline protection reports
launch_options/launchOptions filled the caller's config, prefs, args and addons in place. A config reused for a second launch then carried the first identity's webGl:vendor in, which read as a GPU the caller named: the second launch covered its canvas while claiming the host's GPU. The TypeScript end-to-end test caught it through its Python probe, which calls launch_options before Camoufox with the same kwargs. Both launchers now work on copies. Firefox's baseline fingerprinting protection reports the available screen as the screen less a fixed taskbar for the claimed OS (48px Windows, 76px macOS, none on Linux) and collapses more than one touch point to 5, and the browser applies that to the spoofed values. The launchers still claimed fpgen's recorded avail rect, adjusted by fix_screen_no_taskbar, so a Linux identity's config said availHeight 1053 while the page read 1080. follow_baseline_protection / followBaselineProtection replaces it and claims what the browser reports. The end-to-end test now compares a covered canvas by being covered (its readback is random on every read, so its size was too), launches the NewContext scenario with canvas_noise, since an uncovered browser binds its contexts to the host, and checks a headful launch against its own config, because Xvfb can render on another device than headless. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
658806eb23 | chore: major code cleanup/refactor |