Files
camoufox/Makefile
T
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

248 lines
7.8 KiB
Makefile

include upstream.sh
export
cf_source_dir := camoufox-$(version)-$(release)
ff_source_tarball := firefox-$(version).source.tar.xz
debs := python3 python3-dev python3-pip p7zip-full golang-go msitools wget aria2 libsqlite3-dev
rpms := python3 python3-devel p7zip golang msitools wget aria2 sqlite-devel
pacman := python python-pip p7zip go msitools wget aria2 sqlite
.PHONY: help fetch setup setup-minimal clean set-target distclean build package \
build-launcher check-arch revert edits run bootstrap mozbootstrap dir \
package-linux package-macos package-windows vcredist_arch patch unpatch \
workspace check-arg edit-cfg ff-dbg tests update-ubo-assets generate-assets-car
help:
@echo "Available targets:"
@echo " fetch - Fetch the Firefox source code"
@echo " setup - Setup Camoufox & local git repo for development"
@echo " bootstrap - Set up build environment"
@echo " mozbootstrap - Sets up mach"
@echo " dir - Prepare Camoufox source directory with BUILD_TARGET"
@echo " revert - Kill all working changes"
@echo " edits - Camoufox developer UI"
@echo " build-launcher - Build launcher"
@echo " clean - Remove build artifacts"
@echo " distclean - Remove everything including downloads"
@echo " build - Build Camoufox"
@echo " set-target - Change the build target with BUILD_TARGET"
@echo " package-linux - Package Camoufox for Linux"
@echo " package-macos - Package Camoufox for macOS"
@echo " package-windows - Package Camoufox for Windows"
@echo " run - Run Camoufox"
@echo " edit-cfg - Edit camoufox.cfg"
@echo " ff-dbg - Setup vanilla Firefox with minimal patches"
@echo " patch - Apply a patch"
@echo " unpatch - Remove a patch"
@echo " workspace - Sets the workspace to a patch, assuming its applied"
@echo " tests - Runs the Playwright tests"
@echo " update-ubo-assets - Update the uBOAssets.json file"
_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
$(eval $(_ARGS):;@:)
fetch:
# Fetching the Firefox source tarball...
aria2c -x16 -s16 -k1M -o $(ff_source_tarball) "https://archive.mozilla.org/pub/firefox/releases/$(version)/source/firefox-$(version).source.tar.xz"; \
setup-minimal:
# Note: Only docker containers are intended to run this directly.
# Run this before `make dir` or `make build` to avoid setting up a local git repo.
if [ ! -f $(ff_source_tarball) ]; then \
make fetch; \
fi
# Create new cf_source_dir
rm -rf $(cf_source_dir)
mkdir -p $(cf_source_dir)
tar -xJf $(ff_source_tarball) -C $(cf_source_dir) --strip-components=1
# Copy settings & additions
cd $(cf_source_dir) && bash ../scripts/copy-additions.sh $(version) $(release)
setup: setup-minimal
# Initialize local git repo for development
cd $(cf_source_dir) && \
git init -b main && \
git add -f -A && \
git commit -m "Initial commit" && \
git tag -a unpatched -m "Initial commit"
ff-dbg: setup
# Only apply patches to help debug vanilla Firefox
make patch ./patches/chromeutil.patch
make patch ./patches/browser-init.patch
echo "LOCAL_INCLUDES += ['/camoucfg']" >> $(cf_source_dir)/dom/base/moz.build
touch $(cf_source_dir)/_READY
make checkpoint
make build
revert:
cd $(cf_source_dir) && git reset --hard unpatched
dir:
@if [ ! -d $(cf_source_dir) ]; then \
make setup; \
fi
python3 scripts/patch.py $(version) $(release)
touch $(cf_source_dir)/_READY
set-target:
python3 scripts/patch.py $(version) $(release) --mozconfig-only
mozbootstrap:
cd $(cf_source_dir) && MOZBUILD_STATE_PATH=$$HOME/.mozbuild ./mach --no-interactive bootstrap --application-choice=browser
bootstrap: dir
(sudo apt-get -y install $(debs) || sudo dnf -y install $(rpms) || sudo pacman -Sy $(pacman))
make mozbootstrap
diff:
@cd $(cf_source_dir) && git diff first-checkpoint $(_ARGS)
first-checkpoint:
cd $(cf_source_dir) && \
git tag -d first-checkpoint || true && \
git add -A && \
git reset -q _READY || true && \
git commit -m "Checkpoint" -uno && \
git tag -a first-checkpoint -m "Checkpoint"
checkpoint:
cd $(cf_source_dir) && git commit -m "Checkpoint" -uno
clean:
cd $(cf_source_dir) && git clean -fdx && ./mach clobber
make revert
distclean:
rm -rf $(cf_source_dir) $(ff_source_tarball)
build: unbusy
@if [ ! -f $(cf_source_dir)/_READY ]; then \
make dir; \
fi
cd $(cf_source_dir) && ./mach build $(_ARGS)
edits:
python3 ./scripts/developer.py $(version) $(release)
check-arch:
@if ! echo "x86_64 i686 arm64" | grep -qw "$(arch)"; then \
echo "Error: Invalid arch value. Must be x86_64, i686, or arm64."; \
exit 1; \
fi
build-launcher: check-arch
cd legacy/launcher && bash build.sh $(arch) $(os)
package-linux:
python3 scripts/package.py linux \
--includes \
settings/chrome.css \
settings/camoucfg.jvv \
settings/properties.json \
bundle/fontconfig \
--version $(version) \
--release $(release) \
--arch $(arch) \
--fonts windows macos linux
package-macos:
python3 scripts/package.py macos \
--includes \
settings/chrome.css \
settings/camoucfg.jvv \
settings/properties.json \
--version $(version) \
--release $(release) \
--arch $(arch) \
--fonts windows linux
package-windows:
python3 scripts/package.py windows \
--includes \
settings/chrome.css \
settings/camoucfg.jvv \
settings/properties.json \
~/.mozbuild/vs/VC/Redist/MSVC/14.38.33135/$(vcredist_arch)/Microsoft.VC143.CRT/*.dll \
--version $(version) \
--release $(release) \
--arch $(arch) \
--fonts macos linux
run-launcher:
rm -rf $(cf_source_dir)/obj-x86_64-pc-linux-gnu/dist/bin/launch;
make build-launcher arch=x86_64 os=linux;
cp legacy/launcher/dist/launch $(cf_source_dir)/obj-x86_64-pc-linux-gnu/dist/bin/launch;
$(cf_source_dir)/obj-x86_64-pc-linux-gnu/dist/bin/launch
run-pw:
rm -rf $(cf_source_dir)/obj-x86_64-pc-linux-gnu/dist/bin/launch;
make build-launcher arch=x86_64 os=linux;
python3 scripts/run-pw.py \
--version $(version) \
--release $(release)
run:
cd $(cf_source_dir) \
&& rm -rf ~/.camoufox obj-x86_64-pc-linux-gnu/tmp/profile-default \
&& CAMOU_CONFIG=$${CAMOU_CONFIG:-'{}'} \
&& CAMOU_CONFIG="$${CAMOU_CONFIG%?}, \"debug\": true}" ./mach run $(args)
edit-cfg:
@if [ ! -f $(cf_source_dir)/obj-x86_64-pc-linux-gnu/dist/bin/camoufox.cfg ]; then \
echo "Error: camoufox.cfg not found. Apply config.patch first."; \
exit 1; \
fi
$(EDITOR) $(cf_source_dir)/obj-x86_64-pc-linux-gnu/dist/bin/camoufox.cfg
check-arg:
@if [ -z "$(_ARGS)" ]; then \
echo "Error: No file specified. Usage: make <command> ./patches/file.patch"; \
exit 1; \
fi
grep:
grep "$(_ARGS)" -r ./patches/*.patch
patch:
@make check-arg $(_ARGS);
cd $(cf_source_dir) && patch -p1 -i ../$(_ARGS)
unpatch:
@make check-arg $(_ARGS);
cd $(cf_source_dir) && patch -p1 -R -i ../$(_ARGS)
workspace:
@make check-arg $(_ARGS);
@if (cd $(cf_source_dir) && patch -p1 -R --dry-run --force -i ../$(_ARGS)) > /dev/null 2>&1; then \
echo "Patch is already applied. Unapplying..."; \
make unpatch $(_ARGS); \
else \
echo "Patch is not applied. Proceeding with application..."; \
fi
make first-checkpoint || true
make patch $(_ARGS)
tests:
cd ./tests && \
bash run-tests.sh \
--executable-path ../$(cf_source_dir)/obj-x86_64-pc-linux-gnu/dist/bin/camoufox-bin \
$(if $(filter true,$(headful)),--headful,)
unbusy:
rm -rf $(cf_source_dir)/obj-x86_64-pc-linux-gnu/dist/bin/camoufox-bin \
$(cf_source_dir)/obj-x86_64-pc-linux-gnu/dist/bin/camoufox \
$(cf_source_dir)/obj-x86_64-pc-linux-gnu/dist/bin/launch
path:
@realpath $(cf_source_dir)/obj-x86_64-pc-linux-gnu/dist/bin/camoufox-bin
update-ubo-assets:
bash ./scripts/update-ubo-assets.sh
generate-assets-car:
bash ./scripts/generate-assets-car.sh
vcredist_arch := $(shell echo $(arch) | sed 's/x86_64/x64/' | sed 's/i686/x86/')