From 99e2b0c363207ae4ab5924e310c8af53c720ae29 Mon Sep 17 00:00:00 2001 From: Jake Writer Date: Fri, 25 Sep 2026 15:06:36 -0600 Subject: [PATCH] fix(python): fingerprint_preset=False no longer turns presets on launch_options checked `fingerprint_preset is not None`, so passing False drew a random bundled preset, the opposite of what was asked. It now uses a truthiness check, and a test proves that None and False never draw a preset. Co-Authored-By: Claude Opus 5.5 --- pythonlib/camoufox/utils.py | 2 +- pythonlib/tests/test_identity_salt.py | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/pythonlib/camoufox/utils.py b/pythonlib/camoufox/utils.py index 317bb0b..5b125ef 100644 --- a/pythonlib/camoufox/utils.py +++ b/pythonlib/camoufox/utils.py @@ -1038,7 +1038,7 @@ def launch_options( # User passed a custom fingerprint if not i_know_what_im_doing: check_custom_fingerprint(fingerprint) - elif fingerprint_preset is not None: + elif fingerprint_preset: # User opted into real fingerprint presets if isinstance(fingerprint_preset, dict): preset = fingerprint_preset diff --git a/pythonlib/tests/test_identity_salt.py b/pythonlib/tests/test_identity_salt.py index f63ef7a..f371cea 100644 --- a/pythonlib/tests/test_identity_salt.py +++ b/pythonlib/tests/test_identity_salt.py @@ -162,3 +162,11 @@ class TestPrefsEnvIsAscii: joined = "".join(env[f"CAMOU_PREFS_{i}"] for i in range(1, len(env) + 1)) assert joined.isascii() assert orjson.loads(joined) == prefs + + +@pytest.mark.parametrize("off", [None, False]) +def test_fingerprint_preset_off_never_draws_a_preset(off): + """`fingerprint_preset=False` means off, the same as None. It used to be + checked with `is not None`, so False drew a random bundled preset.""" + with mock.patch.object(utils, "get_random_preset", side_effect=AssertionError("preset drawn")): + launch(fingerprint_preset=off)