Commit Graph
18 Commits
Author SHA1 Message Date
Jake Writer 0e4151f820 fix: page-recycle hang under spoofed window dims, and the unmerged halves of #637-#647
Fixes the new_page() hang from #666, and restores the pythonlib/ + settings/
halves of #637-#647 that were dropped when those PRs were consolidated into #666
(that PR only carried patches/ + additions/, so these never actually landed).

## new_page() hangs when window.outer* is spoofed (#666)

The outer-size hijack in browser-init.patch pinned the chrome documentElement to
the spoofed size. That caps .browserStack, which caps the content viewport, so
the content window can never reach the size Juggler asks for in
updateViewportSize() -- and awaitViewportDimensions awaits exact equality with
no timeout, so it deadlocks rather than erroring. The second new_page() hung
forever and took the context with it.

The pin was never load-bearing: GetOuterWidth/GetOuterHeight already consult
MaskConfig unconditionally (fingerprint-injection.patch), so window.outerWidth is
spoofed in C++ regardless of the real chrome window size. Resizing is enough.

Measured on the official v152.0.4-beta.26 build (headless):

    config      before        after
    none        pass          pass
    inner       pass          pass
    outer       HANG          pass
    both        HANG          pass  (iw:360 ih:740 ow:360 oh:800 -- exact)

This corrects the diagnosis in #666, which blamed the inner+outer combination and
the `!(outerWidth || outerHeight)` guard. outer* ALONE is sufficient to hang, and
dropping inner* does not help, so that guard is not the culprit.

Also fixed driver-side: Playwright's implicit 1280x720 viewport is what asks for
the impossible size, so the driver now defaults to no_viewport when the config
spoofs any window dimension. That fixes the hang on already-released builds
without a rebuild. An explicit viewport=/no_viewport= from the caller wins.

## WebRTC ICE prefs (#538)

#666 merged the C++ half of the WebRTC fix but not the prefs, so the shipped
build still has no_host=true and none of the proxy_only prefs.
proxy_only_if_behind_proxy is the pref that actually stops the real-IP leak: it
prevents a UDP STUN request routing around a TCP proxy. no_host=false keeps the
stock two-candidate shape, which obfuscate_host_addresses makes leak-free.

## Also restored from the consolidation

- fix(proxy): dom.security.https_first rewrote http:// before the launch-arg
  proxy filter saw it, breaking CONNECT-only proxies (#638).
- fix(stealth): speech-voice spoofing + stop leaking host voices (#646).
- fix(stealth): clamp inner <= outer <= avail <= screen; BrowserForge can emit
  impossible geometries that leak as tells (#647).

Refs: https://github.com/daijro/camoufox/pull/666
Refs: https://github.com/daijro/camoufox/issues/538
2026-07-16 14:38:39 -06:00
Hunter BoydandClaude Fable 5 0d5440117b Fix playwright session leak when launch or close raises (#82)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 11:00:02 -04:00
icepaq d6540b52ce Service Test and Contributing Guides (#521)
* example files

* contributing guides

* simple service test

* run tests in sync

* update pr template

* pip updates

* Update README.md

* typo fixes

* undo pip package update lol

* upgraded service test

* undo injections

* test with proxies

* auto set timezone and proxy url

* delete checks bundle

* split up service tests

* split up build tests

* rename service tests to service tester

* Update CONTRIBUTING.md

* fix entry vs exit ip

* allow alpha versions

* fix patch issues on macos

* bidirectional patch

* Add note on experimental pip package
2026-03-15 21:31:49 -04:00
c6a6c20670 Camoufox 2.0: Hardware Spoofing + Python Package Updates (#519)
* feat: update timezone, geolocation, and locale spoofing patches

- timezone-spoofing.patch: per-context timezone via per-realm DateTimeInfo
- geolocation-spoofing.patch: CAMOU_CONFIG backwards compatibility for geolocation
- locale-spoofing.patch: add camoucfg LOCAL_INCLUDES
- anti-font-fingerprinting.patch: add RoverfoxStorageManager exports to moz.build

* feat: per-context audio fingerprinting and screen spoofing patches

- audio-fingerprint-manager.patch: per-context audio fingerprinting (all 6 API methods)
- screen-spoofing.patch: per-context screen dimensions with global MaskConfig fallback
- Disable webrtc-ip-spoofing.patch (will re-enable after fixing)
- Remove screen-hijacker.patch (superseded by screen-spoofing.patch)

* fix: add global MaskConfig hooks for navigator.platform, hardwareConcurrency, and timezone (#443)

Fixes issue where global CAMOU_CONFIG settings for navigator.platform,
navigator.hardwareConcurrency, and timezone were not applied in the main
window Navigator (only WorkerNavigator was patched via fingerprint-injection.patch).

* fix: run nsJSUtils::SetTimeZoneOverride() after SpiderMonkey has Initialized to prevent SIGSEGV

* Add fingerprint improvements for PR #3

- navigator-spoofing.patch: Global config fixes for platform/hardwareConcurrency/timezone
- timezone-spoofing.patch: Persistence across page navigation via SetNewDocument hook
- audio-fingerprint-manager.patch: Full 6-method coverage with self-destruct pattern
- screen-spoofing.patch: Per-context dimensions with self-destruct pattern
- webrtc-ip-spoofing.patch: Re-enabled with getStats() sanitization + comprehensive IPv6 regex

* fix: simplify userContextId to BrowsingContext + add per-context docs

* feat(navigator): Add per-context spoofing (platform, oscpu, hardwareConcurrency) with global fallback + docs update.

* fix(navigator): use 2-arg GetUint(key, value) for RoverfoxStorageManager

* fix(navigator): header line count build error

* fix(navigator): move NavigatorManager.cpp into SOURCES for leakage error

* fix(navigator): more line count build errors

* fix(navigator): include nsTHashMap and nsHashKeys.h before RoverfoxStorageManager

* feat(webgl): per-context spoofing patch

* fix(webgl): changed GetCanvasElement() to mCanvasElement() for firefox version

* fix(webgl): remove coupled self-destruct

* feat(canvas): per-context spoofing

* feat(font-list): per-context spoofing

* fix(font-list): use GetOwnerWindow() instead of GetOwner()

* feat(speech): per-context spoofing

* fix(speech): add /dom/base inside local_includes

* fix(speech): changed context to avoid conflicts

* feat(navigator): add WorkerNavigator hooks for per-context platform and hardwareConcurrency in workers

* feat(timezone): add per-context timezone override to workers

* fix(canvas): add OffscreenCanvas userContextId support and skip zero pixels in canvas noise

* fix(screen): hook nsMediaFeatures GetDeviceSize for per-context matchMedia device-width/height

* fix(webgl): add OffscreenCanvas userContextId fallback in WebGL GetUserContextId

* fix(canvas): make canvas noise use proper format for BGRA toDataURL path

* fix(canvas): line count fixes

* docs: updated hardware per-context documentation

* Final Per-Context Hardware Fingerprint Spoofing (#9)

* feat(navigator): Add per-context spoofing (platform, oscpu, hardwareConcurrency) with global fallback + docs update.

* fix(navigator): use 2-arg GetUint(key, value) for RoverfoxStorageManager

* fix(navigator): header line count build error

* fix(navigator): move NavigatorManager.cpp into SOURCES for leakage error

* fix(navigator): more line count build errors

* fix(navigator): include nsTHashMap and nsHashKeys.h before RoverfoxStorageManager

* feat(webgl): per-context spoofing patch

* fix(webgl): changed GetCanvasElement() to mCanvasElement() for firefox version

* fix(webgl): remove coupled self-destruct

* feat(canvas): per-context spoofing

* feat(font-list): per-context spoofing

* fix(font-list): use GetOwnerWindow() instead of GetOwner()

* feat(speech): per-context spoofing

* fix(speech): add /dom/base inside local_includes

* fix(speech): changed context to avoid conflicts

* feat(navigator): add WorkerNavigator hooks for per-context platform and hardwareConcurrency in workers

* feat(timezone): add per-context timezone override to workers

* fix(canvas): add OffscreenCanvas userContextId support and skip zero pixels in canvas noise

* fix(screen): hook nsMediaFeatures GetDeviceSize for per-context matchMedia device-width/height

* fix(webgl): add OffscreenCanvas userContextId fallback in WebGL GetUserContextId

* fix(canvas): make canvas noise use proper format for BGRA toDataURL path

* fix(canvas): line count fixes

* docs: updated hardware per-context documentation

* feat(screen): screen avail per context

* fix(font): align userContextId resolution to BrowsingContext

* fix(audio): align userContextId resolution to BrowsingContext

* Avoid macos caching (#11)

* the property to undefined before deleting

* undo webrtc undefined

* feat: userContextId added to WordCacheKey

* fix: hunk line counts for macos cache changes

* fix: add WorkerPrivate fallback in OffscreenCanvas

* fix(audio): transformation added to mSharedChannels path to ensure consistency

* fix(webgl): added WorkerPrivate to ucid

* fix(timezone): add ucid=0 fallback for worker timezone resolution

* fix(audio): move seed lookup outside window guard for all 6 hooks

* fix(canvas): add ucid=0 fallback and WorkerPrivate resolution for workers

* fix(navigator): add setNavigatorUserAgent and ucid=0 fallback and WorkerNavigator for UA spoofing fix

* fix(webgl): add ucid=0 fallback and WorkerPrivate resolution

* fix(webgl): decouple vendor/renderer self-destruct

* fix(navigator): add main-thread navigator.userAgent getter hook

* fix(navigator): add MaskConfig hook for navigator.appVersion in main window

* feat: Add Chakra Petch font for macOS to solidify detection on CreepJS

* fix(fontconfig): rename to match Go launcher, add TTC aliases and update .gitignore

* fix(navigator): oscpu missing MaskConfig global fallback

* feat: add real fingerprint presets (65 firefox profiles) - mainly to test with, more will come when tested.

* feat: use real fingerprint presets as default with BrowserForge as fallback

* feat: add audio:seed and canvas:seed to property schema and validation

* feat: add MaskConfig fallback to seed managers for cross-process worker consistency - don't need to disable fission

* fix(font): moved mUserContextId declaration before mRounding in WordCacheKey so init order matches

* fix(audio): line count correction

* fix(canvas): line count fix

* feat: add per-context fingerprinting API (NewContext/AsyncNewContext) + merge upstream

- fix seed range
- add oscpu derivation from platform, and timezone mapping in from_preset()
- new real fingerprints preset support

* feat: new presets + en-US only, stripped fonts/language, clamp DPR

* feat: random 30-78% font subset generation for NewBrowser and NewContext

* fix: add fission.autostart=true to camoufox.cfg - will be changing this soon with new update so processCount is not 1, so it will be undetectable

* fix: update macos fonts.conf rendering settings

* feat: cross-process fingerprint storage via Firefox Preferences API

Replace RoverfoxStorageManager's per-process static HashMap with Firefox's
built-in Preferences system. Values stored as CString prefs under
"roverfox.s." namespace, auto-synced to all content processes by Firefox.

Content processes can't set prefs directly (ENSURE_PARENT_PROCESS), so a
single IPDL message (RoverfoxStoragePut) routes writes through the parent.
Same public API — all 10 dependent patches require zero changes.

Removes dom.ipc.processCount=1 from camoufox.cfg. Firefox now uses
Playwright's default multi-process model (fresh process per page) with
fission enabled, while fingerprint values remain accessible everywhere.

* fix(cross-process): hunk headers and build fixes

* fix(storage): add local write-through cache to RoverfoxStorageManager

* fix(storage): add sync IPC read fallback for cross-process fingerprint propagation

* fix(storage): add NS_IsMainThread guard to sync IPC fallback - prevent crashes

* fix(storage): sync IPC + pref whitelist for cross-process fingerprint sync

* feat: full documentation update, speech voices generated per context and BrowserForge primary fingerprint generation method for global and per context.

* fix: Direct3D NVIDIA GTX 980 renderers incorrectly appearing on mac because of duplicates

* Update .gitignore

---------

Co-authored-by: PopcornDev1 <e.coiley@icloud.com>
Co-authored-by: Build <build@local>
Co-authored-by: Elliot Coiley <153072396+PopcornDev1@users.noreply.github.com>
2026-03-14 11:29:12 -04:00
daijro 0923b12194 Exception handling 2026-02-07 03:29:35 -06:00
wv-opt-ai e008580521 Fix cleanup on exception in sync_api __enter__
If an exception is raised in the synchronous api during the setup, super().__enter__ has been called but super().__exit__ will not get called, leading to asyncio runloop exceptions further down the line if one tries to create a new context. This commit catches the exception in order to clean up the super().__exit__ calls before reraising.
2025-03-21 16:35:11 +01:00
daijro 4c52518dd2 pythonlib: Cleanup & bump to 0.4.6
- `camoufox test` will no longer highlight the cursor by default
- Fixed launch_options blocking async
- WebGL database cleanup & added ability to query all possible vendor/renderer pairs
2024-12-04 19:35:54 -06:00
daijro 75ea7b0880 pythonlib: Set window size & kill Xvfb on browser close #49 #50
- Added window: Tuple[int, int] argument to set a fixed width and height #50
- Experimental fix to automatically terminate Xvfb on browser.close() #49
- Bump to 0.3.1
2024-10-27 20:03:11 -05:00
daijro 0ff90fc750 Version range control, multi locale usage, etc
- Python library now constrains the supported Camoufox version, and will force an update if you are out of date.
- Added support patch for multiple accepted languages #37
- Added pysocks #43
- Added README deprecation notices
- Added public launch_options command
- Bumped python library to 0.3.0
- Full support for beta.12
2024-10-19 23:10:51 -05:00
daijro b2f74a24f3 Update pythonlib & README for beta.11
- Removed warnings for using headless mode
- Xvfb is now activated with headless='virtual'
- Correctly pass window.screenX & calculate window.screenY
- Update documentation on main README and pythonlib README
- Bumped pythonlib to 0.2.10
2024-10-09 05:49:22 -05:00
daijro 4a1cd7ec64 pythonlib: Add headless detection warning #26 0.2.7
Raises a warning when headless mode is enabled in Camoufox.
This will be reverted once #26 is resolved.
2024-10-06 20:05:11 -05:00
daijro f3b68ab355 pythonlib: Assert OS is valid 0.2.6
- Removed mobile OS support due to detection issues
- Validate the passed os name & that its lowercase
2024-10-05 02:10:43 -05:00
daijro 2832673f83 pythonlib: Add persistent_context, humanize, etc. 0.2.5
- Added `persistent_context` parameter #21
- Added `humanize` parameter #22
- Added validation for custom fingerprints
- Updated Browserforge integration documentation
2024-10-04 19:04:16 -05:00
daijro ad55622550 pythonlib: Implement viewport hijacking 0.2.2
- 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
2024-09-30 04:06:16 -05:00
daijro f6396c1e81 pythonlib: Add locale, geolocation/locale from IP, & more 0.2.0
- 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.
2024-09-29 17:30:00 -05:00
daijro f18b9a00be pythonlib: Add block_images, block_webrtc, fixes, etc. 0.1.3
- Adds block_images & block_webrtc parameters to Camoufox and AsyncCamoufox
- Fixes async_api
- Update README
2024-09-19 19:05:53 -05:00
daijro 3488008311 pythonlib: Release to PyPi, Update README 2024-09-19 04:52:18 -05:00
daijro 5e1fb78cfc Camoufox Python interface
Port of the launcher to a Python library.
2024-09-16 04:01:20 -05:00