From a8e08556393b05845d77a409752bcb3807a19792 Mon Sep 17 00:00:00 2001 From: daijro Date: Mon, 9 Dec 2024 02:47:32 -0600 Subject: [PATCH] [Closed] feat: Canvas anti-fingerprinting beta.19 Added undetectable Canvas shape & line fingerprint rotation by modifying the Skia rendering pipeline. This bypasses all known Canvas pixel integrity tests. Note: Due to this repository being monitored, the source for this patch is closed. All GitHub releases will still have this patch included in it. However, this patch will not be included in local builds of Camoufox. --- .gitignore | 6 ++++++ Makefile | 33 +++++++++++++++++++++++++++++++ additions/camoucfg/MaskConfig.hpp | 4 ++++ patches/webgl-spoofing.patch | 6 +++--- settings/camoucfg.jvv | 3 +++ settings/properties.json | 2 ++ upstream.sh | 2 +- 7 files changed, 52 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 8cefd1e..57177db 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ jsonvv/test* /bundle/fonts/extra pythonlib/*.png scripts/*.png +scripts/test* .vscode /tests/*.disabled k8s/ @@ -34,3 +35,8 @@ venv/ __pycache__/ *.pyc *.mmdb + +# Closed source patches +private +.passwd +closedsrc diff --git a/Makefile b/Makefile index aaecd59..f75b82c 100644 --- a/Makefile +++ b/Makefile @@ -43,6 +43,26 @@ _ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS)) $(eval $(_ARGS):;@:) fetch: + # Fetching private patches... + @if [ -d "patches/private" ]; then \ + echo "Found patches/private. Skipping private patches fetch..."; \ + else \ + if [ -z "$$CAMOUFOX_PASSWD" ]; then \ + echo "CAMOUFOX_PASSWD environment variable not set. Skipping private patches..."; \ + else \ + echo "Fetching private patches..."; \ + mkdir -p patches/closedsrc; \ + if ! aria2c --dry-run "https://camoufox.com/pipeline/rev-$(version)-$(release).7z" 2>/dev/null; then \ + echo "No private patches found for this version"; \ + exit 1; \ + else \ + aria2c -o rev-$(version)-$(release).7z "https://camoufox.com/pipeline/rev-$(version)-$(release).7z" && \ + 7z x -p"$$CAMOUFOX_PASSWD" rev-$(version)-$(release).7z -o./patches/closedsrc && \ + rm rev-$(version)-$(release).7z; \ + fi; \ + fi; \ + fi + # 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: @@ -193,6 +213,9 @@ check-arg: exit 1; \ fi +grep: + grep "$(_ARGS)" -r ./patches/*.patch + patch: @make check-arg $(_ARGS); cd $(cf_source_dir) && patch -p1 -i ../$(_ARGS) @@ -221,4 +244,14 @@ tests: update-ubo-assets: bash ./scripts/update-ubo-assets.sh +upload: + # =============================== + # This is only for internal use. You can ignore this. + # =============================== + + @test -f .passwd || { echo "Error: .passwd file not found"; exit 1; } + @mkdir -p ../camoufox-web/internal + @rm -rf ../camoufox-web/pipeline/rev-$(version)-$(release).7z + 7z a "-p$$(cat ./.passwd)" -mhe=on ../camoufox-web/pipeline/rev-$(version)-$(release).7z "./patches/private/*.patch" + vcredist_arch := $(shell echo $(arch) | sed 's/x86_64/x64/' | sed 's/i686/x86/') diff --git a/additions/camoucfg/MaskConfig.hpp b/additions/camoucfg/MaskConfig.hpp index 1b61b65..76fc407 100644 --- a/additions/camoucfg/MaskConfig.hpp +++ b/additions/camoucfg/MaskConfig.hpp @@ -158,6 +158,10 @@ inline std::optional GetBool(const std::string& key) { return std::nullopt; } +inline bool CheckBool(const std::string& key) { + return GetBool(key).value_or(false); +} + inline std::optional> GetRect( const std::string& left, const std::string& top, const std::string& width, const std::string& height) { diff --git a/patches/webgl-spoofing.patch b/patches/webgl-spoofing.patch index 8b2d403..0000d86 100644 --- a/patches/webgl-spoofing.patch +++ b/patches/webgl-spoofing.patch @@ -164,8 +164,8 @@ index a1e5c4792d..be99491bf8 100644 + case dom::WEBGL_debug_renderer_info_Binding::UNMASKED_VENDOR_WEBGL: + break; + default: -+ if (MaskConfig::GetBool(mIsWebGL2 ? "webGl2:parameters:blockIfNotDefined" -+ : "webGl:parameters:blockIfNotDefined")) { ++ if (MaskConfig::CheckBool(mIsWebGL2 ? "webGl2:parameters:blockIfNotDefined" ++ : "webGl:parameters:blockIfNotDefined")) { + retval.set(JS::NullValue()); + return; + } @@ -319,7 +319,7 @@ index a1e5c4792d..be99491bf8 100644 + }); + } + // Check if block if not defined is on -+ if (MaskConfig::GetBool( ++ if (MaskConfig::CheckBool( + mIsWebGL2 ? "webGl2:shaderPrecisionFormats:blockIfNotDefined" + : "webGl:shaderPrecisionFormats:blockIfNotDefined")) { + Maybe ret; diff --git a/settings/camoucfg.jvv b/settings/camoucfg.jvv index 83da945..4ac015f 100644 --- a/settings/camoucfg.jvv +++ b/settings/camoucfg.jvv @@ -270,6 +270,9 @@ "stencil": "bool" }, + "canvas:aaOffset": "int", + "canvas:aaCapOffset": "bool", + "voices": "array[@VOICE_TYPE]", "voices:blockIfNotDefined": "bool", "voices:fakeCompletion": "bool", diff --git a/settings/properties.json b/settings/properties.json index 938d723..22262ed 100644 --- a/settings/properties.json +++ b/settings/properties.json @@ -83,6 +83,8 @@ { "property": "webGl2:shaderPrecisionFormats:blockIfNotDefined", "type": "bool" }, { "property": "webGl:contextAttributes", "type": "dict" }, { "property": "webGl2:contextAttributes", "type": "dict" }, + { "property": "canvas:aaOffset", "type": "int" }, + { "property": "canvas:aaCapOffset", "type": "bool" }, { "property": "voices", "type": "array" }, { "property": "voices:blockIfNotDefined", "type": "bool" }, { "property": "voices:fakeCompletion", "type": "bool" }, diff --git a/upstream.sh b/upstream.sh index 860a44b..5ba7fd2 100644 --- a/upstream.sh +++ b/upstream.sh @@ -1,2 +1,2 @@ version=133.0 -release=beta.18 +release=beta.19