Skip to content

Commit

Permalink
[Closed] feat: Canvas anti-fingerprinting beta.19
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
daijro committed Dec 9, 2024
1 parent 8781015 commit a8e0855
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 4 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jsonvv/test*
/bundle/fonts/extra
pythonlib/*.png
scripts/*.png
scripts/test*
.vscode
/tests/*.disabled
k8s/
Expand All @@ -34,3 +35,8 @@ venv/
__pycache__/
*.pyc
*.mmdb

# Closed source patches
private
.passwd
closedsrc
33 changes: 33 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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/')
4 changes: 4 additions & 0 deletions additions/camoucfg/MaskConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions patches/webgl-spoofing.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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;
+ }
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions settings/camoucfg.jvv
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,9 @@
"stencil": "bool"
},

"canvas:aaOffset": "int",
"canvas:aaCapOffset": "bool",

"voices": "array[@VOICE_TYPE]",
"voices:blockIfNotDefined": "bool",
"voices:fakeCompletion": "bool",
Expand Down
2 changes: 2 additions & 0 deletions settings/properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
Expand Down
2 changes: 1 addition & 1 deletion upstream.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version=133.0
release=beta.18
release=beta.19

0 comments on commit a8e0855

Please sign in to comment.