[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.
This commit is contained in:
daijro 2024-12-09 02:47:32 -06:00
parent 8781015338
commit a8e0855639
7 changed files with 52 additions and 4 deletions

6
.gitignore vendored
View file

@ -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

View file

@ -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/')

View file

@ -158,6 +158,10 @@ inline std::optional<bool> GetBool(const std::string& key) {
return std::nullopt;
}
inline bool CheckBool(const std::string& key) {
return GetBool(key).value_or(false);
}
inline std::optional<std::array<uint32_t, 4>> GetRect(
const std::string& left, const std::string& top, const std::string& width,
const std::string& height) {

View file

@ -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<webgl::ShaderPrecisionFormat> ret;

View file

@ -270,6 +270,9 @@
"stencil": "bool"
},
"canvas:aaOffset": "int",
"canvas:aaCapOffset": "bool",
"voices": "array[@VOICE_TYPE]",
"voices:blockIfNotDefined": "bool",
"voices:fakeCompletion": "bool",

View file

@ -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" },

View file

@ -1,2 +1,2 @@
version=133.0
release=beta.18
release=beta.19