identity_seed() hashed the whole user agent, browser version included.
A saved identity relaunched on a newer browser claims the new engine
version and nothing else about the machine changes, yet its seed moved,
so every Firefox release redrew its fonts, voices, GPU and media
devices: a site holding the identity's cookies saw a different machine
behind the same profile, the change #442/#765 guard against within one
version. With the same launcher and the same fingerprint, a browser at
150.0.2 and one at 158.0 drew different fonts and a different GPU on
Windows, macOS and Linux identities alike.
The seed now hashes the UA with its rv: and Firefox/ versions taken
out, in both launchers; the OS tokens stay, so identities still differ.
Every pinned identity redraws once, on the release that carries this,
and then stays put across later ones.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(screen): cache the spoofed screen per nsScreen so availWidth costs what stock's does
getter-cost-parity failed on main (run 40142262379): screen.availHeight took
361 ns against stock Firefox 158.0's 178 ns on the CI runner, just over the 2x
bound. Under the default fingerprinting protection, GetAvailRect does stock's
work and then read the context id twice, two per-context memo entries (each a
__tls_get_addr call from libxul), the global screen size, and the context's
navigator.platform, which it copied and converted to UTF-8 on every call.
nsScreen now keeps the spoofed rect and OS for its context and re-reads them
only when RoverfoxStorageManager's generation moves (a new Generation()
accessor; the same staleness rule its own memo uses). SpoofedOSFor also takes
UTF-16, so NavigatorManager::GetSpoofedOS no longer converts.
Local, same host, fastest of 3 guard runs each (stock 88-90 ns):
availHeight, launch identity 117-122 ns -> 107-110 ns
availHeight, context identity 132-134 ns -> 107 ns
screen.width 76-78 ns -> 71 ns (stock 54-56)
Launch and context identities now cost the same, and availHeight / height is
1.5, as stock's is (it was 1.74 here, 2.3 on the runner).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(virtdisplay): count a process reaped mid-read as dead
_alive opens /proc/<pid>/stat and then reads it. When Xvfb exits between the
two, which is the moment test_xvfb_dies_with_the_process_that_started_it waits
for, the read raises ProcessLookupError (ESRCH), not FileNotFoundError, and the
test failed instead of passing (PR #950's pythonlib job).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(virtdisplay): judge Xvfb's exit on the wait loop's own reading
The loop stops when it sees Xvfb as a zombie, and the assert then read /proc
again. That second read lands while Xvfb's new parent reaps it, the window in
which open() succeeds and read() raises ESRCH. Asserting on the loop's last
reading removes the second read; _alive already counts ESRCH as gone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(guards): run on the binary under test, never the installed release
audio-matches-stock failed PR #950's spoofing job with a GitHub API 403 (rate
limit). Re-encoding its config, it called get_env_vars without path=, so the
fontconfig lookup fell back to camoufox_path(): on a runner with no release
installed that fetched one through the anonymous GitHub API (31.7 s of the
guard on main) and read the released bundle, not the build under test.
launch_camoufox, which system-ui-font-spoofing uses, passed no executable_path
at all, so that guard tested an installed or downloaded release and could not
catch a regression in the build.
Both now use the binary under test, and helpers makes camoufox_path() raise in
every guard, so a fallback to the installed release fails at once on a dev box
with a cached release as well as on a runner without one.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
The packages downloaded uBO from AMO at fetch, pinned in
python/src/camoufox/addons.json, so a new uBO, and with #946 its filter
lists, reached users only when someone bumped the pin.
browser/scripts/fetch-ubo.py now resolves AMO's newest release (its guid
and sha256 checked) and extracts it into the package as addons/UBO/
(Contents/Resources/addons/UBO/ on macOS). Both launchers load it from
beside the binary they launch, and `camoufox fetch` no longer downloads
an addon. A build without one, an older release or an unpackaged build,
launches without uBO and warns.
A cut resolves the release once, in a ubo job ahead of tests, and hands
it to tests.yml and every build through CAMOUFOX_UBO, so a uBO published
mid-run cannot ship untested. The release's manifest.json and notes name
it. tests.yml resolves one per run and stages it into the browser every
suite uses; `make stage-ubo` does the same for a local build.
addons.json and the per-version addon cache are gone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The default addon was fetched from AMO's latest-version URL the first time
it was needed, and that copy was reused for good. So two machines on the
same Camoufox release could run different uBlock Origin builds, depending
on the day each cache was filled, and a new uBO release reached users
without passing through CI.
python/src/camoufox/addons.json now names the build: its AMO file URL,
version and sha256. Both packages read it, check each download against the
sha256 before extracting it, and cache each version in its own directory,
addons/<name>/<version>/, so a bump installs fresh instead of reusing
another release's copy. The file's note says where a bump takes its values
from.
The install gate now checks that fetch left the pinned uBO in the cache,
and no staging directories, as it already did for the GeoIP database.
A failed download printed "Failed to download and extract UBO" and the
browser launched without the addon it was asked for. It now raises. A
complete copy another process installed meanwhile is used instead of
being dropped from the launch.
Replace the display_scale option with the one behaviour: the browser renders
at the final config's window.devicePixelRatio (layout.css.devPixelsPerPx), so
(resolution) and the CSS geometry agree with it, whether the identity was
drawn, a preset or supplied. A pref the caller passes still wins. The fpgen
draw's ratio is no longer read, which gave a supplied 2.5 identity no scale
or a scale of 2.
Headful on a real monitor, the display clamp divides by the scale, and a
window that still needs more pixels than the monitor has raises a ValueError
saying so. The monitor is only known in pixels at scale 1 on Linux, so the
scale is applied to the bound there.
New guard: display-scale-resolution (spoofing), which fails on main.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Let a launch leave Web Audio output unmodified
The launchers seed Web Audio noise per identity so a returning identity
reproduces its audio hash. A caller who wanted stock audio output had to
pass audio:seed in config, and NewContext contexts still drew their own
seed.
audio_noise (default True, as before) set to False sends seed 0, which
audio-fingerprint-manager.patch reads as no noise, and NewBrowser
records it so NewContext gives its contexts seed 0 as well. An
audio:seed the caller sets wins either way. Python and TypeScript take
the option the same way, the launch goldens gain an audio_noise_false
scenario, and both package READMEs list it.
On v158.0-beta.40 an OfflineAudioContext probe renders the same with
audio_noise=False across launches, in the page and in a NewContext,
and matches a launch with audio:seed 0; default launches differ.
Split out of #890, without its gpu_passthrough option.
Co-Authored-By: coffeegrind123 <103264516+coffeegrind123@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Let a context turn its Web Audio noise off
A context without an audio seed of its own takes the launch's audio:seed,
so a per-context seed of 0 means "the launch's seed", not "no noise". On a
browser launched with noise, no context could render stock audio.
setAudioFingerprintNoise(false) stores that choice for the calling
context, and AudioFingerprintManager::GetSeed returns 0 for it whatever
the launch seed. The setter has its own gate and is sealed with the
others; the build tester and the setter-seal guard list it.
The context-audio-off guard renders an OfflineAudioContext with the
noise off at launch as the reference, then on a noised launch requires a
context that called the setter to match it, also after a navigation,
while a plain context and a NewContext context stay noised. It fails on
v158.0-beta.40, which has no such setter.
Both patches were regenerated from a tree of the files the series
touches, and the whole series applies to vanilla 158 without fuzz.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Replace audio_noise with fingerprint_options
The launchers take one option for the noise Camoufox adds on top of an
identity, in Python and TypeScript alike:
fingerprint_options={"audio": {"noise": False}} # stock Web Audio
fingerprint_options={"audio": {"seed": 1000433}} # fixed audio seed
fingerprint_options={"canvas": {"randomize": True}}
Without an audio entry the seed still follows the identity; without a
canvas entry randomization is still on for another OS or GPU. Any other
surface or key raises InvalidFingerprintOptions, naming the tribal rules
that keep canvas pixels and glyph spacing unnoised, as do a seed outside
1 to 2**32-1 and noise off together with a seed. fingerprint= stays the
fpgen identity.
canvas_noise= and config={"audio:seed": N} keep working with a
FutureWarning, as a deprecated GeoIP source does; either one together
with the matching fingerprint_options entry raises.
NewContext takes the audio entry per context. Without one a context
follows the browser, read from the audio:seed the launch sent, so
launch_options() and from_options launches behave the same: no noise if
the launch sent 0, otherwise a fresh seed of its own. A context never
takes the browser's seed, fixed or not, since two devices sharing an
audio hash are linked; a per-context seed reproduces a context instead.
A context with its noise off calls setAudioFingerprintNoise(false). On a
noised browser that needs a build with the setter: NewContext asks the
browser once, from an init script in a throwaway context, and raises on
an older build rather than leave the context noised. canvas in a context
raises: randomization belongs to the browser.
audio_noise, context_audio(browser) and _camoufox_audio_noise are gone.
The launch goldens replace audio_noise_false with audio and canvas
scenarios, the init-script golden gains a seed-0 case, and the READMEs,
AGENTS.md and docs/per-context-patches.md describe the option; repo
callers of canvas_noise use the new form.
On v158.0-beta.40, an OfflineAudioContext probe renders the same with
{"audio": {"noise": False}} in the page, in a NewContext and with
config audio:seed 0; default launches differ; seed 1000433 and a
context seed reproduce across launches; a context turning its noise off
on a noised browser raises.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Audio renders as stock: remove the noise, the seed and fingerprint_options
Stock Firefox has one audio fingerprint per CPU architecture. 103 runs of
Firefox 152-158 on 12 CPUs gave 35.749972093850374 on every x86-64 machine
and 35.74996626004577 on every ARM64 one, whatever the OS, sound device,
sample rate or version. The per-identity noise put every Camoufox identity
on a value no real machine renders.
Browser: audio-fingerprint-manager.patch is gone, with
setAudioFingerprintSeed and setAudioFingerprintNoise; font-list-spoofing,
webrtc-ip-spoofing and window-setter-seal are regenerated without its
context (the series applies cleanly to vanilla 158). audio:seed is marked
removed in properties.json.
Library (py and ts): no seed is derived or drawn, and config or
config_overrides carrying audio:seed raise InvalidPropertyType pointing at
the new tribal rule. fingerprint_options, never released, is reverted;
canvas_noise stays as released.
Tests: tribal rule audio-is-not-noised with its test; the
audio-matches-stock guard replaces context-audio-off and
audio-frequency-noise, holding the fpjs buffer, AnalyserNode, biquad and
sine renders to the recorded stock values in several contexts and two
launches while sending the seed released libraries send. build-tester
counts the audio hash as must-match and fails its noise trap.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* A removed audio:seed warns and is dropped; the rule lists each machine
Passing audio:seed in config (or a NewContext config_overrides) no longer
raises. Both launchers drop the key and emit one FutureWarning from
warnings.yml (audio_seed_removed): the option was removed and audio is
rendered exactly as stock Firefox renders it. The caller's dict is left
as it was. Tests on both sides check the single warning and a normal
launch; the launch golden records the warning in order.
audio-is-not-noised now lists the evidence per machine and architecture,
including the Raspberry Pi 4 runs (106 runs: 45 ARM64, 61 x86-64), the
device swap, fpgen's share and what the noise produced.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: coffeegrind123 <103264516+coffeegrind123@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
After MAX_SCALE_FIT_DRAWS fresh draws that did not fit the monitor at
their display scale, or for a supplied identity that did not, the
launchers rendered at 1 without a word, which is the contradiction
display_scale exists to remove. A preset was ignored the same way.
Both now emit a LeakWarning (display_scale_unfit, display_scale_preset
in warnings.yml). It is not silenced by i_know_what_im_doing, which a
supplied fingerprint requires anyway.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fpgen draws a screen at a display scale (1536x864 is a 1920x1080 panel
at 125%) and the browser reports that devicePixelRatio, but renders at
1: (resolution: 1dppx) and the CSS geometry then contradict the screen,
a pair no real machine reports (36% of Windows draws, 74% of macOS
ones; lang315/camoufox#41).
The new launch option display_scale renders at the drawn scale through
layout.css.devPixelsPerPx, snapped to a scaling step the OS offers.
Headful on a real monitor, the identity must fit the panel physically
at that scale: fresh draws are redrawn until one does, a supplied one
that cannot stays at 1, and the display clamp bounds the physical size.
It is off by default, since it changes how every page is rendered and
how large screenshots are. Both launchers take it.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The test docstring claimed every value was measured on stock Windows; four
behaviour prefs were, and the rest are Firefox 158's Windows defaults from its
pref files. windows-keyboard.patch's tables, text bindings and AltGr are GTK
code, so on a macOS host only the editor caret style changes. The test UAs
claim 158.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
searchclipboardfor.middleclick is browser chrome, clipboard.autocopy only fills
the X primary selection, middlemouse.openNewWindow is overridden by the
browser's own link handling, and select popups are drawn in the parent
process. use-system-size is read only by Windows' own LookAndFeel.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The CRT math, keyboard, behaviour prefs and scrollbars a Windows identity
gets on another host are prefs and launch config, so they follow the OS the
browser was launched with. NewContext does not refuse a context of another
OS: a launch without os draws its OS, and the refusal would come and go with
the draw.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The launcher's comments cited Firefox 156 and 152.0.4 as the source of
what they describe. Every Windows behaviour default was checked again
on 158's all.js, firefox.js and StaticPrefList.yaml and still differs
between the Windows and GTK builds; 158's Windows scrollbar default is
still 17 px. The comments now say so without pinning a past release.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Windows Firefox has PlayReady behind EME; a Linux build cannot supply
it, so turning media.eme.enabled on claimed more than the build
delivers. The pref is no longer among the Windows behaviour defaults,
and the Python and TypeScript tests now require that it is left alone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A context sets its own user agent and platform, but appVersion came only
from the launch config, so a macOS context in a Windows launch reported
"5.0 (Windows)" beside a Macintosh user agent, in the page and in its
workers.
navigator-spoofing.patch adds setNavigatorAppVersion, stored, guarded and
removed the way setNavigatorPlatform and setNavigatorUserAgent are, and
read by Navigator::GetAppVersion and WorkerNavigator::GetAppVersion before
the launch config. window-setter-seal.patch seals it with the others, and
is regenerated against Firefox 158 with every patch before it applied.
The launchers' per-context init script calls it with the appVersion
_app_version_from_user_agent already derives for the context's config,
in Python and TypeScript alike, so the rule stays in one place. The
context-app-version guard compares the page against that same function
instead of a copy of its own; the init script golden covers the setter.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When a download failed, maybe_download_addons removed the addon directory
unconditionally. If another process had finished installing the addon in the
meantime, that deleted its good copy, possibly while its browser was loading
it. The handler now removes the directory only when it has no manifest.json,
in both the Python and TypeScript launchers, each with a regression test.
One window remains: two processes that both find a stale, non-empty partial
directory can still interleave its removal and their renames.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The atomic extraction removed the target before renaming into it. With two
processes downloading at once, the second could delete the first's finished
addon while its browser was loading it. If the first renamed in between, the
second's rename failed on the non-empty directory, and its error handler then
deleted the good copy, so it launched without uBlock Origin.
Rename first. If the target is not empty and already holds a manifest.json,
keep it and drop the temp dir; only an incomplete target is replaced. The
TypeScript port mirrors this and gains the atomic-extraction test, and both
gain a regression test for an addon installed during extraction.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`camoufox fetch <repo>/<version>-<build>`, and the plain `fetch` of a
release's paired build, synced every repository in repos.yml before looking
the build up: one GitHub API call per source, plus a manifest download per
listed release. On shared CI runners that exhausted the unauthenticated API
quota. The sync also reads only the newest page of releases, so a pinned
build older than the 30 newest could not be found.
Both now read the build's own release, GET /releases/tags/v<version>-<build>,
and apply the same asset, version-range and interface checks as the sync,
which now share release_versions(). A build published under another tag
(early alphas such as v146-hardware) still resolves through the sync.
Every path where fetch installs nothing now exits 1: an unknown or
incompatible build, a failed API call or download, and a prerelease prompt
that is declined or meets end of input. Previously each printed an error and
exited 0, so CI failed later at launch.
Fixes#919
A cold first Xvfb on a fresh host took 0.6-8.4 s to write its display
number down the -displayfd pipe, close enough to the ten-second bound
that launches failed with "Xvfb did not report a display" though they
would have succeeded. The bound only exists so a hung Xvfb fails rather
than blocking forever; thirty seconds still does that. Both launchers
move together, and the pdeathsig wrapper is unchanged.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* Pin Firefox 157.0
Camoufox beta.33 is built on Firefox 157.0 (was 156.0.1).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* e2e: expect exactly the identity's input kinds from enumerateDevices()
The probe asserted a non-empty pre-grant device list. Stock Firefox lists one
entry per input kind the machine has and no outputs, so a speaker-only identity
(about 6% of Windows draws) correctly lists nothing. Firefox 157.0's UA bump
re-seeded the Windows preset onto such a machine, and 156.0.1 returns the same
empty list for it.
Compare against the kinds the config claims instead: it still fails on an
empty list for a mic/camera identity, and it now also catches a wrong or
missing kind, a host device leaking through, or an enumerateDevices() error.
Gate-Change: Firefox 157.0's version in the UA re-seeds the Windows preset's media-device draw (pythonlib fingerprints.py from_preset -> identity_seed); verified the same empty list on 156.0.1-beta.32 and 157.0 for the no-mic/no-camera identity.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Keep independent window placement with the WM, which Firefox 157 stopped doing
Firefox 157 landed bug 2070008, which deleted the Unix special case in
AppWindow::SizeShell():
bool positionSet = !mIgnoreXULPosition;
#if defined(XP_UNIX) && !defined(XP_MACOSX)
// don't override WM placement on unix for independent, top-level windows
if (!parentWindow) positionSet = false;
#endif
so a top-level window now takes the position persisted in the profile's XUL
store instead of leaving placement to the window manager.
That makes window.screenX/screenY a function of leftover profile state, and a
page can read it. Measured on this branch before the fix, same identity, same
Xvfb:
throwaway profile screenX 4 screenY 4
persistent profile screenX 26 screenY 0
v156.0.1-beta.32 reports 0/0 for both, so the two session types were
indistinguishable and are no longer. fingerprint-injection.patch only answers
GetScreenX/GetScreenY from the config when window.screenX is set, and the
launcher does not draw it for every identity, so the real position shows
through whenever it is absent. A position that varies with profile type
correlates a user's fresh and persistent sessions, and it moves the browser
rect MouseDispatch.js measures (docs/input-dispatch.md).
Nobody places an automation browser's window by hand, so there is no UX here
to gain and determinism to lose. Restores the guard for independent windows
only; dependent windows are still placed relative to their parent, as upstream
intended before and after. Both profile types report 0/0 again.
Caught by typescript/tests/e2e.test.ts:506 in CI, which asserts a persistent
profile presents the same device as a throwaway one.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* Pin Firefox 157.0.1
Camoufox beta.33 is built on Firefox 157.0.1 (was 157.0).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Pin Firefox 158.0
Camoufox beta.33 is built on Firefox 158.0 (was 157.0.1).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Port the Playwright bootstrap patch to Firefox 158
Firefox 158 moved the code under six hunks:
- Bug 2072511 replaced HeadlessWidget::mCompositorWidget with a generic
CompositorWidgetDelegate so the compositor can live in the GPU process.
The screencast snapshot listener now reaches the in-process
HeadlessCompositorWidget through AsHeadlessCompositorWidget().
- Bug 2071024 added movementX/movementY to SynthesizeMouseEventData and
changed the mMovement coalescing check; jugglerEventId and the drag
event synthesis sit beside the new code.
- Bug 1688932 took bit 25 of nsIWebBrowserChrome's chrome flags for
CHROME_MEDIA_PIP. JUGGLER_WINDOW_EXPLICIT_SIZE keeps bit 26, the last
free one.
- Bug 2070965 made UserAgentOverride an nsCString, which moved the
context of the BrowsingContext field-namespace hunk.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Refresh camoufox-window-module.patch context for Firefox 158
Bug 2070772 removed PartnerLinkAttribution.sys.mjs from browser/modules,
so the module list hunk applied only with fuzz. The change is the same.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Port config.patch to Firefox 158's top-level moz.build
Bug 2070828 appended the SBOM GeneratedFile block to the end of the
top-level moz.build, where config.patch adds the lw directory. The lw
directory is still appended last.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Port the worker userAgent override to Firefox 158's nsCString
Bug 2070965 made WorkerNavigator::GetUserAgent take an nsCString, so the
navigator.userAgent override assigns the UTF-8 config value directly
instead of converting it to UTF-16.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Port font-hijacker.patch to Firefox 158's gfx/thebes/moz.build
Bug 2070824 appended license declarations to gfx/thebes/moz.build after
the line the camoucfg include followed. The include is still appended
at the end of the file.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Port the network geolocation override to Firefox 158
Bug 2060572 moved the request's logging into the try block and made it
throw first when geo.provider.network.url is unset. The CAMOU_CONFIG
coordinates are now chosen before that check, so a configured location
is reported without depending on the provider URL, as on Firefox 156.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Port the per-context userAgent to Firefox 158's nsACString getters
Bug 2070965 made Navigator::GetUserAgent and WorkerNavigator::GetUserAgent
return UTF-8 and collapsed the window's custom user agent lookup. The
per-context value is still checked first in both getters and is
converted from the UTF-16 it is stored as.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Refresh screen-spoofing.patch context for Firefox 158
nsRFPService::GetSpoofedStorageLimit, next to the declaration the patch
changes, now returns int64_t, so the hunk applied only with fuzz. The
change is the same.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Refresh sessionstore-popup-close-crash.patch context for Firefox 158
Firefox 158 documented SessionStore.maybeDontRestoreTabs with a JSDoc
block, so the guard applied only with fuzz. The guard is unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Port webrtc-ip-spoofing.patch's include to Firefox 158
Bug 2072208 removed NS_PRINTING and the nsIPrintSettings.h include that
followed xpcpublic.h in nsGlobalWindowInner.cpp. WebRTCIPManager.h is
still included after xpcpublic.h.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Qualify webgl-spoofing's dom names in ClientWebGLContext.cpp
ClientWebGLContext.cpp declares no 'using namespace mozilla::dom'. It
compiled on Firefox 157 only because CanvasImageCache.cpp, earlier in the
same unified dom/canvas chunk, did. Bug 2048943 removed that directive
ahead of renaming nsRange to dom::Range, so the patch now names
RoverfoxStorageManager, WorkerPrivate and WebGLParamsManager with their
dom:: namespace.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Record Firefox 158.0's content-accessible files and chrome names
The contentaccessible-parity guard compares a build against what stock
Firefox of the same version exposes to pages, and refuses a manifest
recorded from another release. Regenerated with
scripts/gen-contentaccessible-manifest.py from the official 158.0 Linux
x86_64 build (BuildID 20261007201254). Among the changes, Firefox 158 no
longer registers the extra-themes-previews resource host (bug 1990883
removed colorways).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Claim EXT_polygon_offset_clamp where Firefox 158 exposes it
Bug 1854003 added EXT_polygon_offset_clamp to WebGL1 and WebGL2 wherever
the GL backend clamps polygon offsets (GLFeature::polygon_offset_clamp:
GL 4.6, ARB_ or EXT_polygon_offset_clamp). fpgen's records come from
Firefox 146, so no identity claimed it, and stock-gpu-parity found stock
158.0 exposing it on this Linux host where Camoufox did not.
- Windows: ANGLE's D3D11 backend sets polygonOffsetClampEXT from feature
level 10_0 (renderer11_utils.cpp), which WebGL2 needs, so devices with
WebGL2 claim it.
- Linux: Mesa (radeonsi, llvmpipe on this host, in GL and GLES contexts)
and NVIDIA's GL 4.6 driver expose it. Recordings from a desktop GL
profile, marked by EXT_depth_clamp (96.6% of Linux records), claim it;
the GLES-only records keep what the device reported.
- macOS: release builds keep webgl.disable-angle and run WebGL on CGL's
GL 4.1, which lacks it. Metal ANGLE is Nightly-only (bug 2072535).
Both launchers place it in Firefox's alphabetical extension order.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Expect EXT_polygon_offset_clamp from the backends Firefox 158 adds it on
The converter and draft-extension tests hard-coded Firefox 156's backend
extensions. The GTX 980 Linux fixture's expected lists now include
EXT_polygon_offset_clamp in Firefox's order, and the Windows device with
WebGL2 expects it beside EXT_depth_clamp; every other assertion is
unchanged. A new test derives the expectation for 100 draws per OS from
each draw itself: Windows devices with WebGL2, Linux desktop GL
recordings, never macOS.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Gate-Change: Firefox 158 (bug 1854003) exposes EXT_polygon_offset_clamp where GLFeature::polygon_offset_clamp holds, and ANGLE D3D11 sets it from feature level 10_0; verified in the 158.0 source (dom/canvas/WebGLExtensions.cpp, gfx/gl/GLContextFeatures.cpp, third_party/angle renderer11_utils.cpp) and by stock-gpu-parity against stock 158.0 on this host
* Follow Firefox 158's WebSocket frame callbacks in Juggler
Bug 1719394 added the HTTP channel ID to
nsIWebSocketEventListener.frameReceived and frameSent, ahead of the
frame. Juggler's listener still took (serialID, frame), so it read the
channel ID as the frame, found no opCode and dropped every frame:
Playwright's framereceived and framesent events never fired
(test_websocket.py::test_should_emit_frame_events and
test_should_reject_wait_for_event_on_close_and_error failed on 158 and
pass on 156.0.1). The listener now takes the new argument.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Key Juggler's pending promises by their Debugger.Object
Bug 2044184 removed Debugger.Object.promiseID in Firefox 158. Juggler
keyed the promises it awaits by it, so every pending promise shared the
key undefined: a second awaited evaluate overwrote the first, which then
never resolved. Playwright waits that poll in the page (waitForElementState,
selectText waiting for visibility) hung whenever another evaluate
returning a promise ran meanwhile. The Debugger.Object is unique per
promise within the debugger and serves as the key instead.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Keep the environment out of forked children's command lines
Firefox's setproctitle() marks the end of the old argv space so the
kernel shows only the new title, then copies the environment strings
right after the title, inside that space. When an environment string's
null lands on the marker, the kernel shows the whole space: the title
followed by the environment. Whether it does depends only on the length
of the install path and of the environment, so it is rare in stock
Firefox. The Firefox 158 package at the parity harness's path hit it on
the RDD process, whose /proc/PID/cmdline then ended in the launching
shell's environment instead of 'rdd'. The marker is set again after the
copy; it lies outside /proc/PID/environ, which is unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
The launcher pins overlay versus classic scrollbars per identity, but
the scrollbars were still drawn by the host build's theme. On a Linux
host a Windows 10 identity's classic gutter measured 12 px (GTK's);
stock Firefox on Windows measures 17. For a Windows identity on a
non-Windows host the launchers now select Windows' non-native
scrollbar style (Windows 10 or 11, following ui.useOverlayScrollbars),
at Windows' own size rather than the host's system metric. A Linux or
macOS identity, and any identity on a Windows host, is left as before.
viewport-no-rdm.py now runs for a Linux and a Windows identity: the
Linux one must show the host theme's non-zero gutter, the Windows one
stock Windows' 17 px. The skiplist's 12 px entries stay right: the
Playwright suite launches the bare binary, which claims no OS.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A Linux build claiming Windows kept Linux's defaults for prefs a page
or the user can observe: EME was off ("EME has been preffed off" is a
Linux-only message), middle click pasted the X11 primary selection,
double-click left out the trailing space, fullscreen was instant,
<select> popups ignored page styling, and scrollbar track clicks
followed GTK.
The launchers now set Firefox's Windows defaults for these
(windowsBehaviourPrefs in launcher-constants.json, shared by the
Python and TypeScript launchers) when a Windows identity runs on a
non-Windows host, where upstream did nothing. Caller-supplied values
still win. Each one was checked against 156.0.1's all.js, firefox.js
and StaticPrefList.yaml and still differs between the Windows and GTK
builds, the fullscreen transition included: GTK builds default to
"0 0" there, so it is not redundant now that camoufox.cfg no longer
sets it.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A Linux build claiming Windows edited text the GTK way, which both the
user and the page could tell: Alt+Backspace did not undo, Shift+Delete
with nothing selected did nothing, Ctrl+Up in a textarea moved up a line
instead of to its start, Ctrl+/ selected all, Ctrl+Backspace on a rich
text selection deleted only the selection, and AltGr reported keyCode
225 where Windows reports 18.
windows-keyboard.patch switches on config input:windowsKeyboard, which
the launcher sets for Windows identities on a non-Windows host, where
upstream did nothing. The shortcut tables are Windows' own, built from
the same definitions file with the Windows platform macros; GTK's
native text bindings are skipped, including the emulated ones that
synthesized (Playwright) key events get from GetEditCommandsForTests;
AltGr reports Alt and HTML editors take Windows' caret style. Without
the key, or with it false, behaviour is unchanged. The key is
launch-wide: the shortcut tables and GTK's key handling are
process-level. The patch relies on touchscreen-fingerprint-spoofing
for /camoucfg in dom/events and was re-derived on 156.
The windows-keyboard guard checks each behaviour for a Windows and a
Linux identity, with real X11 keys where only a native event exercises
the code, so the parity leg installs xdotool and setxkbmap.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The last bit of these differs between glibc (or fdlibm) and the
Windows CRT, so one call told a page that a build claiming Windows ran
on Linux: against stock 152.0.4 on Windows, sin differed on 22, cos on
26 and tan on 30 of 1,670 inputs, pow on 45 of 1,410.
windows-crt-math.patch adds javascript.options.use_ucrt_math, which
routes them to ports of ucrtbase.dll's FMA3 code path
(browser/additions/js/src/builtin/UcrtMath*.c), keeping SpiderMonkey's
own pow fast paths. On 156 the pow hook sits in pow_libm_or_fdlibm, the
one place both callers already reach the platform pow. It is built
only for 64-bit non-Windows targets, without FP contraction. The
launcher turns it on for Windows identities on a non-Windows host,
where upstream did nothing; the TypeScript launcher does the same.
browser/tests/ucrt-math checks the C alone against ucrtbase.dll on
~127,000 results in the static job. The windows-crt-math guard checks
the browser against stock Windows Firefox cold, JIT-hot and constant
folded, with a pref-off control that must differ; a missing result
counts as a difference.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
With headless="virtual", NewBrowser and AsyncNewBrowser start Xvfb
first, and only sync/async_attach_vd ties its kill() to closing the
browser. Anything that raised in between -- launch_options() on a bad
proxy or unsatisfiable constraints, the Playwright launch on a missing
binary -- left one Xvfb and its /tmp/.X<n> lock behind per failed
launch. Both now kill the display on any exception before re-raising,
as the TypeScript launcher already does.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
public_ip() probed each IP service with a 5 s timeout whether or not
it went through a proxy, and proxy_exit_geo() used 10 s. A proxied
probe adds a hop and a TLS handshake behind it, so a proxy that routes
the long way round timed out on every URL and failed the whole launch.
Lookups through a proxy now get 15 s; direct ones keep 5 s. The
TypeScript launcher sizes its per-proxy clients the same way.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
add_default_addons() took `with Lock():` on a multiprocessing.Lock made
fresh for each call, which guarded nothing: two launches in one process
both found no manifest.json and both downloaded and extracted uBO into
the same directory. The lock is now one threading.Lock for the module.
A launch in another process does not see that lock, and it trusts any
addon directory holding a manifest.json. Extraction now goes into a
sibling temp directory that is renamed into place last, so the manifest
never appears before the rest of the addon.
The TypeScript launcher serializes the same check-then-extract on one
promise chain and extracts the same way.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The sonoma base claimed `System Font` plus 29 translations of it, and
fontconfig resolves every one of them to the same file. Font fallback walks the
claimed family list once per codepoint the page's own fonts do not cover, so an
emoji-heavy page loaded and scanned that single face thirty times per miss: the
content process spent about 12 s of a 30 s window inside one reflow, answering
nothing.
A real macOS resolves none of the 29. CTFontCreateWithName returns Helvetica
for them, exactly as it does for a name that cannot exist, so a page measuring
text in `Police système` saw it absent on a real Mac and present on a sonoma
identity. Claiming them was a tell of its own, and the freeze is measurable
from script. `tahoe26` and `macos27` already claim one name each.
font-bases.json is the regenerated projection of the manifest
(browser/scripts/gen-font-groups.py), not a hand edit; font-groups.json, which
that script also writes, comes out unchanged.
Closes#832
headless="virtual" started Xvfb in its own session and stopped it only on
the browser's close path. A launcher ended by a signal (timeout, a
supervisor, a cancelled CI job) never reaches that path, so its Xvfb ran
forever, together with the session bus and desktop helpers Firefox
autolaunched on that display.
Both packages now exec Xvfb through `setpriv --pdeathsig TERM`, so the
kernel signals it when its launcher dies, even by SIGKILL. SIGTERM lets
Xvfb remove its own lock and socket, and the autolaunched bus exits when
it loses its X connection. setpriv comes from util-linux.
The leak suite missed this because every crash test keeps the launcher
alive to tear down, and leak_check follows only our descendants, which an
orphan no longer is. test_launcher_sigkill_leaves_nothing_on_its_display
kills the launcher and looks machine-wide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* 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>
In both Python and TypeScript launchers, IP validation used loose regular
expressions that allowed octets above 255 for IPv4 (e.g. 999.999.999.999)
and malformed colon sequences for IPv6 (e.g. :, :::, 1::2::3).
Downstream, these invalid addresses reached WebRTC init script generation
and MaxMind DB lookups, causing broken script calls or unhandled errors
instead of rejecting them early with InvalidIP.
Replaced the regex checks with ipaddress in Python and node:net in
TypeScript, and added test cases covering the boundary strings.
The pinned model files were dated 2100-01-01 so fpgen's five-week refresh
never replaces them. AWS Lambda keeps file times as signed 32-bit seconds and
reads that date back as 1963, so every launch tried to re-date the files,
Lambda's read-only filesystem raised EROFS, and the launch failed. Had the
error been ignored, fpgen would have seen a 1963 file as stale and fetched
its own model over the pin.
The files are now dated 2038-01-01, which a 32-bit filesystem stores as is.
A file that cannot be re-dated for any reason, not only a permission error,
is also left alone while fpgen still considers it current, so a read-only
image built with the earlier date keeps working. A stale file that cannot be
re-dated still fails the launch.
Fixes#854.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Both launchers hard-coded Firefox 156's GetSpoofedScreenAvailSize offsets
(48 Windows, 76 macOS, 0 Linux) and the collapsed touch-point count. They now
read them from the shared constants file, as the other values both launchers
use already do.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
- One helper, RoverfoxStorageManager::UserContextId(), reads the user
context from a principal, node or window. Every per-context lookup used
the browsing context instead, which a document from
createHTMLDocument() or DOMParser does not have, so a canvas there read
context 0, which held whichever context set its values last: a page
could see two GPUs (#839) or another context's font list. The setters
no longer copy their values into context 0.
- UNMASKED_RENDERER_WEBGL and UNMASKED_VENDOR_WEBGL apply stock's
fingerprinting-protection checks before the spoofed value, as RENDERER
does, so the two never disagree.
- system-ui, the CSS2 system fonts and WebRTC's fabricated port use the
context's own OS (NavigatorManager::GetSpoofedOS), not the launch's, so
a macOS context of a Windows launch no longer resolves Segoe UI.
- CamoufoxWindow sizes only windows the driver opens; a page's popup keeps
the size it asked for.
- camoufox.cfg applies CAMOU_PREFS through the default branch and quits
with the reason on stderr when a pref cannot be applied, instead of
starting without it.
- Delete commented-out prefs; shorten the setter-seal comments into a
tribal rule; mark the unread navigator.buildID key removed.
- Refresh five patches that only applied with fuzz; the patched tree is
byte-identical.
- Guards: webgl-renderer-pair covers data and DOMParser documents, two
contexts and the unmasked vendor; new context-os-system-font and
popup-window-size; startup-prefs covers the loader's failures.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The skiplist audit runs each entry in its own pytest process without
upstream's reruns. test_browsercontext_proxy.py shares one browser, and
HTTPS-First's per-host exception means only its first proxied navigation
fails, so every navigating test there is listed and each is audited from
a fresh browser. Record HTTPS-First staying on in ci/tribal-rules.yml.
- Drop the test_worker locale entry and its overlay test: upstream v1.62.0
asserts the same ru-RU behaviour, so the entry passed the audit.
- browser/bundle/fontconfig ships in every package, so it is now a browser
input (BROWSER_DIRS and the resolve grep), with a test that every
--includes path is one.
- Revert the binary-config-keys allowance: a driver-only PR tests the release
paired by source digest, which covers properties.json.
- Playwright guards use helpers.resolve_binary and a new helpers.launch_kwargs
instead of per-file copies.
- Docs: absolute links in the PyPI/npm READMEs, a Python development section,
repository-root markers in the patch guide, Playwright porting merged into
it, fpgen-js, the moved fpgen pin and font-constant files, and the
canvas-noise and browser/executable_path launcher changes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gen-fonts-json.py and verify-fonts.py read the groups listed in groups.json
through _font_bundle.read_groups(). Neither falls back to the per-OS layout
the group layout replaced any more: a bundle without groups.json is an error.
test_salt_of_equal_objects_is_equal had slipped inside another test's body
and never ran; it is back in TestPinnedIdentityIsStable and passes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Values both launchers hard-coded (marker fonts, the Windows 11 fonts, the
Apple Silicon and Intel Mac core and panel tables, plausible DPR and core
counts, the macOS MacinTalk/Eloquence voices, the cache prefs) now live in
python/src/camoufox/launcher-constants.json, which the TypeScript package
ships as a data file. gen-fonts-json.py and verify-fonts.py read the same
file, so the drifted PingFang marker copy is gone (fonts.json regenerates
byte-identical) and verify-fonts no longer ast-parses fingerprints.py.
- Drop the duplicate fpgen model pin under browser/scripts/data; the TS
test checks the fpgen package's MODEL_PIN against the Python copy.
- Move pin-fpgen-model.py and clean-fingerprint-data.py to python/scripts.
- Delete the font licence report (font-metrics/licences.py and its saved
output, open-fonts.txt): the bundle ships as built, so the report checks
nothing.
- Delete unreferenced files: cleanfonts.sh, python/examples,
typescript/renovate.json.
- Delete dead code: classify_installs, remove_mmdb, write_upstream_sh,
bump_release, unused test constants and fixture helpers, the
_virtual_display attribute writes, package.py's pre-groups font copy (a
missing groups.json now fails).
- Share require_bundle, zip_entries, gh_headers and parse_shard instead of
keeping copies; fold GitHubDownloader into CamoufoxFetcher in both
launchers.
- TS raises ValueError where Python does, and `camoufox version` prints the
fpgen package version as Python does.
- Python tests get src/ from pytest's pythonpath instead of sys.path
inserts; skips that hid untested paths now assert or test the behaviour.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>