Skip to content

fix: Patch fixes for FF146 beta#502

Open
coffeegrind123 wants to merge 5 commits intodaijro:mainfrom
coffeegrind123:fix/ff146-beta-patches
Open

fix: Patch fixes for FF146 beta#502
coffeegrind123 wants to merge 5 commits intodaijro:mainfrom
coffeegrind123:fix/ff146-beta-patches

Conversation

@coffeegrind123
Copy link

Summary

Test plan

  • Clean build from tarball with all patches applied
  • Verify timezone spoofing: CAMOU_CONFIG='{"timezone":"America/New_York"}' ./camoufox — no crash
  • Verify WebRTC IP spoofing: CAMOU_CONFIG='{"webrtc:ipv4":"93.171.92.214"}' ./camoufox — check on browserleaks.com/webrtc
  • Verify addons load in private browsing mode

🤖 Generated with Claude Code

julien-duponchelle and others added 5 commits February 2, 2026 13:40
This PR fix the broken Accept-Encoding and clean the override code
to use only firefox settings to set:
* User-Agent
* Accept-Encoding
* Accept-Language

This allow to drop the network-patches reducing the maintenance cost.

User-Agent and Accept-Language was already no longer used in the patch
as mentionned in the browserforge.yml

For the Accept-Encoding we are using the firefox settings
network.http.accept-encoding.secure. It's important to apply it only
for HTTPS because the value for HTTP is different. The fingerprint
provided by BrowserForge match the HTTPS settings.

I cleaned camoucfg.jvv and properties.json but I'm not 100% sure it's
what we need to do.
… 1x1

Previously, VirtualDisplay hardcoded a 1x1x24 pixel screen for Xvfb,
which caused rendering issues when using headless='virtual'. The Xvfb
screen was too small to accommodate the fingerprint's screen dimensions
generated by BrowserForge.

Changes:
- Add 'screen' parameter to VirtualDisplay.__init__() defaulting to
  1920x1080x24
- Convert xvfb_args from class attribute to property to use instance
  screen size
- Pass user-specified window dimensions to Xvfb when available in
  sync/async API

Fixes daijro#458
- timezone-spoofing: Fix use-after-free in TimeZone.cpp GetDefaultTimeZone()
  where a Span pointed to a destroyed local std::string (daijro#443, daijro#461)
- webrtc-ip-spoofing: Add MaskConfig fallback in WebRTCIPManager so
  CAMOU_CONFIG webrtc:ipv4/ipv6 keys actually work; add missing
  setWebRTCIPv6 to Window.webidl (daijro#443)
- all-addons-private-mode: Update Extension.jsm -> Extension.sys.mjs
  path for Firefox ESM migration

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coffeegrind123
Copy link
Author

coffeegrind123 commented Feb 20, 2026

Compiled linux build here: https://github.com/coffeegrind123/camoufox-beta/releases/tag/v146.0.1-beta.25-patched

built with build.sh on Debian 12

#!/usr/bin/env bash
set -euo pipefail

REPO_DIR="$(cd "$(dirname "$0")" && pwd)"
VERSION="146.0.1"
RELEASE="beta.25"
CF_SOURCE_DIR="camoufox-${VERSION}-${RELEASE}"
FF_TARBALL="firefox-${VERSION}.source.tar.xz"
TARGET="${1:-linux}"
ARCH="${2:-x86_64}"
LOGFILE="${REPO_DIR}/build-$(date +%Y%m%d-%H%M%S).log"

log() { echo "[$(date '+%H:%M:%S')] $*" | tee -a "$LOGFILE"; }
run() { log ">>> $*"; "$@" 2>&1 | tee -a "$LOGFILE"; local rc=${PIPESTATUS[0]}; [ $rc -ne 0 ] && log "FAILED (exit $rc): $*" && exit $rc; return 0; }
section() { echo "" | tee -a "$LOGFILE"; log "==== $* ===="; }

cd "$REPO_DIR"
log "Build log: $LOGFILE"
log "Target: $TARGET $ARCH"

section "PREREQUISITES"
run sudo apt-get -y install aria2 p7zip-full

section "PR INTEGRATION CHECK"
if git log --oneline | grep -q "Merge branch 'pr-478'"; then
    log "PR #478 already merged"
else
    log "Fetching and merging PR #478..."
    run git fetch origin pull/478/head:pr-478
    run git merge pr-478 --no-edit
fi
if git log --oneline | grep -q "Merge branch 'pr-483'"; then
    log "PR #483 already merged"
else
    log "Fetching and merging PR #483..."
    run git fetch origin pull/483/head:pr-483
    run git merge pr-483 --no-edit
fi

section "SOURCE PREPARATION"
if [ -d "$CF_SOURCE_DIR" ] && [ -f "$CF_SOURCE_DIR/configure.py" ]; then
    log "Extracted source already exists at $CF_SOURCE_DIR — reusing"
else
    if [ ! -f "$FF_TARBALL" ]; then
        log "Downloading Firefox source tarball..."
        run aria2c -x16 -s16 -k1M -o "$FF_TARBALL" \
            "https://archive.mozilla.org/pub/firefox/releases/${VERSION}/source/${FF_TARBALL}"
    else
        log "Tarball $FF_TARBALL already exists — skipping download"
    fi
    log "Extracting tarball (this takes a while)..."
    rm -rf "$CF_SOURCE_DIR"
    mkdir -p "$CF_SOURCE_DIR"
    run tar -xJf "$FF_TARBALL" -C "$CF_SOURCE_DIR" --strip-components=1
    log "Copying additions and settings..."
    cd "$CF_SOURCE_DIR"
    run bash ../scripts/copy-additions.sh "$VERSION" "$RELEASE"
    cd "$REPO_DIR"
fi

section "GIT INIT (source tree)"
cd "$CF_SOURCE_DIR"
if git rev-parse --git-dir >/dev/null 2>&1 && git tag -l | grep -q "^unpatched$"; then
    log "Git repo with 'unpatched' tag already exists — skipping init"
else
    log "Initializing git repo in source tree..."
    git init -b main 2>&1 | tee -a "$LOGFILE"
    log "Staging all files (this takes several minutes)..."
    git add -f -A 2>&1 | tee -a "$LOGFILE"
    log "Creating initial commit..."
    git commit -m "Initial commit" 2>&1 | tee -a "$LOGFILE"
    git tag -a unpatched -m "Initial commit" 2>&1 | tee -a "$LOGFILE"
fi
cd "$REPO_DIR"

section "PATCHING"
if [ -f "$CF_SOURCE_DIR/_READY" ]; then
    log "Source already patched (_READY exists) — skipping"
else
    log "Applying camoufox patches..."
    export BUILD_TARGET="${TARGET},${ARCH}"
    run python3 scripts/patch.py "$VERSION" "$RELEASE"
    touch "$CF_SOURCE_DIR/_READY"
fi

section "BOOTSTRAP"
if [ -d "$HOME/.mozbuild" ] && [ -x "$HOME/.cargo/bin/rustc" ]; then
    log "Build environment appears ready (.mozbuild + rustc exist) — skipping bootstrap"
    log "  (delete ~/.mozbuild to force re-bootstrap)"
else
    log "Running mach bootstrap..."
    cd "$CF_SOURCE_DIR"
    run env MOZBUILD_STATE_PATH="$HOME/.mozbuild" ./mach --no-interactive bootstrap --application-choice=browser
    cd "$REPO_DIR"
fi

section "BUILD"
export BUILD_TARGET="${TARGET},${ARCH}"
cd "$CF_SOURCE_DIR"
log "Starting mach build (this will take a long time)..."
run ./mach build
cd "$REPO_DIR"

section "PACKAGE"
run make package-${TARGET} arch=${ARCH}
mkdir -p dist
for zip in camoufox-*-${TARGET:0:3}.${ARCH}.zip; do
    [ -f "$zip" ] && mv "$zip" dist/
done

section "INSTALL"
INSTALL_DIR="$HOME/.cache/camoufox"
if [ -d "$INSTALL_DIR" ]; then
    log "Backing up existing install to ${INSTALL_DIR}.bak"
    rm -rf "${INSTALL_DIR}.bak"
    cp -r "$INSTALL_DIR" "${INSTALL_DIR}.bak"
fi
rm -rf "$INSTALL_DIR"
mkdir -p "$INSTALL_DIR"
BUILT_ZIP=$(ls dist/camoufox-*-${TARGET:0:3}.${ARCH}.zip 2>/dev/null | head -1)
if [ -z "$BUILT_ZIP" ]; then
    log "ERROR: No build artifact found in dist/"
    exit 1
fi
log "Extracting $BUILT_ZIP to $INSTALL_DIR"
cd "$INSTALL_DIR"
run unzip -o "$REPO_DIR/$BUILT_ZIP"
echo "{\"version\":\"${VERSION}\",\"release\":\"${RELEASE}\"}" > version.json
chmod -R 755 "$INSTALL_DIR"
cd "$REPO_DIR"

section "UPDATE PYTHON LIBRARY"
SITE_PKGS=$(python3 -c "import camoufox; import os; print(os.path.dirname(camoufox.__file__))" 2>/dev/null || true)
if [ -n "$SITE_PKGS" ] && [ -d "$SITE_PKGS" ]; then
    log "Updating installed camoufox Python package at $SITE_PKGS"
    for f in browserforge.yml utils.py virtdisplay.py sync_api.py async_api.py; do
        src="pythonlib/camoufox/$f"
        [ -f "$src" ] && sudo cp "$src" "$SITE_PKGS/$f" && log "  copied $f"
    done
else
    log "camoufox Python package not found — skipping library update"
fi

section "DONE"
log "Build artifact: $BUILT_ZIP"
log "Installed to: $INSTALL_DIR"
log "Full log: $LOGFILE"
fingerprint_bet365 fingerprint_discord fingerprint_grok fingerprint_realtor fingerprint_whoer

@icepaq
Copy link
Collaborator

icepaq commented Mar 16, 2026

Hey thanks for opening these. We had both the timezone and webrtc fixes already in progress and had some merged in. I was wondering if your changes had any different functionality than the ones already merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

a few bugs with timezone and webrtc in the ff146 beta

3 participants