Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
681776e163 | ||
|
|
61e5cf77a5 | ||
|
|
49198e564b | ||
|
|
2f4cb2b849 | ||
|
|
386c5b2a43 | ||
|
|
88b1e368ee | ||
|
|
b66b48c1b3 | ||
|
|
7df642ef80 | ||
|
|
11a55e6bdd | ||
|
|
43c700f844 | ||
|
|
9a3934b71e | ||
|
|
0e9fc1c4c9 | ||
|
|
95be78e9af | ||
|
|
1fc5e27e2b | ||
|
|
96ac32a38e | ||
|
|
8a7cf03b63 | ||
|
|
fa22d481af | ||
|
|
a77c3f4e9a | ||
|
|
16c1190755 | ||
|
|
eb9a62b5cc | ||
|
|
c27dbe4600 | ||
|
|
707515a3f1 | ||
|
|
1c827f3da7 | ||
|
|
a9320111dc | ||
|
|
b32e8167ed | ||
|
|
a23b972e7f | ||
|
|
9fe8ce3b66 | ||
|
|
6232574f3d | ||
|
|
835e93f4f9 | ||
|
|
c3e48b6e6e | ||
|
|
6e87c964f1 | ||
|
|
32f2af8808 | ||
|
|
8178a2a330 | ||
|
|
068db0f9bf | ||
|
|
37bc5abdc7 | ||
|
|
eba6ced288 | ||
|
|
e3c2b9871c | ||
|
|
c6aee91109 | ||
|
|
6763c03418 | ||
|
|
563b9ba53f | ||
|
|
eef4916c97 | ||
|
|
e9a2a1e13f | ||
|
|
fa37048123 | ||
|
|
795e1f60c1 | ||
|
|
79e6ea98e5 | ||
|
|
40e9540ed9 | ||
|
|
2e8e8d9d7e | ||
|
|
dae2dfd6df | ||
|
|
25c8fd2c79 | ||
|
|
680bb9dd28 | ||
|
|
736aa2c7b1 | ||
|
|
f213884d25 | ||
|
|
d8a7e90cfe | ||
|
|
f02bacfbe1 | ||
|
|
fa4ffee15e | ||
|
|
b86e18a719 | ||
|
|
50e283486a | ||
|
|
ea9c8368c2 | ||
|
|
8dd44bd779 | ||
|
|
e3f36fd57f | ||
|
|
d7b1c2aa5c | ||
|
|
f948ef6dcd | ||
|
|
7cfbd7e37a | ||
|
|
f35bed21a2 | ||
|
|
d53800aca7 | ||
|
|
9a7b26b643 | ||
|
|
d259c26510 | ||
|
|
7c70d68be4 | ||
|
|
41a91068b0 | ||
|
|
d63f68557f | ||
|
|
a6cd40696b | ||
|
|
f799d015b1 | ||
|
|
ab4065dd69 | ||
|
|
c2d4839865 | ||
|
|
d2f7111267 | ||
|
|
db991ff770 | ||
|
|
3f524c834c | ||
|
|
25d5d2d2d5 | ||
|
|
73d1f013c3 | ||
|
|
b453c6b274 | ||
|
|
ad2ec1943b | ||
|
|
4a565b7ef9 | ||
|
|
ae28582691 | ||
|
|
177e85952a | ||
|
|
6a9f7e83f4 | ||
|
|
f3a45c0dc8 | ||
|
|
e9a457aace | ||
|
|
b5eb96f7ee | ||
|
|
8cb8699b3a | ||
|
|
036ac35034 | ||
|
|
f4600827af | ||
|
|
cd5866f4f6 | ||
|
|
b38998014b | ||
|
|
14e746585f | ||
|
|
0d57abbfb2 | ||
|
|
9832f4e3d3 | ||
|
|
e1f954a59f | ||
|
|
7d0fbebe88 | ||
|
|
72547a1930 | ||
|
|
fd5137e38a | ||
|
|
20f7e7f488 | ||
|
|
f601e6a8d8 | ||
|
|
60a1a10e50 | ||
|
|
58e93cfcbf | ||
|
|
fd2eb6d7d6 | ||
|
|
e4995a2432 | ||
|
|
65d49c1754 | ||
|
|
c5b6377fb3 | ||
|
|
d30cad79e9 | ||
|
|
7c0ad0115e | ||
|
|
6554774bf7 | ||
|
|
1643d2fa0e | ||
|
|
fa838b95c4 | ||
|
|
d97b8ee595 | ||
|
|
9b38311d0b | ||
|
|
25168cbe05 | ||
|
|
4051e4aa02 | ||
|
|
28dafca0b8 | ||
|
|
af3ed66d9d | ||
|
|
2d65a40048 | ||
|
|
d9bb4d978d | ||
|
|
374966e634 | ||
|
|
3037dce9f0 | ||
|
|
020c3ad603 | ||
|
|
c7211e4749 | ||
|
|
58470ca190 | ||
|
|
c2e888475d | ||
|
|
f6a077d269 | ||
|
|
0c4b876412 | ||
|
|
bcb33508fc | ||
|
|
70e315bf8d | ||
|
|
d10bc9727b | ||
|
|
657d681dfc | ||
|
|
a620db46c1 | ||
|
|
0d6bb4e061 | ||
|
|
d0133127db | ||
|
|
e237925246 | ||
|
|
b9bae06477 | ||
|
|
1086814414 | ||
|
|
4f5f709ce6 | ||
|
|
1ad0264c87 | ||
|
|
bd6a5f7960 | ||
|
|
c651f8e286 | ||
|
|
1d841b295c | ||
|
|
7b912f6729 | ||
|
|
61a15f9d69 | ||
|
|
2770891acd | ||
|
|
707720b691 | ||
|
|
33cebafd84 | ||
|
|
93a2df7612 | ||
|
|
01d692be2a | ||
|
|
8180b624f1 | ||
|
|
22b53847f0 | ||
|
|
5e5d0f516d | ||
|
|
5ed8dd6ba2 | ||
|
|
7ca67819c6 | ||
|
|
28b6a2ccd7 | ||
|
|
5c1e5fdb88 | ||
|
|
98788cbf4a | ||
|
|
46c4e43e54 | ||
|
|
2f5f6c7869 | ||
|
|
d3b514cf4b | ||
|
|
d784dbbfba | ||
|
|
c813380366 | ||
|
|
72fb16d728 | ||
|
|
7361ed08a2 | ||
|
|
c6c45cd8ff | ||
|
|
06096159b0 | ||
|
|
b6c74fca67 | ||
|
|
14050be60b | ||
|
|
a5f3356f94 | ||
|
|
07a931c3e3 | ||
|
|
e3219d9271 | ||
|
|
d55bc06e68 | ||
|
|
062fea1d0a | ||
|
|
0e026eb7f5 | ||
|
|
0fea48789e | ||
|
|
e61a60d9ee | ||
|
|
6d21f5ffe8 | ||
|
|
532dd36a79 | ||
|
|
5499a17fcf | ||
|
|
d1c2a0fc56 | ||
|
|
f2cd7e5424 | ||
|
|
dcf56a9b41 | ||
|
|
62c5649f99 | ||
|
|
489d4f44b3 | ||
|
|
3fcea64f9f | ||
|
|
b70947992f | ||
|
|
c53f15d9ec | ||
|
|
682983f393 | ||
|
|
fa6cd61648 | ||
|
|
48c47a1083 | ||
|
|
115666fb0b | ||
|
|
39a5b4c55d | ||
|
|
f3b300b43a | ||
|
|
bfc8144bf9 | ||
|
|
e2deaa5059 | ||
|
|
713d501b3a | ||
|
|
75f407b124 | ||
|
|
f3e54a6bbe | ||
|
|
5a8ef19726 | ||
|
|
60b3111340 | ||
|
|
3193b819ae | ||
|
|
9d9b584324 | ||
|
|
20210fddec | ||
|
|
b64f800095 | ||
|
|
00441aba97 | ||
|
|
8ad766a1a3 | ||
|
|
097671495e | ||
|
|
b096a9db6b | ||
|
|
b61f82ef52 | ||
|
|
8357ed7077 | ||
|
|
9ed0e035b3 | ||
|
|
9facf961f5 | ||
|
|
6c4d431ce9 | ||
|
|
e4ca2b5027 | ||
|
|
d7bcb56af3 | ||
|
|
0bba55987d | ||
|
|
a8cbe9be6c | ||
|
|
01c2512771 | ||
|
|
eee4bd9fed | ||
|
|
08cc7a90c6 | ||
|
|
c735a975b3 | ||
|
|
060914971d | ||
|
|
d737cf7d68 | ||
|
|
6d6b45c112 | ||
|
|
3bfeb9535f | ||
|
|
9e7be64592 | ||
|
|
0477dcdf3c | ||
|
|
c407928dd2 | ||
|
|
2942dc4ac4 | ||
|
|
ff5afb86ba | ||
|
|
29e3dadb11 | ||
|
|
22f86499a6 | ||
|
|
b6bf924edc | ||
|
|
f505113151 | ||
|
|
b324b27723 | ||
|
|
af895b9b25 | ||
|
|
07c3e85ad9 | ||
|
|
e57be7b945 | ||
|
|
e53308b67d | ||
|
|
50e9d92be7 | ||
|
|
bfe801fede | ||
|
|
476e2f9816 | ||
|
|
e3d7bf87b0 | ||
|
|
ec7ab894f5 | ||
|
|
2d9ae0ea5b | ||
|
|
94faa93cba | ||
|
|
5736c9769b | ||
|
|
f773022a6f | ||
|
|
8c6652bb7a | ||
|
|
0d1236b244 | ||
|
|
e6a2215544 | ||
|
|
f69f26a45e | ||
|
|
ad8827f397 | ||
|
|
82f148c9d3 | ||
|
|
f082f46b0f | ||
|
|
496be20fe9 | ||
|
|
4bd2d02668 | ||
|
|
f27e2fb81b | ||
|
|
951863b94b | ||
|
|
9493764cb3 | ||
|
|
dedc60e411 | ||
|
|
bb6fc67b91 | ||
|
|
9e7b9fc1e2 | ||
|
|
f77e2d5873 | ||
|
|
9fade94c7a | ||
|
|
d0e8e3b64a | ||
|
|
64f00d94ea | ||
|
|
cd904bcdfb | ||
|
|
5ba890bcc6 | ||
|
|
52591e5524 | ||
|
|
9d21ce019b | ||
|
|
f93163d1ef | ||
|
|
4fc723ae36 | ||
|
|
a483b73e3d | ||
|
|
c464c11260 | ||
|
|
895ea47176 | ||
|
|
a33fc26f03 | ||
|
|
6370041c09 | ||
|
|
8497a980c4 | ||
|
|
d33361c862 | ||
|
|
297e10d641 | ||
|
|
b2ffb14564 | ||
|
|
db1422fe41 | ||
|
|
4b44acb49b | ||
|
|
70c8028214 | ||
|
|
e860f8ff8c | ||
|
|
c18d5cf4f1 | ||
|
|
2e9feb1f86 | ||
|
|
23ca48db4c | ||
|
|
4314909230 | ||
|
|
283a959ab0 | ||
|
|
91a16d2fbd | ||
|
|
45c4e44a7b | ||
|
|
3d33d6edaf | ||
|
|
c68c21896a | ||
|
|
80b790995b | ||
|
|
642707c785 | ||
|
|
5e0830f3a3 | ||
|
|
0a21a8857a | ||
|
|
a630a23173 | ||
|
|
3a79606701 | ||
|
|
ed942ac5ef | ||
|
|
f7963bbb5f | ||
|
|
a4dd630790 | ||
|
|
e4bef53d1a | ||
|
|
26acc297a4 | ||
|
|
15d68ffe44 | ||
|
|
4414a4fb48 | ||
|
|
caa263fbf1 | ||
|
|
c341ada26a | ||
|
|
e840df51cc | ||
|
|
5a6cd97c9f | ||
|
|
93a89b1cba | ||
|
|
514445ba03 | ||
|
|
be3c6e90e3 | ||
|
|
195c962dde | ||
|
|
b7bfb36452 | ||
|
|
763d74aba6 | ||
|
|
c1911ac28f | ||
|
|
e490078927 | ||
|
|
5f78593e53 | ||
|
|
42a7af8750 | ||
|
|
42467ddb57 | ||
|
|
e5d7ac01a2 | ||
|
|
0993509fe3 | ||
|
|
d10452a8ad | ||
|
|
725a99f56f | ||
|
|
40ff6526a3 | ||
|
|
1734797148 | ||
|
|
f3102de8fd | ||
|
|
f6450a98cd | ||
|
|
869a987d4a | ||
|
|
591c9eb10c | ||
|
|
2edefa2e24 | ||
|
|
b9b4fbf1d1 | ||
|
|
dacdb8b0c6 | ||
|
|
219f4246a0 | ||
|
|
54c68fa3c4 | ||
|
|
15b1ec3741 | ||
|
|
41dd303f08 | ||
|
|
ebc0325448 | ||
|
|
3d66b6d216 | ||
|
|
5248f32f83 | ||
|
|
79640281c8 | ||
|
|
d78897e63a | ||
|
|
8d4e817f19 | ||
|
|
1c29b311f3 | ||
|
|
ca181c4a18 | ||
|
|
c6b189cfd9 | ||
|
|
e708df2946 | ||
|
|
2ac8524024 | ||
|
|
9a923016d4 | ||
|
|
5a3249cfe2 | ||
|
|
0ef2eed9fe | ||
|
|
7eb68f7e34 | ||
|
|
0749935746 | ||
|
|
afd145385a | ||
|
|
da5af3a289 | ||
|
|
c164a91b4b | ||
|
|
468343cd2b | ||
|
|
58e8321bcb | ||
|
|
623a542951 | ||
|
|
cee33ba695 | ||
|
|
3b49449efa | ||
|
|
da3bf64615 | ||
|
|
1d990408c3 | ||
|
|
a9a13bf5e6 | ||
|
|
6cb631beca | ||
|
|
dcdbf200ff | ||
|
|
4c2d17a475 | ||
|
|
ffbb94adb0 | ||
|
|
8c5ae81873 | ||
|
|
83e43cb7bd | ||
|
|
d0903dec60 | ||
|
|
20e4ca010e | ||
|
|
1060ac9f18 | ||
|
|
e7711323ac | ||
|
|
9bf507bdbf | ||
|
|
7f152229bd | ||
|
|
76201aa744 | ||
|
|
6b15f275e8 | ||
|
|
275d3df7f1 | ||
|
|
640f931aab | ||
|
|
251a94853a | ||
|
|
4f8f546d44 | ||
|
|
be34c3def6 | ||
|
|
7a8693c6b4 | ||
|
|
44afe950b3 | ||
|
|
06815c9afb | ||
|
|
422a901104 | ||
|
|
aaf7ee406f | ||
|
|
59b8714737 | ||
|
|
baf5522d2b | ||
|
|
aa7277a1ef | ||
|
|
5026a98dec | ||
|
|
cafbbca82f | ||
|
|
e09cc07f69 | ||
|
|
a1b75d93e9 | ||
|
|
47a1044733 | ||
|
|
3f5a26a9e8 | ||
|
|
a0a0cc2369 | ||
|
|
029b678964 | ||
|
|
d3462cca47 | ||
|
|
17bab0cca4 | ||
|
|
3c018f7bbf | ||
|
|
310bb215df | ||
|
|
76e41e2789 | ||
|
|
d434ee4059 | ||
|
|
bb6305b439 | ||
|
|
6a48fb6022 | ||
|
|
c9853961d3 | ||
|
|
b93fc25a3f | ||
|
|
993ec95eb2 | ||
|
|
8695a6a4e0 | ||
|
|
1f087fd6d3 | ||
|
|
036076a3dd | ||
|
|
17d67e067c | ||
|
|
faec39c6ab | ||
|
|
4458fa585c | ||
|
|
163ac7f787 | ||
|
|
3d36af5ef6 | ||
|
|
a59d008a43 | ||
|
|
233f4b088f | ||
|
|
e1de4c3d96 | ||
|
|
daf84f78cd | ||
|
|
bf302701c6 | ||
|
|
dd59c41bb5 | ||
|
|
24ad6e4233 | ||
|
|
7914f3d006 | ||
|
|
050ec1aa61 | ||
|
|
07a812c1f2 | ||
|
|
1c942713aa | ||
|
|
acc5c27d5b | ||
|
|
4cbe475473 | ||
|
|
1b22e1bb4a | ||
|
|
9ad2b1eee6 | ||
|
|
dbffc52570 | ||
|
|
81849a32d2 | ||
|
|
e4c31427e3 | ||
|
|
f26df624c4 | ||
|
|
4f882b550f | ||
|
|
74ad6d0fce | ||
|
|
cfa33e8756 | ||
|
|
d85e407bbc | ||
|
|
475cb3f4fc | ||
|
|
eeddb8fcde | ||
|
|
7e06d60f04 | ||
|
|
92b374a497 | ||
|
|
fa869c52b8 | ||
|
|
7a42984158 | ||
|
|
95b1e47e0c | ||
|
|
62007c21d8 | ||
|
|
6cca6b3a69 | ||
|
|
3046ca17d3 | ||
|
|
2aa14d9b5b | ||
|
|
0b5edf4e35 | ||
|
|
0e6b0dddfe | ||
|
|
2184f6f3c2 | ||
|
|
d35ac458a7 | ||
|
|
567d921d5f | ||
|
|
0b54484b63 | ||
|
|
be940b0084 | ||
|
|
29df4e873c | ||
|
|
9b9e63972c | ||
|
|
168179eb03 | ||
|
|
02b5f397ad | ||
|
|
82eb22634e | ||
|
|
929c30219f | ||
|
|
01d56601ae | ||
|
|
b00bd74a9e | ||
|
|
64641db82e | ||
|
|
74b674516b | ||
|
|
2bc52f4a61 | ||
|
|
3c0efa2d4f | ||
|
|
8f4b20a19d | ||
|
|
6dcdc42c05 | ||
|
|
c34bc33686 | ||
|
|
30a79cefc9 | ||
|
|
29262a644e | ||
|
|
2dfa4e7bd7 | ||
|
|
b34ecf2a21 | ||
|
|
090baa6155 | ||
|
|
3f2834d8c2 | ||
|
|
b3608771ed | ||
|
|
c9cc0f1743 | ||
|
|
a950537f0a | ||
|
|
d4db15d37b | ||
|
|
c2103ed0db | ||
|
|
e524695088 | ||
|
|
584ad97179 | ||
|
|
12883bb4c7 | ||
|
|
ef86cd57dc | ||
|
|
2410582960 | ||
|
|
df4493d553 | ||
|
|
8ba88958be | ||
|
|
4564b26158 | ||
|
|
036a1a1d5f | ||
|
|
0b53e18e23 | ||
|
|
62cdf626a0 | ||
|
|
5dac302938 | ||
|
|
67b5e7cd5e | ||
|
|
5f546f4d63 | ||
|
|
2dd2224e73 | ||
|
|
610f09d2c2 | ||
|
|
90529ff181 | ||
|
|
8d7b6eafdf | ||
|
|
7260f461bb | ||
|
|
86a04d2d34 | ||
|
|
eec373a719 | ||
|
|
215b8801d7 | ||
|
|
cc7d95c8ae | ||
|
|
8bf72da40c | ||
|
|
e2bcd0cd4c | ||
|
|
6f44e1af38 | ||
|
|
262d388b99 | ||
|
|
b7eda606a2 | ||
|
|
e3b8a42ded | ||
|
|
26fa962d24 | ||
|
|
7b860b7398 | ||
|
|
f2664f96e1 | ||
|
|
369f3f7fdb | ||
|
|
d6c3de7730 | ||
|
|
143aff4bd2 | ||
|
|
ee0fe57ced | ||
|
|
929da150bc | ||
|
|
66c6b09821 | ||
|
|
f208f5262c | ||
|
|
35508595fa | ||
|
|
97a3cdfc17 | ||
|
|
033d0e9b35 | ||
|
|
def731e6ec | ||
|
|
4a71a0142a | ||
|
|
9432e789c6 | ||
|
|
75e6927904 | ||
|
|
f4d42dcac4 | ||
|
|
0375cf3f79 | ||
|
|
62b9030d2a | ||
|
|
60d13a2b6e | ||
|
|
3d8ba0b82c | ||
|
|
413db06690 | ||
|
|
70b6a54dbc | ||
|
|
bfccd61863 | ||
|
|
34aeb9601f | ||
|
|
64eef4daff | ||
|
|
cb3755cdd5 | ||
|
|
9571c3049d | ||
|
|
1701b34688 |
No files matched your search
@@ -0,0 +1,15 @@
|
||||
# The pre-push hook is a shell script, and git must never hand it to a POSIX
|
||||
# shell with CRLF line endings: `/bin/sh^M: bad interpreter` is how a gate stops
|
||||
# running on a machine where nothing else looks wrong. This repo is developed on
|
||||
# Windows with core.autocrlf=true, so without this line a fresh Windows clone
|
||||
# gets CRLF in the working tree - and Git-for-Windows' sh is the one that runs it.
|
||||
#
|
||||
# The index has always stored LF, so a Linux clone was never affected. That is
|
||||
# exactly why this was worth pinning rather than leaving to a default that
|
||||
# happens to be right today.
|
||||
.githooks/** text eol=lf
|
||||
|
||||
# The publish ledger is compared byte for byte across an autocrlf checkout and a
|
||||
# Linux one. The gate folds CRLF vs LF deliberately, but there is no reason to
|
||||
# make it do that work.
|
||||
PUBLISHED.json text eol=lf
|
||||
@@ -1,31 +1,55 @@
|
||||
#!/bin/sh
|
||||
# Pre-push hook: blocks push if the test suite isn't fully green.
|
||||
# Pre-push gate. THE POLICY IS NOT IN THIS FILE - it is `invisible_core.hooks`,
|
||||
# and this stub exists only to find an interpreter and hand over stdin.
|
||||
#
|
||||
# Enable once with:
|
||||
# It used to be here, in three repositories, as 743 lines of shell that were 207
|
||||
# identical lines out of 211 between two of them. Nine of the eleven differences
|
||||
# were accidental: the core ran no pytest, the core set a variable three times
|
||||
# that only the other two ever read, the core resolved an interpreter and then
|
||||
# called bare `python` anyway. Every fix landed in whichever copy was open.
|
||||
#
|
||||
# What this repository wants gated is declared in its own pyproject, under
|
||||
# [tool.invisible.hooks]. That is the only per-repo part, and it is data.
|
||||
#
|
||||
# Install once with:
|
||||
# git config core.hooksPath .githooks
|
||||
#
|
||||
# Bypass for a known-broken WIP push (NOT for releases):
|
||||
# git push --no-verify
|
||||
# The --no-verify flag is the only escape hatch. Use it sparingly and never
|
||||
# for branches that feed into a release.
|
||||
# A test in this repo fails in an uninstalled checkout, so nobody has to
|
||||
# remember. Bypass a known-broken WIP push with `git push --no-verify`; that is
|
||||
# the only escape hatch, and never for a branch that feeds a release.
|
||||
|
||||
set -e
|
||||
# No `set -e`: exit codes here have to be READ and explained, not turned into a
|
||||
# silent abort. A gate that dies without a message is the worst shape of all.
|
||||
|
||||
echo "[pre-push] running unit + integration tests before push..."
|
||||
# Run from the repository root regardless of where `git push` was invoked.
|
||||
cd "$(dirname "$0")/.." || exit 1
|
||||
|
||||
# Run from this script's directory so it works regardless of where the user
|
||||
# invoked git push from.
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
# Default pyproject addopts skip slow/e2e. That's the gate we want for every
|
||||
# push — fast feedback. e2e is reserved for explicit release runs.
|
||||
if ! python -m pytest -q --tb=short; then
|
||||
echo ""
|
||||
echo "[pre-push] TESTS FAILED — push aborted."
|
||||
echo "[pre-push] Either fix the failure or use 'git push --no-verify' if"
|
||||
echo "[pre-push] you really know what you're doing (NOT for release branches)."
|
||||
python_bin=""
|
||||
for candidate in "$INVISIBLE_GATE_PYTHON" python3 python py; do
|
||||
[ -n "$candidate" ] || continue
|
||||
if command -v "$candidate" >/dev/null 2>&1; then
|
||||
python_bin="$candidate"
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ -z "$python_bin" ]; then
|
||||
echo "[pre-push] REFUSED - no python on PATH, so no gate can run." >&2
|
||||
echo "[pre-push] Nothing must be pushed past a hook that could not check it." >&2
|
||||
echo "[pre-push] Set INVISIBLE_GATE_PYTHON to an interpreter and push again." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "[pre-push] all tests green — push proceeding."
|
||||
exit 0
|
||||
# `src` first so a checkout gates itself with the policy in the tree being
|
||||
# pushed. os.getcwd() rather than $PWD on purpose: under git-bash on Windows
|
||||
# $PWD is /c/... and Python does not resolve that mount.
|
||||
# exec, so stdin (the refs git is pushing) reaches the policy untouched.
|
||||
exec "$python_bin" -c 'import os, sys
|
||||
sys.path.insert(0, os.path.join(os.getcwd(), "src"))
|
||||
try:
|
||||
from invisible_core.hooks import main
|
||||
except ImportError as exc:
|
||||
sys.exit("[pre-push] REFUSED - cannot import invisible_core.hooks (%s).\n"
|
||||
"[pre-push] The pre-push policy lives in invisible-core. This repo is\n"
|
||||
"[pre-push] either that package (so src/ is not where it should be) or\n"
|
||||
"[pre-push] pins it exactly (so install it). Either way, nothing is\n"
|
||||
"[pre-push] pushed past a hook that could not check it." % exc)
|
||||
sys.exit(main())'
|
||||
@@ -0,0 +1,98 @@
|
||||
name: Launch failure
|
||||
description: Browser or wrapper fails to start (install errors, missing deps, profile load fails, never reaches new_page)
|
||||
title: "[launch] "
|
||||
labels: ["bug", "launch-failure"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Use this when the browser never reaches a usable state.
|
||||
If it starts and the bug appears on a site or clicking something, use the site/action template instead.
|
||||
|
||||
- type: input
|
||||
id: version
|
||||
attributes:
|
||||
label: Version
|
||||
description: Output of `python -m invisible_playwright version`.
|
||||
placeholder: 0.1.7 (binary firefox-7)
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: dropdown
|
||||
id: os
|
||||
attributes:
|
||||
label: OS
|
||||
options:
|
||||
- Windows 10/11 x86_64
|
||||
- Linux x86_64
|
||||
- macOS (unsupported)
|
||||
- Other
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
id: python
|
||||
attributes:
|
||||
label: Python
|
||||
placeholder: 3.11.7
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
id: install_cmd
|
||||
attributes:
|
||||
label: How you installed
|
||||
placeholder: pip install invisible_playwright
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: snippet
|
||||
attributes:
|
||||
label: What you ran
|
||||
description: Stop at the line that errors out. Redact creds.
|
||||
render: python
|
||||
value: |
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
ctx = browser.new_context()
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: traceback
|
||||
attributes:
|
||||
label: Full traceback
|
||||
description: The whole stack trace verbatim. Don't summarize.
|
||||
render: text
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: logs
|
||||
attributes:
|
||||
label: Extra logs
|
||||
description: Output of `DEBUG=pw:browser* python yourscript.py 2>&1`. Optional.
|
||||
render: text
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
id: tried
|
||||
attributes:
|
||||
label: What you already tried
|
||||
description: Reinstall, clear cache, different Python version, different proxy, etc.
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: checkboxes
|
||||
id: confirm
|
||||
attributes:
|
||||
label: Before submitting
|
||||
options:
|
||||
- label: Searched existing issues.
|
||||
required: true
|
||||
- label: On the latest released version.
|
||||
required: true
|
||||
- label: Removed credentials and personal paths from the snippet and logs.
|
||||
required: true
|
||||
@@ -0,0 +1,167 @@
|
||||
name: Site or action bug
|
||||
description: Browser starts fine but a navigation, click, evaluate, or other operation fails or behaves wrong
|
||||
title: "[bug] "
|
||||
labels: ["bug"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
For bugs that happen after the browser is up.
|
||||
If the browser never launches, use the launch failure template.
|
||||
If a fingerprint detector flags the browser, use the stealth detection template.
|
||||
|
||||
- type: input
|
||||
id: version
|
||||
attributes:
|
||||
label: Version
|
||||
description: Output of `python -m invisible_playwright version`.
|
||||
placeholder: 0.1.7 (binary firefox-7)
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: dropdown
|
||||
id: os
|
||||
attributes:
|
||||
label: OS
|
||||
options:
|
||||
- Windows 10/11 x86_64
|
||||
- Linux x86_64
|
||||
- macOS (unsupported)
|
||||
- Other
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
id: python
|
||||
attributes:
|
||||
label: Python
|
||||
placeholder: 3.11.7
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: dropdown
|
||||
id: headless
|
||||
attributes:
|
||||
label: headless=
|
||||
description: Some bugs only repro on Windows headless=True (hidden alt-desktop path).
|
||||
options:
|
||||
- "True"
|
||||
- "False"
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: dropdown
|
||||
id: proxy
|
||||
attributes:
|
||||
label: Proxy
|
||||
description: Sites often vary by IP geo (e.g. GDPR consent shows only on UK/EU).
|
||||
options:
|
||||
- No proxy (host network)
|
||||
- Residential, UK/GB
|
||||
- Residential, US
|
||||
- Residential, other country (specify in notes)
|
||||
- Datacenter (specify provider in notes)
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: dropdown
|
||||
id: profile
|
||||
attributes:
|
||||
label: Profile dir
|
||||
options:
|
||||
- Fresh each run (no profile_dir)
|
||||
- Persistent profile_dir, reusing across runs
|
||||
- Persistent profile_dir, first run creating it
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
id: url
|
||||
attributes:
|
||||
label: URL
|
||||
description: The exact URL passed to `page.goto`. Not "the homepage", the literal string.
|
||||
placeholder: https://example.com/login
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: snippet
|
||||
attributes:
|
||||
label: Runnable reproduction
|
||||
description: Runnable. Stub creds, keep everything else literal.
|
||||
render: python
|
||||
value: |
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright(seed=42, headless=True) as browser:
|
||||
ctx = browser.new_context()
|
||||
page = ctx.new_page()
|
||||
page.goto("https://example.com/")
|
||||
# the exact operation that fails:
|
||||
page.click("button:has-text('Accept all')")
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
id: selector
|
||||
attributes:
|
||||
label: Selector or locator
|
||||
description: The exact string passed to locator/click/frame_locator. Write N/A if not a selector bug.
|
||||
placeholder: page.frame_locator("iframe[id^='sp_message_iframe_']").get_by_text("Accept all")
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: expected
|
||||
attributes:
|
||||
label: Expected
|
||||
description: What should happen when the snippet runs?
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: actual
|
||||
attributes:
|
||||
label: Actual
|
||||
description: What happens instead? Full traceback, error string verbatim, any page.on('crash') firing.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: screenshot
|
||||
attributes:
|
||||
label: Screenshot
|
||||
description: Drag-drop a screenshot if the bug is visual. Optional but useful.
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
id: logs
|
||||
attributes:
|
||||
label: Browser logs
|
||||
description: Output of `DEBUG=pw:browser* python yourscript.py 2>&1 | tail -200`. Redact creds and real IPs.
|
||||
render: text
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
id: notes
|
||||
attributes:
|
||||
label: Notes
|
||||
description: Anything else, hypotheses, related issues, things you've already tried.
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: checkboxes
|
||||
id: confirm
|
||||
attributes:
|
||||
label: Before submitting
|
||||
options:
|
||||
- label: Searched existing issues.
|
||||
required: true
|
||||
- label: On the latest released version.
|
||||
required: true
|
||||
- label: The snippet above runs end-to-end on a clean Python install.
|
||||
required: true
|
||||
- label: Removed credentials, proxy passwords, real IPs, personal file paths.
|
||||
required: true
|
||||
@@ -0,0 +1,137 @@
|
||||
name: Stealth detection
|
||||
description: A fingerprint detector flagged the browser as a bot, VM, VPN, anti-detect, tampered, or otherwise non-human
|
||||
title: "[detect] "
|
||||
labels: ["bug", "stealth"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Use this when something detects the browser (Fingerprint Pro, CreepJS, BotD, reCAPTCHA, sannysoft, etc).
|
||||
Bugs in operations (clicks, navigation) go to the site/action template.
|
||||
Browser failing to start goes to the launch failure template.
|
||||
|
||||
- type: input
|
||||
id: version
|
||||
attributes:
|
||||
label: Version
|
||||
description: Output of `python -m invisible_playwright version`.
|
||||
placeholder: 0.1.7 (binary firefox-7)
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
id: firefox_rev
|
||||
attributes:
|
||||
label: Firefox revision
|
||||
description: The `firefox-N` tag the binary was built from (shown in the version output above).
|
||||
placeholder: firefox-7
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: dropdown
|
||||
id: os
|
||||
attributes:
|
||||
label: OS
|
||||
options:
|
||||
- Windows 10/11 x86_64
|
||||
- Linux x86_64
|
||||
- macOS (unsupported)
|
||||
- Other
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: dropdown
|
||||
id: headless
|
||||
attributes:
|
||||
label: headless=
|
||||
options:
|
||||
- "True"
|
||||
- "False"
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: dropdown
|
||||
id: proxy
|
||||
attributes:
|
||||
label: Proxy
|
||||
description: Datacenter or wrong-country proxies trip most detectors regardless of the browser. Be honest about what you used.
|
||||
options:
|
||||
- No proxy (host network)
|
||||
- Residential, matching target geo
|
||||
- Residential, different geo than target
|
||||
- Datacenter (specify provider in notes)
|
||||
- Mobile / 4G
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
id: detector
|
||||
attributes:
|
||||
label: Detector name and URL
|
||||
description: Exact site / service / product that flagged us.
|
||||
placeholder: Fingerprint Pro - https://demo.fingerprint.com/playground
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: screenshot
|
||||
attributes:
|
||||
label: Screenshot of the detector result
|
||||
description: Screenshot of the detector result.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: snippet
|
||||
attributes:
|
||||
label: Reproduction script
|
||||
description: Runnable. Redact creds.
|
||||
render: python
|
||||
value: |
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright(seed=42, headless=True) as browser:
|
||||
ctx = browser.new_context()
|
||||
page = ctx.new_page()
|
||||
page.goto("https://demo.fingerprint.com/playground")
|
||||
# add any extra steps needed to reach the flagged result
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: expected
|
||||
attributes:
|
||||
label: What you expected
|
||||
description: "e.g. bot=not_detected, vm_ml_score < 0.3"
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: full_report
|
||||
attributes:
|
||||
label: Full detector response
|
||||
description: "FP Pro: JSON from /api/event/v4/. CreepJS: Smart Signals block. Optional."
|
||||
render: json
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
id: notes
|
||||
attributes:
|
||||
label: Notes
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: checkboxes
|
||||
id: confirm
|
||||
attributes:
|
||||
label: Before submitting
|
||||
options:
|
||||
- label: Searched existing issues.
|
||||
required: true
|
||||
- label: On the latest released version.
|
||||
required: true
|
||||
- label: The detector verdict above is from a real run, not a hypothesis.
|
||||
required: true
|
||||
- label: Removed credentials, real IPs, FpJS visitor_id values, personal file paths from the snippet and full report.
|
||||
required: true
|
||||
@@ -1,79 +0,0 @@
|
||||
name: Bug report
|
||||
description: Report a bug in the invisible_playwright Python wrapper
|
||||
title: "[bug] "
|
||||
labels: ["bug"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thanks for taking the time to file a bug report.
|
||||
|
||||
Before continuing, please:
|
||||
- Search [existing issues](https://github.com/feder-cr/invisible_playwright/issues?q=is%3Aissue) to avoid duplicates.
|
||||
- If the bug is in the **patched Firefox itself** (canvas/WebGL/audio/font spoofing, a detector flagging the browser), open it at [feder-cr/firefox-stealth](https://github.com/feder-cr/firefox-stealth/issues) instead.
|
||||
- **Do not** report security vulnerabilities here — follow [SECURITY.md](https://github.com/feder-cr/invisible_playwright/blob/main/SECURITY.md).
|
||||
- type: input
|
||||
id: version
|
||||
attributes:
|
||||
label: invisible_playwright version
|
||||
description: Output of `invisible_playwright version`
|
||||
placeholder: "0.1.0 (binary 150.0.1)"
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
id: os
|
||||
attributes:
|
||||
label: Operating system
|
||||
options:
|
||||
- Windows x86_64
|
||||
- Linux x86_64
|
||||
- Other (please specify in description)
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: python
|
||||
attributes:
|
||||
label: Python version
|
||||
placeholder: "3.11.7"
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: repro
|
||||
attributes:
|
||||
label: Minimal reproduction
|
||||
description: A small, self-contained code snippet that triggers the bug. Strip out anything unrelated.
|
||||
render: python
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: expected
|
||||
attributes:
|
||||
label: Expected behavior
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: actual
|
||||
attributes:
|
||||
label: Actual behavior
|
||||
description: Include the full error message and traceback if any.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: logs
|
||||
attributes:
|
||||
label: Logs / additional context
|
||||
description: Browser console output, environment variables, proxy config (redact credentials), etc.
|
||||
render: text
|
||||
validations:
|
||||
required: false
|
||||
- type: checkboxes
|
||||
id: confirm
|
||||
attributes:
|
||||
label: Confirmations
|
||||
options:
|
||||
- label: I have searched existing issues and this bug has not been reported.
|
||||
required: true
|
||||
- label: I am on the latest release.
|
||||
required: true
|
||||
- label: I have removed any credentials, proxy passwords, or sensitive data from logs.
|
||||
required: true
|
||||
@@ -1,11 +1,5 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Security vulnerability
|
||||
url: https://github.com/feder-cr/invisible_playwright/security/advisories/new
|
||||
about: Report a security issue privately. Do NOT open a public issue.
|
||||
- name: Bug in the patched Firefox itself (canvas / WebGL / fonts / WebRTC / etc.)
|
||||
url: https://github.com/feder-cr/firefox-stealth/issues
|
||||
about: Spoofing/fingerprint bugs belong in the firefox-stealth repo.
|
||||
- name: Question or general discussion
|
||||
url: https://github.com/feder-cr/invisible_playwright/discussions
|
||||
about: For usage questions, ideas, and chat. Bugs and features still go in issues.
|
||||
about: Usage questions, ideas, chat. Bugs and features still go in issues.
|
||||
@@ -1,47 +0,0 @@
|
||||
name: Feature request
|
||||
description: Suggest a new feature or improvement
|
||||
title: "[feature] "
|
||||
labels: ["enhancement"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thanks for the suggestion! Please check that:
|
||||
- Your idea is **in scope** for this repo (the Python wrapper, sampler, CLI, packaging).
|
||||
- Changes to the patched Firefox C++ source belong at [feder-cr/firefox-stealth](https://github.com/feder-cr/firefox-stealth) instead.
|
||||
- You have searched [existing issues](https://github.com/feder-cr/invisible_playwright/issues?q=is%3Aissue) for similar requests.
|
||||
- type: textarea
|
||||
id: problem
|
||||
attributes:
|
||||
label: Problem
|
||||
description: What problem does this solve? What can't you currently do, or what is awkward today?
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: proposal
|
||||
attributes:
|
||||
label: Proposed solution
|
||||
description: How would the feature work? API sketches, CLI examples, or pseudocode welcome.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: alternatives
|
||||
attributes:
|
||||
label: Alternatives considered
|
||||
description: Other approaches you thought about and why they fall short.
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
id: context
|
||||
attributes:
|
||||
label: Additional context
|
||||
description: Links to related issues, prior art in other libraries, screenshots, etc.
|
||||
validations:
|
||||
required: false
|
||||
- type: checkboxes
|
||||
id: contribute
|
||||
attributes:
|
||||
label: Are you willing to contribute?
|
||||
options:
|
||||
- label: I'd be willing to open a PR for this if accepted.
|
||||
required: false
|
||||
@@ -37,4 +37,4 @@ Describe what you ran:
|
||||
- [ ] I added or updated tests covering the change.
|
||||
- [ ] `pytest` passes locally.
|
||||
- [ ] I updated `README.md` / `docs/` if user-visible behavior changed.
|
||||
- [ ] My change is in scope for this repo (Python wrapper / sampler / CLI / packaging — not the patched Firefox C++ source).
|
||||
- [ ] My change is in scope for this repo (Python wrapper / sampler / CLI / packaging - not the patched Firefox C++ source).
|
||||
@@ -0,0 +1,206 @@
|
||||
# ─────────────────────────────────────────────────────────────────────────────
|
||||
# core-on-index.yml - the one question every job in this repo has to answer
|
||||
# before it can install anything: is the invisible-core version we pin actually
|
||||
# on the package index?
|
||||
#
|
||||
# WHY THIS EXISTS.
|
||||
# [project].dependencies now carries a real specifier, `invisible-core==N.M.0`,
|
||||
# instead of a `name @ git+url@ref` direct reference. That was measured to be
|
||||
# the stronger contract: a direct reference has no version to compare, so
|
||||
# `pip check` is structurally blind to a violated one, while a real specifier
|
||||
# makes it exit 1, and a plain `pip install` of this package repairs an
|
||||
# environment somebody broke by hand. The cost is that every `pip install` in
|
||||
# this repo now has to RESOLVE that dependency from the index.
|
||||
#
|
||||
# The publish order is fixed and non-negotiable: invisible-core is uploaded
|
||||
# FIRST, the two consumers after it. So there is a window - from the first push
|
||||
# of this repo to GitHub until the core's first upload - in which every install
|
||||
# step here cannot possibly succeed, for a reason nobody can fix from inside
|
||||
# this repository.
|
||||
#
|
||||
# WHAT WE DO ABOUT IT, AND WHAT WE REFUSE TO DO.
|
||||
# The tempting fix is to make the install tolerant: `|| true`, `--no-deps`, or
|
||||
# a fallback that pulls the core straight from git. All three are worse than a
|
||||
# red run. `|| true` and `--no-deps` produce a GREEN job that installed nothing
|
||||
# and tested nothing, which is a lie that survives long after the window has
|
||||
# closed. The git fallback is worse still: it satisfies the pin by name and
|
||||
# version with content nobody compared, which is the exact failure mode the
|
||||
# `==` specifier was adopted to expose.
|
||||
#
|
||||
# So this workflow asks the index and reports a verdict, and the callers make
|
||||
# their real jobs depend on it. Three outcomes, all of them visible:
|
||||
#
|
||||
# the project is not on the index at all
|
||||
# -> the publish window. This job passes, emits a ::warning:: annotation
|
||||
# on the run page, writes the reason into the run summary, and returns
|
||||
# available=false. Every caller job is then SKIPPED - grey in the
|
||||
# checks list, not green - and the summary says in words that no tests
|
||||
# ran. Nobody can mistake it for a passing build.
|
||||
#
|
||||
# the project is on the index and carries the pinned version
|
||||
# -> available=true. Every caller job runs exactly as it did before this
|
||||
# file existed. Nothing is weakened, ever.
|
||||
#
|
||||
# the project is on the index but NOT at the pinned version
|
||||
# -> this is not the window. The core has been published, so the pin
|
||||
# names a version that was never uploaded. Hard failure, red.
|
||||
#
|
||||
# Anything ambiguous (index unreachable, malformed answer, no `==` pin in
|
||||
# pyproject.toml, two of them) is also a hard failure. A gate that answers
|
||||
# "skip" when it does not know would silently disable this repo's whole CI the
|
||||
# first time PyPI has a bad minute.
|
||||
#
|
||||
# This does NOT stop being useful once the core is published: it is the check
|
||||
# that catches a pin pointing at a version that does not exist, about 20s
|
||||
# before the install step would have failed with a resolver wall of text.
|
||||
# ─────────────────────────────────────────────────────────────────────────────
|
||||
name: core-on-index
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
outputs:
|
||||
available:
|
||||
description: >-
|
||||
"true" when the invisible-core version pinned in pyproject.toml can
|
||||
be resolved from the package index. Any other value means the caller
|
||||
must not attempt an install.
|
||||
value: ${{ jobs.probe.outputs.available }}
|
||||
pin:
|
||||
description: The invisible-core version this repo pins.
|
||||
value: ${{ jobs.probe.outputs.pin }}
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
probe:
|
||||
name: is the pinned invisible-core on the index?
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
outputs:
|
||||
available: ${{ steps.probe.outputs.available }}
|
||||
pin: ${{ steps.probe.outputs.pin }}
|
||||
steps:
|
||||
# SHA-pinned like e2e.yml: this job decides whether the rest of the repo's
|
||||
# CI runs at all, so it is the last place to want a moving tag.
|
||||
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||
with: { fetch-depth: 1 }
|
||||
|
||||
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
|
||||
with: { python-version: '3.11' } # tomllib
|
||||
|
||||
- id: probe
|
||||
shell: bash
|
||||
run: |
|
||||
python - <<'PY'
|
||||
import json, os, re, sys, time, tomllib, urllib.error, urllib.request
|
||||
|
||||
DIST = "invisible-core"
|
||||
PIN_RE = re.compile(
|
||||
r"\s*(?P<name>[A-Za-z0-9][A-Za-z0-9._-]*)\s*"
|
||||
r"(?:\[[^\]]*\])?\s*==\s*(?P<version>[^\s;,]+)")
|
||||
|
||||
def norm(name):
|
||||
"""PEP 503: invisible_core and invisible-core are one name."""
|
||||
return re.sub(r"[-_.]+", "-", name).lower()
|
||||
|
||||
def write(path_var, text):
|
||||
path = os.environ.get(path_var)
|
||||
if path:
|
||||
with open(path, "a", encoding="utf-8") as fh:
|
||||
fh.write(text + "\n")
|
||||
|
||||
def die(msg):
|
||||
print(f"::error title={DIST} pin::{msg}")
|
||||
write("GITHUB_STEP_SUMMARY",
|
||||
f"### CI stopped: the {DIST} pin cannot be verified\n\n{msg}\n")
|
||||
sys.exit(1)
|
||||
|
||||
# ---- what do we pin? -------------------------------------------------
|
||||
try:
|
||||
deps = tomllib.loads(
|
||||
open("pyproject.toml", "rb").read().decode("utf-8")
|
||||
)["project"]["dependencies"]
|
||||
except Exception as e:
|
||||
die(f"pyproject.toml has no readable [project].dependencies: {e!r}")
|
||||
|
||||
pins = []
|
||||
for dep in deps:
|
||||
m = PIN_RE.match(dep) if isinstance(dep, str) else None
|
||||
if m and norm(m.group("name")) == DIST:
|
||||
pins.append(m.group("version"))
|
||||
if len(pins) != 1:
|
||||
die(f"expected exactly one `{DIST}==X.Y.Z` requirement in "
|
||||
f"[project].dependencies, found {pins or 'none'}. Either the pin was "
|
||||
f"loosened, replaced by a direct reference, or duplicated. This gate "
|
||||
f"will not guess which core the build is supposed to wait for. "
|
||||
f"Declared: {deps}")
|
||||
pin = pins[0]
|
||||
print(f"pyproject.toml pins {DIST}=={pin}")
|
||||
write("GITHUB_OUTPUT", f"pin={pin}")
|
||||
|
||||
# ---- is it on the index? --------------------------------------------
|
||||
url = f"https://pypi.org/simple/{DIST}/"
|
||||
req = urllib.request.Request(
|
||||
url, headers={"Accept": "application/vnd.pypi.simple.v1+json"})
|
||||
data = unpublished = None
|
||||
last = ""
|
||||
for attempt in range(1, 4): # retry transient failures, never guess
|
||||
try:
|
||||
with urllib.request.urlopen(req, timeout=30) as r:
|
||||
data = json.load(r)
|
||||
break
|
||||
except urllib.error.HTTPError as e:
|
||||
if e.code == 404:
|
||||
unpublished = True
|
||||
break
|
||||
last = f"HTTP {e.code}"
|
||||
except Exception as e:
|
||||
last = repr(e)
|
||||
print(f"index probe attempt {attempt}/3 failed: {last}")
|
||||
if attempt < 3:
|
||||
time.sleep(5 * attempt)
|
||||
|
||||
if data is None and not unpublished:
|
||||
die(f"could not read {url} after 3 attempts ({last}). That is not a "
|
||||
f"verdict, so this job fails instead of guessing. Re-run it.")
|
||||
|
||||
if unpublished:
|
||||
msg = (f"{DIST} has never been published to the index. This is the "
|
||||
f"expected publish window: the core is uploaded first, this "
|
||||
f"repo's package after it.")
|
||||
print(f"::warning title={DIST} is not on the index yet::{msg} "
|
||||
f"NOTHING WAS INSTALLED AND NO TEST RAN in this workflow run.")
|
||||
write("GITHUB_STEP_SUMMARY",
|
||||
f"### NO TESTS RAN\n\n{msg}\n\n"
|
||||
f"Every job in this workflow was **skipped**, not passed. "
|
||||
f"`pyproject.toml` pins `{DIST}=={pin}`; until that version is on "
|
||||
f"the index no `pip install` in this repository can resolve, so "
|
||||
f"there is nothing to run. Publish `{DIST}=={pin}`, then re-run "
|
||||
f"this workflow - the jobs come back on their own, with no edit "
|
||||
f"to any file here.\n")
|
||||
write("GITHUB_OUTPUT", "available=false")
|
||||
sys.exit(0)
|
||||
|
||||
versions = data.get("versions")
|
||||
if not versions:
|
||||
die(f"{url} answered but listed no versions. The index API changed shape "
|
||||
f"or served something unexpected; refusing to turn that into a skip.")
|
||||
if pin not in versions:
|
||||
shown = sorted(versions)[-10:] # diagnostics only, so a plain sort
|
||||
die(f"pyproject.toml pins {DIST}=={pin}, but the index publishes "
|
||||
f"{len(versions)} version(s) ({', '.join(shown)}) and not {pin}. "
|
||||
f"{DIST} exists, so this is NOT the "
|
||||
f"publish window - the pin names a version that was never uploaded. "
|
||||
f"Fix the pin (workbench: python scripts/sync_core_pin.py) or publish "
|
||||
f"the core first.")
|
||||
|
||||
print(f"{DIST}=={pin} is on the index - the workflow runs normally.")
|
||||
write("GITHUB_OUTPUT", "available=true")
|
||||
PY
|
||||
|
||||
- name: Say so in the run summary
|
||||
if: steps.probe.outputs.available == 'true'
|
||||
run: |
|
||||
echo "invisible-core==${{ steps.probe.outputs.pin }} is on the index; jobs run normally." \
|
||||
>> "$GITHUB_STEP_SUMMARY"
|
||||
@@ -0,0 +1,142 @@
|
||||
# ─────────────────────────────────────────────────────────────────────────────
|
||||
# e2e-hunt.yml - gira la suite e2e in CICLO finche' non cattura un impiccamento.
|
||||
#
|
||||
# Perche' esiste. Il job e2e si impicca nel 12% delle corse (4 su 33 fra il
|
||||
# 2026-08-01 e il 08-13) e uccide il job al tetto dei 40 minuti. Al 12% una corsa
|
||||
# verde non dimostra niente e servono ~18 giri per avere il 90% di probabilita' di
|
||||
# vederne uno: aspettare che succeda da solo su una PR significa aspettare giorni
|
||||
# e bruciare il tempo di qualcun altro ogni volta.
|
||||
#
|
||||
# E perche' QUI e non in locale, per DUE ragioni diverse a seconda dell'input `os`.
|
||||
#
|
||||
# ubuntu-24.04 - l'impiccamento del job viveva li'. CHIUSO il 2026-08-13 con 36
|
||||
# giri (due cacce da 18): zero impiccamenti, zero ritentativi. Resta come
|
||||
# controllo di non-regressione.
|
||||
#
|
||||
# windows-latest - una domanda diversa e ancora aperta: sulla macchina di
|
||||
# sviluppo i test di interazione producono ritentativi (41 su 17 giri) e su
|
||||
# Linux nemmeno uno in 36. Ma quella macchina non era ferma - chi misurava ci
|
||||
# girava sopra, e piu' tardi ci e' tornato il proprietario - quindi il confronto
|
||||
# e' CONFUSO fra piattaforma e contesa. Un runner Windows dedicato separa le due
|
||||
# cose senza chiedere a nessuno di stare fermo sei ore.
|
||||
#
|
||||
# Non parte da solo: solo `workflow_dispatch`. Non e' un cancello, e' uno
|
||||
# strumento di indagine, e non deve entrare fra i contesti richiesti.
|
||||
# ─────────────────────────────────────────────────────────────────────────────
|
||||
name: e2e hunt
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
giri:
|
||||
description: "Quanti giri al massimo (al 12% ne servono ~18 per il 90%)"
|
||||
required: false
|
||||
default: "18"
|
||||
os:
|
||||
description: "Dove cacciare. windows-latest risponde a una domanda DIVERSA: i ritentativi dell'interazione visti sulla macchina di sviluppo sono il prodotto o la contesa?"
|
||||
required: false
|
||||
default: "ubuntu-24.04"
|
||||
type: choice
|
||||
options:
|
||||
- ubuntu-24.04
|
||||
- windows-latest
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
hunt:
|
||||
name: caccia (${{ inputs.os }})
|
||||
runs-on: ${{ inputs.os }}
|
||||
# 18 giri da ~6 minuti piu' l'installazione. Generoso di proposito: il tetto
|
||||
# qui non deve MAI essere la cosa che ferma la caccia, altrimenti torniamo a
|
||||
# un job ucciso che non spiega niente, che e' il difetto di partenza.
|
||||
timeout-minutes: 300
|
||||
# Su Windows GitHub esegue i blocchi `run:` con POWERSHELL, non con bash, e
|
||||
# il primo lancio su windows-latest e' morto in 5 minuti con un ParserError
|
||||
# sulla riga `if [ "$RUNNER_OS" = "Linux" ]`. Il blocco era stato eseguito
|
||||
# prima di spedirlo, come vuole la regola - ma in bash, sulla macchina di chi
|
||||
# scriveva, cioe' con un interprete diverso da quello del bersaglio.
|
||||
# Eseguire il blocco non basta: va eseguito con la SHELL del runner.
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
steps:
|
||||
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||
with: { fetch-depth: 1 }
|
||||
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
|
||||
with: { python-version: '3.11' }
|
||||
- name: Install wrapper + test deps (+ pinned Playwright)
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install ".[dev]"
|
||||
python -m pip install "playwright==$(cat scripts/playwright_pin.txt)"
|
||||
# Solo Linux: su Windows il browser si lancia sul desktop del runner, e
|
||||
# `firefox-launch-matrix.yml` dimostra da mesi che li' parte davvero.
|
||||
- name: System deps (xvfb + Firefox runtime libs)
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y xvfb
|
||||
sudo "$(which python)" -m playwright install-deps firefox
|
||||
- name: Fetch the published firefox binary
|
||||
run: echo "FF=$(python -m invisible_playwright fetch | tail -1)" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Ciclo finche' non cattura
|
||||
env:
|
||||
PYTHONUNBUFFERED: "1"
|
||||
INVPW_TEST_WATCHDOG_FILE: prove/e2e-watchdog.log
|
||||
run: |
|
||||
set -u
|
||||
giri="${{ inputs.giri }}"
|
||||
mkdir -p prove/giri
|
||||
# `prove/` dentro lo spazio di lavoro, non RUNNER_TEMP: su Windows quella
|
||||
# variabile contiene backslash e non attraversa bash in modo affidabile.
|
||||
# xvfb solo dove esiste; su Windows il browser va sul desktop del runner.
|
||||
if [ "$RUNNER_OS" = "Linux" ]; then PRE="xvfb-run -a"; else PRE=""; fi
|
||||
catturato=0
|
||||
for n in $(seq 1 "$giri"); do
|
||||
log="prove/giri/giro_$(printf '%02d' "$n").log"
|
||||
t0=$(date +%s)
|
||||
set +e
|
||||
$PRE python -u scripts/run_e2e.py "$FF" > "$log" 2>&1
|
||||
code=$?
|
||||
set -e
|
||||
dur=$(( $(date +%s) - t0 ))
|
||||
# Un impiccamento adesso NON e' piu' un job ucciso: la scadenza per
|
||||
# test lo trasforma in un fallimento, e il banner lo nomina.
|
||||
if grep -aq "Timeout" "$log" && grep -aq "Stack of" "$log"; then
|
||||
echo "::error::giro $n: IMPICCAMENTO CATTURATO dopo ${dur}s"
|
||||
echo "--- l'ultimo test che ha parlato ---"
|
||||
grep -aE "::.*(PASSED|SKIPPED|FAILED)" "$log" | tail -3
|
||||
echo "--- lo stack ---"
|
||||
sed -n '/Timeout/,$p' "$log" | head -60
|
||||
catturato=1
|
||||
break
|
||||
fi
|
||||
echo "giro $n/$giri: exit=$code, ${dur}s"
|
||||
done
|
||||
if [ "$catturato" = "0" ]; then
|
||||
echo "::warning::$giri giri, nessun impiccamento catturato."
|
||||
echo "Se il tasso qui e' lo stesso del 12%, la probabilita' di questo"
|
||||
echo "esito e' $(python -c "print(round(100*0.88**$giri))")%, quindi non e' una prova"
|
||||
echo "che il difetto non ci sia: e' una misura del tasso con questo campione."
|
||||
fi
|
||||
# Il passo fallisce SOLO se ha catturato: cosi' il rosso significa
|
||||
# "trovato", non "rotto", ed e' il rosso che si va a leggere.
|
||||
exit "$catturato"
|
||||
|
||||
- name: Portare fuori tutte le prove
|
||||
if: always()
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
|
||||
with:
|
||||
name: e2e-hunt-${{ inputs.os }}-${{ github.run_id }}-${{ github.run_attempt }}
|
||||
path: |
|
||||
prove/giri
|
||||
prove/e2e-watchdog.log
|
||||
if-no-files-found: warn
|
||||
retention-days: 14
|
||||
@@ -0,0 +1,136 @@
|
||||
# ─────────────────────────────────────────────────────────────────────────────
|
||||
# e2e.yml - run the FULL browser-driving e2e suite (the 127 @pytest.mark.e2e)
|
||||
# on GitHub, on every push/PR to main.
|
||||
#
|
||||
# Why this can run on CI when the drive-gate had to stay light: the drive-gate
|
||||
# launched Firefox in true HEADLESS mode, which is content-process unstable on
|
||||
# the hosted runners (eval-CSP / context-destroyed). The stealth wrapper instead
|
||||
# launches Firefox HEADED on a real display; under `xvfb-run` (a virtual X
|
||||
# server) that's exactly what we get on a headless CI box - stable, and the same
|
||||
# thing webrtc-e2e.yml already relies on.
|
||||
#
|
||||
# Secret-free, so it's safe in public CI: the binary is the PUBLIC firefox-9
|
||||
# release (no token), and the webrtc e2e fake a local TCP-only SOCKS. The proxy
|
||||
# realness gate (fppro through a real proxy) is NOT here: it needs secrets and stays a
|
||||
# local pre-release gate.
|
||||
# ─────────────────────────────────────────────────────────────────────────────
|
||||
name: e2e
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
- 'docs/**'
|
||||
- 'LICENSE'
|
||||
pull_request:
|
||||
branches: [main]
|
||||
# The same filter as `push` above, which had it and this one did not. A
|
||||
# docs-only PR (#54, deleting the Pages site) therefore spun up the full
|
||||
# browser bench, hung, and burned the whole 40-minute timeout on a change no
|
||||
# test can observe. The filter belongs on BOTH triggers or it is not a filter.
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
- 'docs/**'
|
||||
- 'LICENSE'
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
# One run of this workflow per branch at a time. A newer push cancels the older
|
||||
# in-flight run as a whole, cleanly, instead of leaving its queued jobs to be
|
||||
# cancelled one by one - which left the run marked failed even though nothing
|
||||
# had actually failed. Keyed by workflow + ref so tests and e2e never cancel
|
||||
# each other; only an older run of THIS workflow on the same branch is replaced.
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
# The install below resolves `invisible-core==N.M.0` from the package index,
|
||||
# and the core is published BEFORE this package. This gate answers whether it
|
||||
# is on the index yet; during that window the e2e job is SKIPPED with the
|
||||
# reason in the run summary rather than faked green, and once the core is up
|
||||
# it runs unchanged. See .github/workflows/core-on-index.yml.
|
||||
core-on-index:
|
||||
uses: ./.github/workflows/core-on-index.yml
|
||||
|
||||
e2e:
|
||||
name: e2e (linux, xvfb)
|
||||
needs: core-on-index
|
||||
if: needs.core-on-index.outputs.available == 'true'
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 40
|
||||
steps:
|
||||
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||
with: { fetch-depth: 1 }
|
||||
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
|
||||
with: { python-version: '3.11' }
|
||||
- name: Install wrapper + test deps (+ pinned Playwright)
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install ".[dev]"
|
||||
python -m pip install "playwright==$(cat scripts/playwright_pin.txt)"
|
||||
- name: System deps (xvfb + Firefox runtime libs)
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y xvfb
|
||||
sudo "$(which python)" -m playwright install-deps firefox
|
||||
- name: Fetch the published firefox binary
|
||||
run: echo "FF=$(python -m invisible_playwright fetch | tail -1)" >> "$GITHUB_ENV"
|
||||
- name: Run the full e2e suite under a virtual display
|
||||
# PYTHONUNBUFFERED, and it is not a nicety. Without it Python block-buffers
|
||||
# stdout when it is a pipe, and this step printed NOTHING for 39 minutes
|
||||
# before the 40-minute timeout killed it on 2026-08-04: a run with no
|
||||
# verdict and no way to tell where it went. The variable is inherited by
|
||||
# the pytest subprocess run_e2e.py spawns, which is where the output
|
||||
# actually comes from.
|
||||
env:
|
||||
PYTHONUNBUFFERED: "1"
|
||||
# Il cane da guardia di tests/conftest.py: a 150s dentro UN test scrive
|
||||
# QUI lo stack di ogni thread, e lo ripete. Due stack identici dicono
|
||||
# bloccato, due diversi dicono lento - diagnosi opposte che nessun altro
|
||||
# strumento distingue. Su FILE e non su stderr perche' pytest redirige i
|
||||
# descrittori a livello di sistema: cio' che e' catturato si perde
|
||||
# quando il processo viene ucciso, cioe' nel caso per cui esiste.
|
||||
INVPW_TEST_WATCHDOG_FILE: ${{ runner.temp }}/e2e-watchdog.log
|
||||
run: xvfb-run -a python -u scripts/run_e2e.py "$FF"
|
||||
|
||||
# Gira SOLO se il passo sopra fallisce, e prima del 2026-08-13 non poteva
|
||||
# esistere: l'impiccamento veniva ucciso dal tetto dei 40 minuti, quindi il
|
||||
# job risultava `cancelled` e i passi successivi non partivano affatto. Con
|
||||
# `--timeout 420 --timeout-method thread` il processo muore a 7 minuti e il
|
||||
# passo fallisce NORMALMENTE, quindi da qui le prove escono.
|
||||
# Uno strumento che non si vede e' indistinguibile da uno che non c'e'.
|
||||
# L'annuncio che il cane da guardia stampa all'apertura del file finisce
|
||||
# dentro `pytest_runtest_setup`, che pytest CATTURA: nel log del job non
|
||||
# compare, quindi da qui non si poteva distinguere "armato" da "inerte".
|
||||
# Questo passo glielo chiede al file, che e' l'unica prova che esista.
|
||||
- name: Il cane da guardia era armato?
|
||||
if: always()
|
||||
run: |
|
||||
f="${RUNNER_TEMP}/e2e-watchdog.log"
|
||||
if [ -s "$f" ]; then
|
||||
# `|| true` e non e' cosmetico: `grep -c` che conta ZERO esce 1, e
|
||||
# GitHub lancia i blocchi `run:` con `bash -e`. Senza, questo passo
|
||||
# moriva esattamente sulle corse SANE - quelle con zero stack - cioe'
|
||||
# avrebbe fatto fallire ogni e2e verde. Trovato eseguendo il blocco
|
||||
# estratto dallo YAML nei quattro stati, non rileggendolo.
|
||||
sorvegliati=$(grep -ac '^---' "$f" || true)
|
||||
stack=$(grep -ac 'Timeout' "$f" || true)
|
||||
echo "armato: ${sorvegliati} test sorvegliati, ${stack} stack scritti"
|
||||
else
|
||||
echo "::warning::il file del cane da guardia e' assente o vuoto: lo strumento NON era armato, e un impiccamento non lascerebbe niente"
|
||||
fi
|
||||
|
||||
# `always()` e non `failure()`: il file serve anche quando la corsa e'
|
||||
# verde, perche' e' l'unica prova che lo strumento funzioni.
|
||||
- name: Portare fuori le prove dell'impiccamento
|
||||
if: always()
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
|
||||
with:
|
||||
name: e2e-watchdog-${{ github.run_id }}-${{ github.run_attempt }}
|
||||
path: ${{ runner.temp }}/e2e-watchdog.log
|
||||
if-no-files-found: warn
|
||||
retention-days: 14
|
||||
@@ -0,0 +1,134 @@
|
||||
name: firefox-launch-matrix
|
||||
|
||||
# Cross-Windows-edition smoke for the SEALED binary, on every Windows runner
|
||||
# GitHub offers, from a fresh checkout.
|
||||
#
|
||||
# HISTORY, and what this can no longer do. It was written for issue #22 (a SxS
|
||||
# mismatch on Win11 build 26200) and ran the reporter snippet against firefox-7.
|
||||
# It cannot: a sealed invisible-core serves the sealed tag and refuses every
|
||||
# other one, so `fetch firefox-7` is a SealMismatch by design now.
|
||||
#
|
||||
# It was also SILENTLY WRONG from the seal landing to 2026-07-26: the verify
|
||||
# step rebuilt the cache path by hand as Cache/firefox-7/firefox.exe while the
|
||||
# cache is content-keyed (Cache/<tag>_<version>_<buildid>/), so every cell failed
|
||||
# with NOT FOUND - a failure that looked exactly like the bug under investigation
|
||||
# and was not. Nine red cells read as "reproduced everywhere". The path now comes
|
||||
# from `python -m invisible_playwright path`, the only thing that knows it.
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- '.github/workflows/firefox-launch-matrix.yml'
|
||||
|
||||
# Least privilege: this smoke matrix only checks out the repo and launches
|
||||
# firefox.exe, so it needs nothing but read access to the contents. Without an
|
||||
# explicit block the token would default to the repo's broader permissions.
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
# `pip install .` below resolves `invisible-core==N.M.0` from the package
|
||||
# index, and the core is published BEFORE this package. This gate answers
|
||||
# whether it is there yet; during that window the smoke matrix is SKIPPED
|
||||
# with the reason in the run summary rather than faked green, and once the
|
||||
# core is up it runs unchanged. See .github/workflows/core-on-index.yml.
|
||||
core-on-index:
|
||||
uses: ./.github/workflows/core-on-index.yml
|
||||
|
||||
smoke:
|
||||
name: launch (${{ matrix.os }}, py${{ matrix.python }})
|
||||
needs: core-on-index
|
||||
if: needs.core-on-index.outputs.available == 'true'
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [windows-2022, windows-2025, windows-latest]
|
||||
# This is a "does firefox.exe launch" smoke test across Windows versions;
|
||||
# the Python version does not change the answer, so one is enough. That
|
||||
# takes this all-Windows (2x-cost) matrix from 9 jobs to 3.
|
||||
python: ["3.12"]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python ${{ matrix.python }}
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python }}
|
||||
cache: pip
|
||||
|
||||
- name: Windows edition + build info
|
||||
shell: pwsh
|
||||
run: |
|
||||
$os = Get-CimInstance Win32_OperatingSystem
|
||||
Write-Host "Caption : $($os.Caption)"
|
||||
Write-Host "BuildNumber: $($os.BuildNumber)"
|
||||
Write-Host "OSArch : $($os.OSArchitecture)"
|
||||
Write-Host "Edition : $((Get-CimInstance Win32_OperatingSystem).OperatingSystemSKU)"
|
||||
Write-Host "---"
|
||||
Write-Host "VC++ Redistributables installed:"
|
||||
Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*' `
|
||||
-ErrorAction SilentlyContinue |
|
||||
Where-Object { $_.DisplayName -like '*Visual C++*Redist*' } |
|
||||
Select-Object DisplayName, DisplayVersion |
|
||||
Format-Table -AutoSize
|
||||
|
||||
- name: Install package from this commit
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install .
|
||||
|
||||
- name: Fetch the sealed binary
|
||||
run: python -m invisible_playwright fetch
|
||||
|
||||
- name: Verify firefox.exe can launch standalone
|
||||
shell: pwsh
|
||||
run: |
|
||||
# ASK for the path, never rebuild it. The cache directory is keyed on
|
||||
# tag + base version + BuildID, so any string assembled here is a second
|
||||
# copy of a naming rule that has already moved once - and when it drifts
|
||||
# the step fails with NOT FOUND, which is indistinguishable from the
|
||||
# launch bug this job exists to detect.
|
||||
$ffPath = (python -m invisible_playwright path).Trim()
|
||||
Write-Host "Package reports: $ffPath"
|
||||
if (-not $ffPath -or -not (Test-Path $ffPath)) {
|
||||
Write-Error "firefox.exe NOT FOUND at '$ffPath' (reported by the package)"
|
||||
exit 1
|
||||
}
|
||||
"FF_PATH=$ffPath" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
|
||||
Write-Host "Launching: $ffPath --version"
|
||||
# NOTE: firefox.exe --version on Windows prints the version but may
|
||||
# return non-zero exit code (sub-process fork quirk). Check stdout.
|
||||
$output = & $ffPath --version 2>&1 | Out-String
|
||||
Write-Host "Output: $output"
|
||||
if ($output -notmatch 'Mozilla Firefox \d') {
|
||||
Write-Error "firefox.exe --version did not print a Mozilla Firefox version. Output was: $output"
|
||||
exit 1
|
||||
}
|
||||
Write-Host "OK: firefox.exe runs and prints version."
|
||||
|
||||
- name: Run reporter's exact InvisiblePlaywright snippet
|
||||
run: |
|
||||
python -c "
|
||||
import asyncio
|
||||
from invisible_playwright.async_api import InvisiblePlaywright
|
||||
async def main():
|
||||
async with InvisiblePlaywright(seed=9128) as browser:
|
||||
page = await browser.new_page()
|
||||
await page.goto('about:blank')
|
||||
print('OK: page loaded, url =', page.url)
|
||||
asyncio.run(main())
|
||||
"
|
||||
|
||||
- name: Upload diagnostics on failure
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: launch-failure-${{ matrix.os }}-py${{ matrix.python }}
|
||||
path: |
|
||||
${{ env.FF_PATH }}
|
||||
if-no-files-found: warn
|
||||
retention-days: 7
|
||||
@@ -0,0 +1,68 @@
|
||||
# ─────────────────────────────────────────────────────────────────────────────
|
||||
# publish-wiki.yml - mirror the docs/ site into the GitHub wiki on every release.
|
||||
#
|
||||
# The wiki is a SEPARATE git repo (<repo>.wiki.git) with no Jekyll front matter
|
||||
# and its own _Sidebar.md navigation, so this is a render, not a copy:
|
||||
# scripts/build_wiki.py strips the front matter, rewrites [x](slug.md) internal
|
||||
# links to the wiki's extensionless form, names each page by its slug (index.md
|
||||
# becomes Home.md), and regenerates _Sidebar.md from the parent/nav_order tree.
|
||||
#
|
||||
# It runs on a published release (the docs the release ships are what the wiki
|
||||
# should show) and on manual dispatch. The wiki checkout is wiped and rebuilt
|
||||
# each run so a page deleted from docs/ also disappears from the wiki; nothing
|
||||
# but generated output is ever committed.
|
||||
#
|
||||
# AUTH. Pushing to <repo>.wiki.git needs contents:write. The built-in
|
||||
# GITHUB_TOKEN carries it here; if a run ever gets a 403 pushing the wiki
|
||||
# (some org policies withhold wiki write from GITHUB_TOKEN), set a PAT with
|
||||
# `repo` scope as the secret WIKI_TOKEN and it is used instead. No long-lived
|
||||
# credential is committed either way.
|
||||
name: publish-wiki
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
workflow_dispatch: {}
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
concurrency:
|
||||
group: publish-wiki
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
publish-wiki:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out the repo (docs + the converter)
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
|
||||
- name: Render docs/ into a wiki build directory
|
||||
run: python scripts/build_wiki.py docs wiki_build
|
||||
|
||||
- name: Publish to the wiki
|
||||
env:
|
||||
WIKI_PUSH_TOKEN: ${{ secrets.WIKI_TOKEN != '' && secrets.WIKI_TOKEN || github.token }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
repo="${{ github.repository }}"
|
||||
git clone "https://x-access-token:${WIKI_PUSH_TOKEN}@github.com/${repo}.wiki.git" wiki
|
||||
# wipe old generated pages (keep .git) so deletions propagate
|
||||
find wiki -maxdepth 1 -name '*.md' -delete
|
||||
cp wiki_build/*.md wiki/
|
||||
cd wiki
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git add -A
|
||||
if git diff --cached --quiet; then
|
||||
echo "wiki already up to date"
|
||||
else
|
||||
git commit -m "docs: sync wiki from docs/ (${{ github.ref_name }})"
|
||||
git push origin HEAD:master
|
||||
fi
|
||||
@@ -0,0 +1,215 @@
|
||||
name: publish
|
||||
|
||||
# Publishing invisible-playwright from a tag, with no long-lived credential anywhere.
|
||||
#
|
||||
# WHAT REPLACED WHAT. This package was uploaded by hand, from one machine, with a
|
||||
# long-lived PyPI token sitting on it. Two things follow from that and neither is
|
||||
# hypothetical: the token is a standing credential whose blast radius is the whole
|
||||
# project, and a hand-run twine has no gate in front of it - the ordering rules
|
||||
# live in a person's memory.
|
||||
#
|
||||
# The credential here is the `pypi` GitHub Environment's OIDC trust relationship,
|
||||
# minted per run and valid for minutes. Only the `upload` job names that
|
||||
# environment, and `upload` declares `needs: gate`, so a red gate means the only
|
||||
# job that can authenticate never starts. The ordering is a dependency, not a
|
||||
# convention.
|
||||
#
|
||||
# BEFORE THE FIRST RUN, on PyPI: Manage project -> Publishing -> add a GitHub
|
||||
# publisher with owner `feder-cr`, repository `invisible_playwright`, workflow
|
||||
# `publish.yml`, environment `pypi`. Until that exists the upload fails with
|
||||
# `invalid-publisher`, which is the correct failure: nothing has said this
|
||||
# workflow may speak for this project. Revoke the long-lived token AFTER the
|
||||
# first successful OIDC publish, not before.
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
# Asked of the INDEX, first, because a tag can legitimately name a version that
|
||||
# is already published: a tag backfilled for a hand-published release, a tag
|
||||
# re-pushed, a re-run of this workflow. In all of those there is nothing to do
|
||||
# and nothing wrong, and reaching twine would fail on a filename the index has
|
||||
# already served - a red run for a situation that is fine.
|
||||
already-published:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
present: ${{ steps.probe.outputs.present }}
|
||||
version: ${{ steps.probe.outputs.version }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- id: probe
|
||||
shell: bash
|
||||
run: |
|
||||
VERSION="$(grep -m1 '^version = ' pyproject.toml | cut -d'"' -f2)"
|
||||
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
||||
CODE=$(curl -s -o /dev/null -w '%{http_code}' "https://pypi.org/pypi/invisible-playwright/$VERSION/json")
|
||||
case "$CODE" in
|
||||
200) echo "present=yes" >> "$GITHUB_OUTPUT"
|
||||
echo "::notice::invisible-playwright $VERSION is already on the index. No-op, not a failure." ;;
|
||||
404) echo "present=no" >> "$GITHUB_OUTPUT" ;;
|
||||
*) echo "the index answered $CODE for $VERSION, which is neither present" >&2
|
||||
echo "nor absent. Refusing rather than guessing." >&2
|
||||
exit 1 ;;
|
||||
esac
|
||||
|
||||
gate:
|
||||
needs: already-published
|
||||
if: needs.already-published.outputs.present != 'yes'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
|
||||
- name: the tag names the version being built
|
||||
# A tag pointing at a different version publishes something nobody asked
|
||||
# for, under a name that says otherwise. Skipped on workflow_dispatch,
|
||||
# where there is no tag to compare against.
|
||||
if: github.event_name == 'push'
|
||||
shell: bash
|
||||
run: |
|
||||
TAG="${GITHUB_REF_NAME#v}"
|
||||
HAVE="${{ needs.already-published.outputs.version }}"
|
||||
if [ "$TAG" != "$HAVE" ]; then
|
||||
echo "tag v$TAG does not name the version in pyproject.toml ($HAVE)" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: the pinned invisible-core is ON THE INDEX
|
||||
# THE ordering rule, as a gate instead of a sentence in a runbook. This
|
||||
# package declares `invisible-core==X.Y.Z`, so pip resolves the PUBLISHED
|
||||
# core - and a consumer released against a core that is not there yet is
|
||||
# red on every runner and broken for every user while passing locally,
|
||||
# because the workbench core is an editable install and cannot see this
|
||||
# class of failure at all. Measured 2026-07-28: both consumers moved to a
|
||||
# name a new core had, neither release could resolve it.
|
||||
shell: bash
|
||||
run: |
|
||||
# BOTH spellings. PEP 503 normalises `invisible_core` and
|
||||
# `invisible-core` to the same project, and the dependency here is
|
||||
# written with the UNDERSCORE while every comment about it uses the
|
||||
# hyphen. Written against the prose first, this grep matched nothing
|
||||
# and the step exited 1 on a correct pyproject - caught by running it
|
||||
# by hand before the first release rather than during one.
|
||||
WANT=$(grep -oE 'invisible[-_]core==[0-9]+\.[0-9]+\.[0-9]+' pyproject.toml | head -1 | cut -d= -f3)
|
||||
if [ -z "$WANT" ]; then
|
||||
echo "no exact invisible-core== pin found in pyproject.toml" >&2
|
||||
echo "(looked for invisible-core== and invisible_core==)" >&2
|
||||
exit 1
|
||||
fi
|
||||
CODE=$(curl -s -o /dev/null -w '%{http_code}' "https://pypi.org/pypi/invisible-core/$WANT/json")
|
||||
if [ "$CODE" != "200" ]; then
|
||||
echo "invisible-core $WANT is not on the index (HTTP $CODE)." >&2
|
||||
echo "Publish the core FIRST, then this package. In this order every" >&2
|
||||
echo "install resolves; in the other one none of them do." >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "::notice::invisible-core $WANT is on the index"
|
||||
|
||||
- name: install the package and its dev extras
|
||||
# Its own step, BEFORE the arming below: install_hooks.py imports
|
||||
# invisible_core, and the first version of this file installed inside the
|
||||
# suite step, so the arming ran against a runner that had nothing
|
||||
# installed and died on ModuleNotFoundError. ci.yml has had this order
|
||||
# all along; this workflow had simply never run.
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -e ".[dev]"
|
||||
|
||||
- name: arm the pre-push gates
|
||||
# The suite asserts core.hooksPath is set and a fresh checkout has none.
|
||||
run: python scripts/install_hooks.py
|
||||
|
||||
- name: the suite
|
||||
# A tag push does not trigger the ordinary test workflow, which runs on
|
||||
# branches and pull requests. Without this, tagging is a way to publish
|
||||
# code no job has run.
|
||||
run: python -m pytest -q
|
||||
|
||||
upload:
|
||||
needs: [already-published, gate]
|
||||
if: needs.already-published.outputs.present != 'yes'
|
||||
runs-on: ubuntu-latest
|
||||
environment: pypi # the trust relationship lives HERE, behind the gate
|
||||
permissions:
|
||||
id-token: write # trusted publishing; no token in a secret anywhere
|
||||
contents: write # to commit the ledger entry back
|
||||
pull-requests: write # and to open one when protection declines the push
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
- run: python -m pip install --upgrade pip build
|
||||
- run: python -m build
|
||||
- name: twine check
|
||||
run: |
|
||||
pip install twine
|
||||
twine check dist/*
|
||||
- uses: pypa/gh-action-pypi-publish@release/v1
|
||||
- name: record what was published, and commit it back
|
||||
# The action above holds the OIDC credential and does the upload; the
|
||||
# thing that writes PUBLISHED.json is invisible_core.release. So the
|
||||
# first successful run of this workflow published 0.3.1 and recorded
|
||||
# nothing - re-creating, on its first green run, the exact gap that had
|
||||
# been back-filled by hand an hour earlier for 0.6.0 and 0.3.0.
|
||||
#
|
||||
# Recording the TREE is correct here and only here: this job is checked
|
||||
# out at the tag, so the tree is what was built and uploaded. A backfill
|
||||
# of a version published elsewhere must come from the artifacts the index
|
||||
# serves instead, because the tree has moved on.
|
||||
run: |
|
||||
# `-e .` and not `.[dev]`: this is the job holding the OIDC
|
||||
# credential and `contents: write`, and `record` needs the package
|
||||
# importable plus a build backend, nothing else. The dev extra
|
||||
# pulls pytest, ruff and - in the wrapper - the whole of
|
||||
# Playwright into the one job that can push to main.
|
||||
python -m pip install --quiet -e . build hatchling
|
||||
python -m invisible_core.release record
|
||||
if git diff --quiet -- PUBLISHED.json; then
|
||||
echo "::warning::nothing recorded - the ledger did not change"
|
||||
exit 0
|
||||
fi
|
||||
# The direct push CANNOT succeed while the branch requires status
|
||||
# checks: a required check cannot have passed on a commit that does
|
||||
# not exist yet, and this token has no bypass where a maintainer
|
||||
# push does. Measured 2026-08-05 - every publish run on all three
|
||||
# repos ended in failure with GH006, on releases that had shipped.
|
||||
# So the push is tried, and when declined the entry goes to a branch
|
||||
# and a pull request rather than nowhere. Green when it is
|
||||
# preserved, red only when it is lost.
|
||||
VERSION=$(python -c "import json;print(json.load(open('PUBLISHED.json'))['released'][-1]['version'])")
|
||||
git config user.name "feder-cr"
|
||||
git config user.email "85809106+feder-cr@users.noreply.github.com"
|
||||
git add PUBLISHED.json
|
||||
git commit -m "record $VERSION as published"
|
||||
BRANCH="${{ github.event.repository.default_branch }}"
|
||||
if git push origin "HEAD:$BRANCH"; then
|
||||
echo "::notice::ledger entry for $VERSION committed to $BRANCH"
|
||||
exit 0
|
||||
fi
|
||||
echo "the direct push was declined; falling back to a pull request"
|
||||
LEDGER_BRANCH="ledger/$VERSION"
|
||||
git push -f origin "HEAD:$LEDGER_BRANCH"
|
||||
CODE=$(curl -s -o /tmp/pr.json -w '%{http_code}' -X POST \
|
||||
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
"https://api.github.com/repos/${{ github.repository }}/pulls" \
|
||||
-d "{\"title\":\"record $VERSION as published\",\"head\":\"$LEDGER_BRANCH\",\"base\":\"$BRANCH\",\"body\":\"The upload succeeded and the ledger could not be pushed to $BRANCH directly: branch protection declines this token, which has no bypass. Merging this keeps the next release from being refused over a missing entry.\"}")
|
||||
if [ "$CODE" = "201" ] || [ "$CODE" = "422" ]; then
|
||||
echo "::error::the ledger for $VERSION is NOT on $BRANCH. Branch $LEDGER_BRANCH carries it and a pull request is open (HTTP $CODE; 422 means one already exists). Merge it before the next release."
|
||||
exit 0
|
||||
fi
|
||||
echo "::error::the ledger entry for $VERSION could not be pushed OR turned into a pull request (HTTP $CODE). It exists only in this run. Back-fill it by hand from the artifacts the index serves."
|
||||
exit 1
|
||||
@@ -7,15 +7,53 @@ on:
|
||||
branches: [main]
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
# One run of this workflow per branch at a time. A newer push cancels the older
|
||||
# in-flight run as a whole, cleanly, instead of leaving its queued jobs to be
|
||||
# cancelled one by one - which left the run marked failed even though nothing
|
||||
# had actually failed. Keyed by workflow + ref so tests and e2e never cancel
|
||||
# each other; only an older run of THIS workflow on the same branch is replaced.
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
# `pip install -e ".[dev]"` below resolves `invisible-core==N.M.0` from the
|
||||
# package index. The core is published BEFORE this package, so between the
|
||||
# first push of this repo and that upload there is a window in which no
|
||||
# install here can succeed. This gate answers "is it on the index?" and the
|
||||
# unit job depends on the answer: during the window that job is SKIPPED (grey
|
||||
# in the checks list, with the reason written into the run summary), never
|
||||
# faked green; once the core is published it runs exactly as before. Full
|
||||
# reasoning, including why `|| true`, `--no-deps` and a git fallback were all
|
||||
# rejected, is in .github/workflows/core-on-index.yml.
|
||||
core-on-index:
|
||||
uses: ./.github/workflows/core-on-index.yml
|
||||
|
||||
unit:
|
||||
name: pytest (${{ matrix.os }}, py${{ matrix.python }})
|
||||
needs: core-on-index
|
||||
if: needs.core-on-index.outputs.available == 'true'
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest]
|
||||
python: ["3.11", "3.12"]
|
||||
# Every version `requires-python = ">=3.11"` promises. Two of them were
|
||||
# untested until 2026-08-01, and the user who opened issue #51 was on
|
||||
# 3.14. test_marker_vocabulary.py compares this list to the floor.
|
||||
python: ["3.11", "3.12", "3.13", "3.14"]
|
||||
# Windows runners are the scarce, 2x-cost, slow-to-schedule ones, and a
|
||||
# burst of pushes queues them for a long time. Run the FULL Python range
|
||||
# on ubuntu (cheap, fast) and cover Windows on 3.12 only - this is a
|
||||
# pure-Python package, the OS-specific surface is tiny. The python LIST
|
||||
# above stays complete so test_marker_vocabulary still sees every version.
|
||||
exclude:
|
||||
- { os: windows-latest, python: "3.11" }
|
||||
- { os: windows-latest, python: "3.13" }
|
||||
- { os: windows-latest, python: "3.14" }
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@@ -31,5 +69,98 @@ jobs:
|
||||
python -m pip install --upgrade pip
|
||||
pip install -e ".[dev]"
|
||||
|
||||
- name: arm the pre-push gates
|
||||
# A fresh clone has no core.hooksPath, and the suite says so - the
|
||||
# reminder moved into `invisible_core.testing` on 2026-07-28 and all
|
||||
# three repos make the assertion now, but only the core's CI had this
|
||||
# step, so both consumers went red on it. Do here what a developer does
|
||||
# once. It also means install_hooks.py is exercised on every runner
|
||||
# instead of only on the one machine that ever ran it by hand.
|
||||
run: python scripts/install_hooks.py
|
||||
|
||||
- name: undefined names and duplicate definitions
|
||||
# F821 (undefined name) and F811 (redefinition) only. Not a style pass:
|
||||
# these two are the rules that catch a name that cannot resolve, which
|
||||
# `from __future__ import annotations` hides in an annotation and which
|
||||
# a suite only finds if it happens to execute that line. Both bit on
|
||||
# 2026-07-28 - a `throwaway_venv` used and imported nowhere took a
|
||||
# user-install job red at RUNTIME, and six annotations named a type that
|
||||
# was defined in no module at all.
|
||||
#
|
||||
# Zero violations in all three repos when this was added, so it is a
|
||||
# gate rather than a cleanup backlog. Keep it that way.
|
||||
run: |
|
||||
python -m ruff check --select F821,F811,F601 --no-cache --output-format concise .
|
||||
|
||||
- name: Run pytest
|
||||
run: pytest tests/ -v --tb=short
|
||||
shell: bash
|
||||
run: |
|
||||
set -o pipefail # or tee would swallow pytest's exit code
|
||||
pytest tests/ -v --tb=short -rs | tee tests-report.txt
|
||||
|
||||
# This repo has the largest suite of the three and was the only one with
|
||||
# no floor. pytest's exit code cannot distinguish "everything passed"
|
||||
# from "the marker expression deselected everything", and `addopts`
|
||||
# already filters on two markers - one more, or a typo in one, silently
|
||||
# turns 726 tests into 0 and reports success.
|
||||
- name: Refuse a run in which the suite deselected itself
|
||||
shell: bash
|
||||
run: |
|
||||
python - <<'PY'
|
||||
import pathlib, re, sys
|
||||
text = pathlib.Path("tests-report.txt").read_text(encoding="utf-8", errors="ignore")
|
||||
m = re.search(r"(\d+) passed", text)
|
||||
passed = int(m.group(1)) if m else 0
|
||||
# FLOOR, not a target. It exists because a mis-wired selection runs
|
||||
# almost nothing and still exits 0 - the exit code cannot see it.
|
||||
#
|
||||
# Was 600 until 2026-07-27, when 322 tests MOVED to invisible_core:
|
||||
# they covered core modules and reached them through this package's
|
||||
# four-line back-compat shims, so six real breaks in core code were
|
||||
# surviving the core's own suite. Nothing shrank; the tests are in the
|
||||
# package they test. This suite runs ~420 now.
|
||||
#
|
||||
# Keep it a little under the real count. It is a tripwire for "the
|
||||
# selection collapsed", not an assertion about how many tests exist.
|
||||
if passed < 380:
|
||||
print(f"only {passed} test(s) ran (expected 380+) - the selection "
|
||||
f"dropped most of the suite and the exit code cannot see it",
|
||||
file=sys.stderr)
|
||||
sys.exit(1)
|
||||
print(f"{passed} tests ran")
|
||||
PY
|
||||
|
||||
# UN SOLO CONTESTO PER LA BRANCH PROTECTION. Misurato 2026-08-13: la
|
||||
# protezione di questo repo richiedeva `pytest (windows-latest, py3.11)`,
|
||||
# che la matrice ESCLUDE esplicitamente qualche riga piu' su - un contesto
|
||||
# che nessun job puo' produrre, quindi una protezione che non poteva mai
|
||||
# essere soddisfatta. Con `enforce_admins` a false ogni push passava lo
|
||||
# stesso e nessuno se ne accorgeva. Stessa forma nel core e nel manager.
|
||||
#
|
||||
# Un elenco di nomi di matrice va alla deriva ogni volta che la matrice
|
||||
# cambia, ed e' esattamente cosi' che ci si e' arrivati. Questo job dipende
|
||||
# dalla matrice intera e il suo nome non cambia mai.
|
||||
#
|
||||
# SKIPPED NON E' FAILED, ed e' la parte specifica di questo repo. `unit` e'
|
||||
# saltato di proposito quando `core-on-index` dice che il pin non e' ancora
|
||||
# sull'indice: durante quella finestra nessun install puo' riuscire, e il
|
||||
# workflow ha scelto di SALTARE invece di fingere verde. Un gate che
|
||||
# pretendesse `success` trasformerebbe quella scelta in un rosso e
|
||||
# spingerebbe a togliere la protezione proprio nel giorno del rilascio.
|
||||
# Quindi si rifiuta su `failure` e `cancelled`, non su `skipped`.
|
||||
gate:
|
||||
needs: [core-on-index, unit]
|
||||
if: always()
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: refuse unless nothing failed
|
||||
run: |
|
||||
echo "core-on-index: ${{ needs.core-on-index.result }}"
|
||||
echo "unit: ${{ needs.unit.result }}"
|
||||
case "${{ needs.unit.result }}" in
|
||||
failure|cancelled) echo "the suite did not pass"; exit 1 ;;
|
||||
esac
|
||||
case "${{ needs.core-on-index.result }}" in
|
||||
failure|cancelled) echo "the index check did not run"; exit 1 ;;
|
||||
esac
|
||||
echo "ok"
|
||||
@@ -0,0 +1,183 @@
|
||||
# ─────────────────────────────────────────────────────────────────────────────
|
||||
# user-install.yml - can a person who has never seen this repo install it and
|
||||
# drive a browser, on the two operating systems we claim to support?
|
||||
#
|
||||
# WHY THIS EXISTS, SEPARATELY FROM e2e.yml.
|
||||
# e2e.yml installs the wrapper FROM THE CHECKOUT and then pins Playwright by
|
||||
# hand. That is the right shape for testing a change: it exercises the code in
|
||||
# the PR. It is the wrong shape for answering "does the published thing work",
|
||||
# and the difference is not academic:
|
||||
#
|
||||
# * a checkout install never resolves `invisible-core==X.Y.Z` from the index,
|
||||
# so the entire pin mechanism - the part most likely to break a release,
|
||||
# and the reason a binary bump is now a three-package release - is outside
|
||||
# what that job can see;
|
||||
# * installing a blessed `playwright==<pin>` afterwards REPAIRS the venv. If
|
||||
# the declared range resolves to a client the shipped Juggler cannot speak,
|
||||
# that manual line turns the job green while every fresh install is broken.
|
||||
# What a user gets is what pip resolves from the declaration, and that is
|
||||
# what has to be under test.
|
||||
#
|
||||
# So this workflow installs nothing from the checkout except the test files. It
|
||||
# takes `pip install invisible-playwright` from the index, in an empty venv, and
|
||||
# runs it the way somebody's first script would.
|
||||
#
|
||||
# WHY IT MUST NOT BE MADE TOLERANT.
|
||||
# There is a real window in which this cannot pass: between publishing the core
|
||||
# and publishing the consumers. The tempting fixes - `|| true`, `--no-deps`, a
|
||||
# git fallback - all produce a GREEN job that installed nothing, and that lie
|
||||
# outlives the window by months. A red run during a publish is correct and
|
||||
# readable. See core-on-index.yml, which makes the same argument at length.
|
||||
#
|
||||
# WHY BOTH OPERATING SYSTEMS.
|
||||
# Windows is the primary target, and the two most recent defects were
|
||||
# Windows-only by construction: firefox.exe is a launcher stub that spawns the
|
||||
# real browser and exits, so a killed runner used to leave the tree behind, and
|
||||
# the job-object fix for it has no counterpart on Linux. A Linux-only matrix
|
||||
# would have seen neither.
|
||||
# ─────────────────────────────────────────────────────────────────────────────
|
||||
name: user-install
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
source:
|
||||
description: "index (what users get) or git (an unpublished commit)"
|
||||
required: false
|
||||
default: index
|
||||
type: choice
|
||||
options: [index, git]
|
||||
schedule:
|
||||
# Weekly (Monday). The published artifacts do not change on their own, but
|
||||
# everything around them does: pip resolves a new Playwright, GitHub moves a
|
||||
# release asset, an index mirror lags. Those break users without any commit
|
||||
# here, so a run triggered only by pushes would never see them. Weekly is
|
||||
# enough to catch that drift without adding a Windows job to the queue daily.
|
||||
- cron: "17 6 * * 1"
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: user-install-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
install:
|
||||
name: ${{ matrix.os }} - install from ${{ github.event.inputs.source || 'index' }} and launch
|
||||
runs-on: ${{ matrix.os }}
|
||||
timeout-minutes: 45
|
||||
strategy:
|
||||
fail-fast: false # one OS failing must not hide the other's result
|
||||
matrix:
|
||||
os: [ubuntu-24.04, windows-latest]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
with: { python-version: '3.11' }
|
||||
|
||||
# Only what the TEST needs. The package under test is installed by the
|
||||
# test itself, into a venv it creates, from the index - installing it
|
||||
# here as well would put a second copy on the path and the assertions
|
||||
# would be reading the wrong one.
|
||||
- name: Test harness only
|
||||
run: python -m pip install --upgrade pip pytest packaging
|
||||
|
||||
# PyPI does not serve a new version to pip the instant twine finishes, and
|
||||
# this workflow runs on `release:` - which fires seconds after the upload.
|
||||
# MEASURED 2026-07-28: invisible-firefox 0.2.6 was uploaded, the release was
|
||||
# created about forty seconds later, and the pip install below still resolved
|
||||
# 0.2.5. The job reported a forgotten publish that had happened two minutes
|
||||
# earlier, which is the most expensive kind of red: it looks exactly like the
|
||||
# real defect this workflow exists to catch.
|
||||
#
|
||||
# Bounded at five minutes, so a genuinely forgotten publish still fails. The
|
||||
# PER-VERSION endpoint is the authority; the aggregate `info.version` lags it
|
||||
# by minutes and has its own trap, so this asks for the exact URL.
|
||||
#
|
||||
# Only on `release:`. A scheduled or dispatched run is not racing anything,
|
||||
# and a wait there would hide a real absence behind five minutes of polling.
|
||||
- name: wait for the index to serve this version
|
||||
if: github.event_name == 'release'
|
||||
shell: bash
|
||||
run: |
|
||||
python - <<'PY'
|
||||
import json, os, sys, time, tomllib, urllib.error, urllib.request
|
||||
dist = tomllib.load(open("pyproject.toml", "rb"))["project"]["name"]
|
||||
version = tomllib.load(open("pyproject.toml", "rb"))["project"]["version"]
|
||||
url = f"https://pypi.org/pypi/{dist}/{version}/json"
|
||||
deadline = time.monotonic() + 300
|
||||
n = 0
|
||||
while True:
|
||||
n += 1
|
||||
try:
|
||||
with urllib.request.urlopen(url, timeout=30) as r:
|
||||
if json.load(r).get("urls"):
|
||||
print(f"::notice::{dist} {version} is on the index (attempt {n})")
|
||||
sys.exit(0)
|
||||
except urllib.error.HTTPError as e:
|
||||
if e.code != 404:
|
||||
print(f"::warning::index returned HTTP {e.code}; not waiting further")
|
||||
sys.exit(0)
|
||||
except OSError as e:
|
||||
print(f"index unreachable ({e}); retrying")
|
||||
if time.monotonic() >= deadline:
|
||||
print(f"::warning::{dist} {version} still not on the index after 300s; "
|
||||
f"running the checks anyway so a real absence is reported")
|
||||
sys.exit(0)
|
||||
time.sleep(10)
|
||||
PY
|
||||
|
||||
- name: Linux runtime libraries for the browser
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y xvfb libgtk-3-0 libdbus-glib-1-2 libasound2t64
|
||||
|
||||
- name: The user path, end to end
|
||||
env:
|
||||
# The release walk asks the GitHub API once per published version.
|
||||
# Unauthenticated that is 60 calls an hour PER RUNNER IP, and the
|
||||
# walk hit 403 on its eleventh call when measured by hand. A
|
||||
# rate-limited walk SKIPS, and a skip is not a check.
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
INVPW_E2E_SOURCE: ${{ github.event.inputs.source || 'index' }}
|
||||
shell: bash
|
||||
run: |
|
||||
set -o pipefail # or the tee below would swallow pytest's exit code
|
||||
if [ "${{ runner.os }}" = "Linux" ]; then
|
||||
xvfb-run -a python -m pytest tests/test_release_e2e.py tests/test_upgrade_e2e.py -m e2e \
|
||||
-o addopts="" -v -rs | tee e2e-report.txt
|
||||
else
|
||||
python -m pytest tests/test_release_e2e.py tests/test_upgrade_e2e.py -m e2e \
|
||||
-o addopts="" -v -rs | tee e2e-report.txt
|
||||
fi
|
||||
|
||||
# A run whose tests all SKIPPED is not a pass, and it is the failure this
|
||||
# suite is most exposed to: every test here is gated on `-m e2e` and
|
||||
# several on a platform. `-rs` above prints the skips; this turns "nothing
|
||||
# ran" into a refusal rather than a green tick.
|
||||
- name: Refuse a run in which nothing actually ran
|
||||
shell: bash
|
||||
run: |
|
||||
python - <<'PY'
|
||||
import pathlib, re, sys
|
||||
# pytest's own exit code cannot distinguish "all passed" from "all
|
||||
# skipped", so the count is read back from the report it wrote.
|
||||
report = pathlib.Path("e2e-report.txt")
|
||||
if not report.is_file():
|
||||
print("no report written; the step above did not run", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
text = report.read_text(encoding="utf-8", errors="ignore")
|
||||
m = re.search(r"(\d+) passed", text)
|
||||
passed = int(m.group(1)) if m else 0
|
||||
if passed < 6:
|
||||
print(f"only {passed} test(s) actually ran (expected at least 6) - a suite that skipped "
|
||||
f"itself is not a pass", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
print(f"{passed} tests ran")
|
||||
PY
|
||||
@@ -0,0 +1,102 @@
|
||||
name: webrtc-e2e
|
||||
|
||||
# Live WebRTC realness check against the shipped patched binary.
|
||||
#
|
||||
# Manual (workflow_dispatch) on purpose: it needs a firefox-N binary that
|
||||
# carries the WebRTC fixes (synthetic srflx in genuine nICEr form + the
|
||||
# default-route fallback behind a proxy). Run it after publishing such a
|
||||
# binary - it is the release gate for "WebRTC looks real behind a proxy".
|
||||
# Until that binary ships, test_not_blocked_behind_tcp_only_socks is EXPECTED
|
||||
# to fail (the old binary is fully blocked behind a SOCKS proxy), which is the
|
||||
# whole point of the gate.
|
||||
#
|
||||
# No external proxy provider, no credentials: the "behind a proxy" condition is faked by an
|
||||
# in-process TCP-only SOCKS5 server (refuses UDP ASSOCIATE) and the egress IP
|
||||
# is injected as an RFC 5737 TEST-NET address. Fully self-contained.
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
# `pip install -e ".[dev]"` below resolves `invisible-core==N.M.0` from the
|
||||
# package index, and the core is published BEFORE this package. This gate
|
||||
# answers whether it is there yet; during that window the realness job is
|
||||
# SKIPPED with the reason in the run summary rather than faked green, and
|
||||
# once the core is up it runs unchanged. See
|
||||
# .github/workflows/core-on-index.yml.
|
||||
core-on-index:
|
||||
uses: ./.github/workflows/core-on-index.yml
|
||||
|
||||
webrtc-e2e:
|
||||
name: webrtc realness (ubuntu, py3.12)
|
||||
needs: core-on-index
|
||||
if: needs.core-on-index.outputs.available == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python 3.12
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
cache: pip
|
||||
|
||||
- name: Install package + dev extras
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -e ".[dev]"
|
||||
|
||||
- name: Fetch the patched Firefox binary
|
||||
run: python -m invisible_playwright fetch
|
||||
|
||||
- name: Resolve binary path
|
||||
shell: bash
|
||||
run: |
|
||||
# NOT `echo "VAR=$(cmd)" >> $GITHUB_ENV`. echo exits 0 whatever the
|
||||
# substitution did, so `set -e` never sees a failure and an EMPTY
|
||||
# value lands in the environment. Both tests below then hit
|
||||
# `pytest.skip("no patched binary")`, pytest exits 0, and the job is
|
||||
# green having verified nothing - which is exactly what run #1 did.
|
||||
set -euo pipefail
|
||||
BIN="$(python -m invisible_playwright path)"
|
||||
if [ -z "$BIN" ] || [ ! -e "$BIN" ]; then
|
||||
echo "invisible_playwright path returned '$BIN', which is not a" >&2
|
||||
echo "file. Refusing to run a suite that would skip itself green." >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "STEALTHFOX_E2E_BINARY=$BIN" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Run WebRTC realness e2e (xvfb for the headless Firefox)
|
||||
run: |
|
||||
set -o pipefail
|
||||
sudo apt-get update && sudo apt-get install -y xvfb
|
||||
xvfb-run -a pytest tests/test_webrtc_realness.py -m e2e -o addopts="" -v -rs | tee webrtc-report.txt
|
||||
|
||||
# Run #1 was GREEN with the headline assertion skipped: "1 passed, 1
|
||||
# skipped", and the skipped one is the test this workflow's own header
|
||||
# calls the point of the gate. pytest's exit code cannot tell that from a
|
||||
# pass, and this file was the only one of four without a floor.
|
||||
- name: Refuse a run whose main assertion did not execute
|
||||
shell: bash
|
||||
run: |
|
||||
python - <<'PY'
|
||||
import pathlib, re, sys
|
||||
text = pathlib.Path("webrtc-report.txt").read_text(encoding="utf-8", errors="ignore")
|
||||
passed = int((re.search(r"(\d+) passed", text) or [0, 0])[1] or 0)
|
||||
skipped = int((re.search(r"(\d+) skipped", text) or [0, 0])[1] or 0)
|
||||
if skipped:
|
||||
print("these tests SKIPPED, so the gate verified less than it "
|
||||
"claims:", file=sys.stderr)
|
||||
for line in text.splitlines():
|
||||
if line.startswith("SKIPPED"):
|
||||
print(" " + line, file=sys.stderr)
|
||||
if passed < 2 or skipped:
|
||||
print(f"{passed} passed / {skipped} skipped - this gate exists for "
|
||||
f"the synthetic-srflx assertion; a run that skips it is not "
|
||||
f"a pass.", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
print(f"{passed} tests ran, none skipped")
|
||||
PY
|
||||
@@ -6,3 +6,11 @@ build/
|
||||
.pytest_cache/
|
||||
.venv/
|
||||
firefox-source/
|
||||
|
||||
# Third-party source trees kept on disk for on-demand compatibility audits.
|
||||
# They are somebody else's code, with their own licence and their own .git, and
|
||||
# they must never be committed into this repository: `git add -A` would either
|
||||
# stage 3.9 MB of Apache-2.0 sources into an MIT repo or, worse, record a bare
|
||||
# gitlink that nobody can clone. The sdist/wheel excludes only protect the
|
||||
# published artifacts, not the repo, so the ignore has to live here too.
|
||||
tests/playwright-upstream/
|
||||
@@ -4,7 +4,271 @@ All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [Unreleased]
|
||||
## [0.7.0] - 2026-08-11
|
||||
|
||||
### Changed
|
||||
|
||||
- Pins `invisible-core` 19.14.0, which seals firefox-19. The engine release
|
||||
carries a `seal.json` asset for the first time, so the seal a client verifies
|
||||
and the seal the build produced are the same bytes rather than two things
|
||||
that agree.
|
||||
- `session_kwargs` in the test bench no longer pins the proxy exit. It used a
|
||||
literal session id, and the providers are sticky on it, so every realness
|
||||
measurement this project made left through the same address: one distinct IP
|
||||
in twenty-four hours, eleven events on it in one hour, and the detector had
|
||||
classified it as a datacenter. The same binary on fresh exits scores 0, 3 and
|
||||
0 where it scored 14. Consistency runs still pin one exit for their pair,
|
||||
because that comparison is about our own determinism and a rotating exit puts
|
||||
the network inside it.
|
||||
|
||||
### Fixed
|
||||
|
||||
- `scripts/ci_font_gate.py` asked a question whose answer could not mean
|
||||
anything. It launched the engine raw, which since the generic-family map
|
||||
became a declaration means launching it without one - and the engine does not
|
||||
invent declarations. And it inferred "did this face load" from a line height
|
||||
that we declare: it worked while the fallback measured 91 and the families 95,
|
||||
and stopped the day the metrics became declared and the fallback landed on 95.
|
||||
It now hands in the one declaration it needs and asserts which families SHARE
|
||||
a face, measured from the ink box. Green on this build, on the previous
|
||||
release, and on both platforms.
|
||||
|
||||
### Added
|
||||
|
||||
- Two e2e tests for failures the suite could not see: a session that dies under
|
||||
heavy text shaping, and a frame reporting its parent's screen origin instead
|
||||
of its own. Both validated by reintroducing the real defect in the engine and
|
||||
rebuilding, not by reasoning about them.
|
||||
|
||||
## [0.6.1] - 2026-08-05
|
||||
|
||||
### Changed
|
||||
|
||||
- Pins `invisible-core` 18.13.0, which puts an upper bound in wall-clock time on the engine download. A `requests` timeout is per socket operation, so a connection delivering a byte every 59 seconds satisfied it forever and the transfer had no total limit; `INVISIBLE_DOWNLOAD_DEADLINE` (default 1800s) bounds it, and the refusal names the deadline, the elapsed time and the bytes received. Set it to 0 on a genuinely slow link.
|
||||
- README: the Telegram invitation moved to the top and the status badges to the bottom.
|
||||
|
||||
## [0.6.0] - 2026-08-01
|
||||
|
||||
### Fixed
|
||||
- `browser.new_page()` now gives the page the same context `browser.new_context()` does: the profile's viewport, screen, DPR, colour scheme, locale and timezone. It did not, because Playwright's `Browser.new_page` forwards to the IMPLEMENTATION object, whose own `new_page` calls `new_context` on itself, so a wrapper installed on the api object was never consulted. Measured in a real browser with the seed the e2e uses: `new_page` gave `innerWidth` 1280, Playwright's stock viewport, against a fingerprint reporting `screenWidth` 1920, while `new_context` gave 1906; a dark-pinned profile came back light on the same path. `new_page` is the call in this package's README, in the class docstring and in every example it ships, which is why this is a minor bump and not a patch.
|
||||
- The engine-mismatch message told you to run `fetch --force`, three days after that flag was removed with four of the six subcommands. A test pinned the old string, so both were wrong together.
|
||||
- Four tests marked `unit` drove `__enter__` with Playwright mocked and made two real network calls each, then sat out the lifetime guard's full 10s deadline waiting for a browser tree a mock never produces. 45.6s to 0.34s for that file. CI-only.
|
||||
|
||||
### Changed
|
||||
- Requires `invisible-core==18.12.0`, which carries one prefs composition for all three entry points (`compose_session_prefs`), a `proxy=` argument on `get_default_stealth_prefs` that had no way to reach `configure_proxy` before, a proxy endpoint with no port refused rather than dropped silently, and a process scan that no longer asks psutil for the parent of every process on the machine.
|
||||
- `build_prefs` delegates to that composition, so the three entry points that used to stack layers on top of `translate_profile_to_prefs` in their own order now agree, with the difference asserted as an exact set. What stays here is this path's delivery and its two decisions: the cloak, which only Windows and macOS need, and which generator draws the pointer path. `max_seconds_for` is applied here rather than passing `humanize` through, because `humanize=0` with the binary engine selected is a cap of nothing, not a request to disable motion, and passing it straight to the core would make it falsy and switch the generator off.
|
||||
- Eight imports in `launcher.py` and `async_api.py` were unused and are gone. The ninth, `IANA_TO_POSIX_TZ` in `_session.py`, is not dead: the import IS the probe that turns an old core into a message about a version instead of a message about a symbol, so it keeps a `noqa` carrying the reason.
|
||||
- `datetime.utcfromtimestamp` is replaced in `_recaptcha_seed.py`. It returns a naive datetime and has been deprecated since 3.12, which matters now that the matrix reaches 3.14.
|
||||
- CI runs 3.11, 3.12, 3.13 and 3.14 on Ubuntu and Windows, every version `requires-python` promises; two of them had never run here. ruff selects F601 beside F821 and F811, because a dict literal with a repeated key silently keeps only the last one and Python does not warn.
|
||||
- ruff is declared in the dev extra instead of being pip-installed unpinned on every run, so the tool that gates every push cannot change under us between two pushes. `pytest-mock` and `responses` were declared and used by no test in this package, and are dropped.
|
||||
- Publishing is a workflow on a tag push using PyPI trusted publishing (OIDC, environment `pypi`), so there is no long-lived token on a machine or in a secret. The upload sits behind a gate that checks three things a person had to remember: the tag names the version being built, the `invisible-core==` pin is already on the index, and the suite passes, since a tag push does not trigger the ordinary test workflow. It needs a GitHub publisher registered on PyPI before its first run; until that exists the upload fails with `invalid-publisher`, which is the correct failure.
|
||||
|
||||
## [0.5.0] - 2026-08-01
|
||||
|
||||
### Changed
|
||||
- The CLI is two commands, `fetch` and `version`. `path`, `clear-cache`, `doctor` and `fetch --force` are gone, and so is the tag argument. **Breaking for anybody scripting the four that were removed** - they fail loudly rather than being ignored, and a test asserts that. None of the behaviour is gone.
|
||||
- `doctor` runs inside `fetch` now, on every run and before the download rather than after. That ordering is the point: a cached tree that no longer matches the seal is the case worth catching, and it is invisible to a "download if missing" that only looks at whether a file exists. It was the thing most worth doing and the thing least likely to be typed.
|
||||
- `--force` is unnecessary once every run verifies: a tree is replaced because it does not match the seal, not because a flag was passed.
|
||||
- `path` is the last line of `fetch`'s stdout, so `$(invisible-playwright fetch)` is the scripting form, and unlike `path` it guarantees the thing it names exists and matches. The mismatch report goes to stderr so it can never end up inside a captured path.
|
||||
- `clear-cache` is deliberately NOT folded in. The cache root is shared with `invisible_firefox`, so pruning trees no seal points at would delete the other product's engine on a machine running both. `version` prints the location instead.
|
||||
- The tag argument went with them: the seal decides which engine a build runs and `verify_engine` refuses anything else, so a tag on the command line could only ever name something that would then be rejected.
|
||||
- The surface is asserted as an EXACT set, not a subset. A subset check passes while the CLI grows back one convenience at a time, which is how it reached six.
|
||||
|
||||
## [0.4.9] - 2026-08-01
|
||||
|
||||
### Changed
|
||||
- Requires `invisible-core==18.11.0`. 18.10.0 classifies a 404 on the engine archive instead of raising a bare `HTTPError`, which is issue #51, and 18.11.0 removed the part of it that ran `pip install --upgrade` on the caller's environment: a library that installs things while it is running mutates an environment nobody asked it to touch, ignores whatever lockfile chose that version, and inside a container rewrites an image layer at runtime. What reaches a user of this package is that a 404 on the engine now says whether the release was retired on purpose, in which case no retry will find it and the message carries the upgrade command, or whether the tag is current and the fault is ours. Nothing in this package's behaviour changed.
|
||||
|
||||
### Fixed
|
||||
- The README said the sampler draws "~400 fields". Measured against a real profile: 197 leaves on the most generous count, which treats every bundled font name as a field, and 155 prefs emitted. Corrected to ~200. `tests/test_readme_claims.py` now gates the engine version, the platform list, the download size, the documented subcommands in both directions, and every fenced Python example on the page - four claims that had nothing checking them.
|
||||
- A publish was racing its own verification: the install e2e runs on `release:`, which fires seconds after the upload, and the index does not serve a new version to pip immediately, so the job reported a forgotten publish that had happened two minutes earlier. A bounded five-minute poll on the per-version endpoint, scoped to the release event. CI-only.
|
||||
|
||||
## [0.4.8] - 2026-07-28
|
||||
|
||||
### Changed
|
||||
- Requires `invisible-core==18.9.0`, which carries a clearer engine refusal (it used to locate a missing juggler inside an `omni.ja` the tree does not have) and a publish gate that no longer reports a mistyped command with the same exit code as a broken gate. An exact pin means those reach a user only when this package's pin moves, so this release is what delivers them.
|
||||
- CI runs ruff with F821 and F811 selected, those two only: they catch a name that cannot resolve, which is not a style question and not findable by running tests. Nothing here had ever run a linter, and there are zero violations once the three below are fixed.
|
||||
|
||||
### Fixed
|
||||
- `Renderer` was used as an annotation six times in `_behaviour.py` and defined in no module in the repository. It survives only because `from __future__ import annotations` never evaluates an annotation, so the six were strings that looked like a type and a reader had no way to learn what the parameter accepts. It is a real alias now.
|
||||
- `prof: Any` in `_motion.py`, with `Any` itself unimported. Importing it would have widened that module's deliberately tiny allowlist, which one of its own tests enforces, and there was no need: `prof` is the cumulative distance table `_profile_table` returns and `_profile_at` consumes, both annotated `list[float]` a few lines away.
|
||||
- The install e2e imported the venv helpers from `invisible_core.testing`, which the runner does not have on purpose, so the job went red at collection having tested nothing. The helpers are local to those two files again, with the reason above them, and the core's suite now parses every file the user-install workflows name and refuses the import. CI-only.
|
||||
- CI arms the hooks, because the suite asserts they are armed. The assertion moved into `invisible_core.testing` and all three repos started making it, but only the core's workflow ran `install_hooks.py`, so this repo went red on every push with a message about an unset config that reads like a developer's mistake rather than a missing CI step. CI-only.
|
||||
|
||||
## [0.4.7] - 2026-07-28
|
||||
|
||||
### Changed
|
||||
- Requires `invisible-core==18.8.0`, which carries the work of the last two days: the prefs builder split into fourteen named steps with its output hash-identical across 400 profiles, the GeoIP fetch moved out of `download`, `invisible_core.pin` as a public module, and a publish gate whose index cross-check finally asks about the package it is gating.
|
||||
- Nothing in this package's behaviour changed. The imports moved: it asks `invisible_core` for what that package exports instead of reaching into its private modules, and its own back-compat shims are for users again rather than for its own source.
|
||||
|
||||
### Fixed
|
||||
- The suite could not tell a collapsed selection from a pass in one place and the install e2e imported the package it tests the install of in another; both are CI-only and neither reached a user.
|
||||
|
||||
## [0.4.6] - 2026-07-27
|
||||
|
||||
### Changed
|
||||
- This package can no longer be published without a gate. A release used to be a bare `twine upload` of whatever happened to be in a directory - which is how 0.4.4 reached the index built from a tree that predated the fix it was meant to carry. The gate is `invisible_core.release`, one implementation for all three packages, and the pre-push hook runs it on a release tag. What makes it work is that `publish` builds and uploads *what it just built*, so a stale directory cannot be what ships.
|
||||
- `PUBLISHED.json` records what actually reached the index, back-filled from the artifacts themselves.
|
||||
- Requires `invisible-core==18.6.0`.
|
||||
|
||||
## [0.4.5] - 2026-07-27
|
||||
|
||||
### Fixed
|
||||
- An environment holding an older `invisible-core` failed on the browser launch path with `ImportError: cannot import name 'IANA_TO_POSIX_TZ' from 'invisible_core'` - a symbol name, from a package whose version the reader did not choose. It now states which core version this build needs, keeps the original error inside the message for whoever is debugging, and ends with the command that fixes it. **0.4.4 has this bug and cannot be corrected in place; a PyPI filename is never re-uploaded. Use 0.4.5.**
|
||||
|
||||
## [0.4.4] - 2026-07-27
|
||||
|
||||
### Changed
|
||||
- The process-lifetime machinery moved into `invisible-core`, shared with the profile manager. Both packages launch the same browser and both had the same leak; the manager had it a day longer because the fix lived here. `invisible_playwright._reaper` stays as a re-export, so nothing you import changes.
|
||||
- The IANA-to-POSIX timezone table is the core's now. This package carried a byte-identical copy of all ten entries, including the Arizona row that exists because mapping it to `MST7MDT` made libc apply DST and an identification service deduce a Denver origin - and the core's own copy carried a comment admitting it had been copied from here. Two copies with a documented keep-in-sync obligation and nothing enforcing it.
|
||||
|
||||
### Fixed
|
||||
- The lifetime guard counted an attempted job assignment as a successful one, so a process it had failed to adopt was never retried and the count it reported was a number of tries. Measured on the sibling package, that reported eight processes held while eight survived the kill. This package shipped the same accounting.
|
||||
|
||||
## [0.4.3] - 2026-07-27
|
||||
|
||||
### Fixed
|
||||
- `async with InvisiblePlaywright(...)` no longer leaves browsers behind when the runner is killed. The lifetime guard added in 0.4.0 reached the sync entry point only, so every async user kept the entire leak while this file said it was closed. If you drive this package with `async with` on Windows, upgrading is the fix.
|
||||
- The guard itself stopped adopting the process tree after the first process it found, so part of the tree stayed outside the kernel job even on the sync path. Found by killing the runner mid-session and counting the browsers still carrying that session's token: sync 0/0/0/0, async 2/0/0/2 - the same code on both, differing only in timing, which is what made an intermittent race look like a working feature. After the fix: ten sessions, zero survivors on both.
|
||||
- `INVPW_TRUE_HEADLESS` now works on both entry points. It was read in the async class alone, so a documented environment variable applied or did not depending on whether you wrote `with` or `async with`.
|
||||
|
||||
### Changed
|
||||
- The two entry points share their session logic instead of restating it: prefs, the launch environment and the IANA-to-POSIX timezone table live in one module both call. 80.6% of the async class was the sync class retyped, which is how a fix reaches one of them and a release note describes both.
|
||||
- Requires `invisible-core==18.3.0`.
|
||||
|
||||
## [0.4.2] - 2026-07-26
|
||||
|
||||
### Changed
|
||||
- The lifetime guard is a strategy object instead of a module of flags. `SessionToken` (a value object), `find_processes` (the only place psutil appears) and `LifetimeGuard` with a `JobObjectGuard` / `NullGuard` pair: `os.name` is tested in exactly one place, so no launcher code branches on the platform, and the Null implementation reports that it guarantees nothing rather than doing nothing while looking successful. Behaviour unchanged.
|
||||
- The stroke planner is six named stages instead of one 203-line function, and the idle planner is a table of episodes instead of an if/elif chain with the weights written as bare literals in the branch conditions. Both verified byte-identical against recorded output, which caught two float-associativity regressions that no other test could see - `a * b * c` and `a * (b * c)` differ in the last bit, and that is enough to change a rounded pixel and every draw after it. A permanent fingerprint test now covers 576 cases and 16135 waypoints.
|
||||
|
||||
## [0.4.1] - 2026-07-26
|
||||
|
||||
### Changed
|
||||
- Three long functions became named stages, with their output pinned before and after so the refactor could not change it in silence.
|
||||
- The lifetime guard became a strategy rather than a module of flags.
|
||||
- The forbidden-name scan no longer blocks a clone that has no word list.
|
||||
|
||||
## [0.4.0] - 2026-07-26
|
||||
|
||||
### Added
|
||||
- Pointer movement is generated in this package, from the session seed, instead of by the engine. Existing code gets it with no edit: the six internal funnels every pointer action already goes through are wrapped, so a `page.click` written a year ago moves through the new generator. A plain `sync_playwright()` browser in the same process is untouched.
|
||||
- Movement between actions: drift while reading, motion while the wheel turns, overshoot and correction, and movements that end on nothing. If every movement ends on something clickable, the set of endpoints is itself a signature however good each path is.
|
||||
- `INVPW_CURSOR_ENGINE` selects the generator: `python` (default), `binary` (the previous behaviour) or `off`.
|
||||
- The browser process tree is tied to this process's lifetime on Windows, so it cannot outlive a runner that was killed. Measured: eight survivors on the first attempt and twelve on the second before, zero after. `psutil` becomes a dependency for this - an optional reaper is absent exactly on the machines that need it, and silently. **This reached the SYNC entry point only. `async with` kept the whole leak through 0.4.2 - see 0.4.3.**
|
||||
|
||||
### Changed
|
||||
- Install is now `pip install invisible-playwright`, from the index. The git URL is gone from the README, the CLI docs and the generated release notes. Nothing about the package changes for someone who was already installing it from git, except that pip can now see what it is holding.
|
||||
- `invisible-core` is declared as an exact version specifier (`invisible-core== an exact version`) instead of a `git+https://...` direct reference. A direct reference carries no version, so there is nothing for `pip check` to compare and a broken environment reports clean; a real specifier is reported, exit 1, and a plain reinstall of this package repairs it. The cost is that a binary bump is now a release of every package that pins the core, which is deliberate.
|
||||
- Requires `invisible-core>=18.2.0`, which bounds the timezone lookup as a step rather than only per request.
|
||||
|
||||
### Fixed
|
||||
- `hover()` no longer fails intermittently on Windows. The approach now completes before the automation layer's hit-target check is installed, so the only event inside its window is that layer's own move, on target. Measured on a page whose target needs a scroll: 3 failures out of 3 before, 0 out of 3 after.
|
||||
|
||||
## [0.3.6] - 2026-07-25
|
||||
|
||||
### Fixed
|
||||
- The browser tree now dies with this process even when the process is KILLED. An exception out of the `with` block was never the leak - `__exit__` runs and Playwright cleans up, measured over an interleaved A/B with zero survivors. The leak is the killed-runner path, where `__exit__` never executes at all: launch, kill the runner, and eight processes were still alive, twelve on the second attempt.
|
||||
|
||||
### Changed
|
||||
- Declared as `invisible_playwright` on the index, pinning `invisible-core==18.1.0`.
|
||||
|
||||
## [0.3.5] - 2026-07-25
|
||||
|
||||
### Changed
|
||||
- Playwright pin is back to `>=1.55,<=1.61.0`: the floor drop to `1.40` shipped in 0.3.4 is reverted. The conservative CI-tested floor (1.55) is kept together with the tested upper cap (1.61.0).
|
||||
|
||||
## [0.3.4] - 2026-07-24
|
||||
|
||||
### Changed
|
||||
- Playwright floor lowered to `>=1.40,<=1.61.0`. The `1.55` floor was never a real compatibility bound - it was only the single minor that 0.3.1 had pinned. The `firefox-18` binary was smoke-tested (launch, `new_context`, navigate, evaluate, click) against 1.40, 1.45, 1.50 and 1.54 and passed on all four, so anyone on an older client keeps working; the upper cap stays at the tested 1.61.0. Reverted in 0.3.5.
|
||||
|
||||
## [0.3.3] - 2026-07-24
|
||||
|
||||
### Changed
|
||||
- Playwright pin is now `>=1.55,<=1.61.0` (was `>=1.55,<1.62`). The open upper bound would let an untested version below 1.62 install and break a fresh setup the way 1.61 first did; the cap is now the exact version validated against this binary, 1.61.0. It moves forward on purpose, once a newer Playwright is tested against the binary.
|
||||
- The expected Firefox version in the tests is derived from the constant instead of a hardcoded literal, so a binary bump no longer needs the test edited alongside it.
|
||||
|
||||
## [0.3.2] - 2026-07-24
|
||||
|
||||
### Changed
|
||||
- Playwright pin moved to `>=1.55,<1.62` (was `>=1.55,<1.56`). The `firefox-18` binary rebases onto Firefox 151, which is what the latest Playwright (1.61) pairs with, so 1.61 now drives the binary natively - no more pinning to an older client. Both ends of the range were tested against the new binary (full browser suite on 1.61; drift-free protocol on 1.55). `scripts/playwright_pin.txt` -> 1.61.0.
|
||||
- README badges are served as SVGs from the repo instead of a third-party badge service, so the header no longer depends on an external endpoint; the dynamic Firefox-version badge, which was the flaky one, is now static.
|
||||
|
||||
### Fixed
|
||||
- The CI font gate checks that the whitelisted faces actually LOAD, not only that the family enumerates. Enumerating a font is not loading it, so the previous check could pass on a build that could name a family it could not render.
|
||||
|
||||
## [0.3.1] - 2026-07-13
|
||||
|
||||
### Fixed
|
||||
- [#48](https://github.com/feder-cr/invisible_playwright/issues/48): Playwright 1.61 adds an `isMobile` field to the `Browser.setDefaultViewport` Juggler command that the FF150 binary does not accept, which kills the session. The range narrows from `>=1.40,<1.61` to the CI-tested 1.55.x (`>=1.55,<1.56`, single-sourced from `scripts/playwright_pin.txt`) so a fresh install always gets a compatible client. Widened again in 0.3.2, once `firefox-18` rebased onto Firefox 151.
|
||||
|
||||
### Changed
|
||||
- The patched-Firefox source repo is now `feder-cr/firefox_antidetect_patch` (it was `feder-cr/invisible_firefox`, a name the profile manager took over). Release notes, CI references and the release URLs the download tests mock all point at the new name; the binaries themselves are unchanged.
|
||||
- The wrapper no longer injects the font-list / system-UI environment variables at launch: the binary ships its own font bundle and is self-contained on that front. The integration tests were adapted and the font-sampling tests dropped.
|
||||
|
||||
### Added
|
||||
- `scripts/ci_font_gate.py`: asserts the Windows font persona on every OS, so a Linux or macOS runner catches a font regression that would otherwise only show up on Windows.
|
||||
|
||||
## [0.3.0] - 2026-07-03
|
||||
|
||||
### Changed
|
||||
- Pure config (seed -> fingerprint -> prefs, binary download, proxy, geo) is split out into a standalone `invisible-core` package with zero Playwright, so a profile manager can reuse it without pulling Playwright in. The wrapper depends on it and replaces the moved modules with full-alias shims: existing imports (public API, submodules, private names) and `isinstance` checks keep working unchanged. `tests/test_backcompat.py` locks that contract with 6 guards.
|
||||
- `BINARY_VERSION` walks `firefox-7` -> `firefox-13` across this cycle: `firefox-8`, then `firefox-9` (`firefox-8` was found broken and is refused outright, not merely superseded), `firefox-10`, `firefox-11`, `firefox-12` (the cross-OS render-parity build) and `firefox-13` (geo-aware locale/Intl + the Windows font bundle + the audio gate).
|
||||
- Playwright is capped at `<1.61` (`>=1.40,<1.61`) and the pin is single-sourced from `scripts/playwright_pin.txt` instead of being written in two places.
|
||||
- WebGL personas: only the GPU buckets that survive the tampering checks are shipped, and the render-noise seed is decoupled from the persona seed.
|
||||
- The dead `zoom.stealth.normalize_date_now` baseline pref is dropped.
|
||||
- New runtime dependencies: `requests[socks]` (SOCKS egress lookup), `maxminddb` (mmdb reader), `tzdata` (IANA database for `zoneinfo`, which Windows lacks). After the split they arrive transitively through `invisible-core`.
|
||||
|
||||
### Added
|
||||
- `timezone="auto"`: the browser timezone is auto-derived from the egress IP. By default (no explicit timezone) it ALWAYS resolves - from the proxy egress when a proxy is set, otherwise from the host's own public IP - so the zone can never disagree with the IP (the classic `timezone_mismatch` signal). An explicit `"Area/City"` is the only way to force a specific zone. On failure: with a proxy the launch raises (no silent host-TZ fallback behind a foreign proxy); without a proxy it falls back to the host TZ so a transient lookup can't break the launch.
|
||||
- The egress IP is mapped to its IANA zone with an offline mmdb (`daijro/geoip-all-in-one`). It always tracks the upstream weekly rebuild: on every launch the current latest release tag is resolved from the `releases/latest/download` permalink (no GitHub API → no rate limit) and pulled only if newer than the cache, older copies pruned. Offline → the cached copy is reused; never a pinned tag (daijro prunes old releases, so a pin eventually 404s). `STEALTHFOX_GEOIP_MMDB` points at your own `.mmdb` to skip the download.
|
||||
- `resolve_session_timezone(timezone, proxy)` and `ensure_geoip_mmdb()` re-exported at the package root (plus `GeoTimezoneError`) so integrations that own their launch can reproduce the resolution.
|
||||
- `tests/test_geo.py` (37) + `tests/test_geoip_update.py` (freshness / auto-update / offline fallback) unit tests.
|
||||
- Cross-OS render parity (needs `firefox-12`): the same font/canvas/WebGL fingerprint now renders consistently on Windows, Linux and macOS, so a Windows persona looks identical regardless of the host the binary runs on. Each whitelisted font renders a distinct canvas image (font-detection probes that dedup by rendered image keep every name), the standard Windows fonts (Calibri, Franklin Gothic, Gadugi, Javanese Text, Myanmar Text) are always present so the detected font set matches a real Windows install, and the per-seed render-noise leaves a solid-colour reference render byte-exact while still varying real fingerprint renders.
|
||||
- GPU persona applied on every platform: Linux/macOS hosts now present a coherent Windows GPU (renderer + WebGL parameters) instead of the host's real adapter; pool re-rooted on a real-device GPU mix.
|
||||
- `tests/test_canvas_render_stealth.py`, `tests/test_webgl_noise_active.py` and new `tests/test_sampler.py` cases: regression guards for per-font canvas distinctness, solid-readback purity under render-noise, and the always-present standard-font invariant.
|
||||
- macOS support in the wrapper (x86_64 + arm64): the release pipeline builds five targets and the wrapper resolves the archive for the host it runs on.
|
||||
- Headless is cloaked on Windows and macOS and runs under Xvfb on Linux, instead of the flagged headless mode; CI carries a cloak guard and a WebGL-masking guard. The cloak applies on the async path too.
|
||||
- The e2e suite runs the real detectors offline (BotD, FingerprintJS, fpscanner, CreepJS, vendored under `tests/vendor/`) and a hermetic SOCKS5 auth + routing e2e, all on CI on every push. The 15 hand-rolled BotD imitations are dropped now that the real one runs.
|
||||
- `fetch --force` on the CLI, to re-download an archive over a cached one.
|
||||
|
||||
### Fixed
|
||||
- WebRTC behind a proxy ships the validated realness configuration, with CI guards: a fully blocked WebRTC is itself a tell, so the guard asserts the positive form and not merely the absence of a leak.
|
||||
- The TLS ClientHello matches stock Firefox again: cipher `0xC009` was being offered and stock Firefox does not offer it.
|
||||
- The humanize prefs were written under the wrong namespace.
|
||||
- The font pool uses the real Windows 11 family name `franklin gothic medium`; the previous name does not exist on a real install.
|
||||
|
||||
## [0.2.0] - 2026-05-28
|
||||
|
||||
### Added
|
||||
- Public config helpers in `invisible_playwright.config`: `get_default_stealth_prefs(seed, *, pin, locale, timezone, extra_prefs, humanize, virtual_display)` returns a complete `firefox_user_prefs` dict; `get_default_args()` returns the baseline CLI args list (currently empty). Both also re-exported at the package root.
|
||||
- `invisible_playwright.ensure_binary` re-exported at the package root for parity with the `cloakbrowser.download.ensure_binary` integration pattern that downstream projects (Skyvern, Crawlee, agno) already expect.
|
||||
- These helpers let third-party fetchers (changedetection.io plugins, Crawlee `BrowserPool` subclasses, agno toolkits) drive `playwright.firefox.launch(executable_path=..., firefox_user_prefs=...)` themselves without depending on the `InvisiblePlaywright` context manager owning the lifecycle.
|
||||
- `tests/unit/test_config_public.py`: 14 unit tests covering deterministic seed, locale / timezone / pin / extra_prefs / humanize variations, and round-trip via the public namespace.
|
||||
|
||||
### Unchanged
|
||||
- `InvisiblePlaywright` context manager surface is identical (backwards compatible).
|
||||
- `BINARY_VERSION` stays at `firefox-7`. Python-only release; no new Firefox build.
|
||||
|
||||
## [0.1.8] - 2026-05-23
|
||||
|
||||
### Fixed
|
||||
- [#20](https://github.com/feder-cr/invisible_playwright/issues/20): cross-origin iframes were unreachable from Playwright. `element_handle.content_frame()` returned `None`, `frame.evaluate()` threw cross-origin SOP errors, and `frame_locator(...).click()` timed out even with `force=True`. Root cause: FF150 defaults `fission.webContentIsolationStrategy=1` (`IsolateEverything`), which site-isolates every cross-origin iframe into a separate `webIsolated` content process even when `fission.autostart=False`. The parent's Juggler FrameTree then has a Frame placeholder with no docShell and no URL - every protocol op that needs to enter the iframe fails. Fix: pin `fission.webContentIsolationStrategy=0` (`IsolateNothing`) in the baseline prefs. The setting can be flipped back per session via `extra_prefs={"fission.webContentIsolationStrategy": 1}`.
|
||||
|
||||
### Added
|
||||
- `tests/test_cross_origin_iframe.py`: 4 unit + 5 e2e regression sentinels for cross-origin iframe interaction. The e2e layer runs entirely offline against two local HTTP servers on `127.0.0.1` (two ports = two SOP origins) and covers `page.frames` URL tracking, `content_frame()`, `frame.evaluate()`, `frame_locator(...).locator(...)`, and end-to-end `dispatch_event("click")` for plain, sandboxed and titled iframes. A future FF upgrade or fingerprint A/B that flips the pref back to `1` will fail the suite before shipping.
|
||||
|
||||
### Unchanged
|
||||
- `BINARY_VERSION` stays at `firefox-7`. Python-only release; no new Firefox build was needed.
|
||||
|
||||
## [0.1.7] - 2026-05-21
|
||||
|
||||
### Fixed
|
||||
- [#18](https://github.com/feder-cr/invisible_playwright/issues/18): Tab crash when running with `headless=True` on Windows on pages that trigger cross-process navigation. Two separate bugs that only manifested together: (1) the Chromium content sandbox at default level 6 puts content processes on `kAlternateWinstation`, but the wrapper hides the browser window on its own alt-desktop (`CreateDesktop` for headless on Windows). Mismatched desktops → cross-process navigations couldn't reparent windows → content process exits cleanly and Playwright fires `page.on('crash')`. (2) The canvas2d `getImageData` stealth spoof wrote to a read-only mapped `DataSourceSurface`. On GPU-backed canvases that memory is write-protected → segfault during the final `getImageData` at page unload. Wrapper now sets `security.sandbox.content.level=4` in the alt-desktop workaround set, and `firefox-7` ships the source fix that moves the noise to the JS array's writable backing buffer.
|
||||
|
||||
### Changed
|
||||
- `BINARY_VERSION` bumped from `firefox-5` to `firefox-7`. `firefox-6` was rolled back when its partial fix turned out to be wrong (the iframe-burst hypothesis was a dead end; bisection in the evening found the real two-bug cause documented above).
|
||||
|
||||
## [0.1.6] - 2026-05-21
|
||||
|
||||
@@ -25,7 +289,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||
## [0.1.4] - 2026-05-20
|
||||
|
||||
### Fixed
|
||||
- [#13](https://github.com/feder-cr/invisible_playwright/issues/13): every page that threw an uncaught JS error (e.g. bunny.net) crashed the Playwright client with `TypeError: Cannot read properties of undefined (reading 'url')`. Root cause: upstream Playwright Juggler added a required `location` field to the `Page.uncaughtError` event in the 2026-05-07 roll ([microsoft/playwright@c8604ec](https://github.com/microsoft/playwright/commit/c8604ecd97)); our fork was carrying the pre-roll schema in every `firefox-N` build. Fix matches upstream — Runtime.js builds the `errorLocation`, PageAgent.js forwards it on both worker and runtime error paths, Protocol.js declares the schema field. Reporter: [@dionorgua](https://github.com/dionorgua).
|
||||
- [#13](https://github.com/feder-cr/invisible_playwright/issues/13): every page that threw an uncaught JS error (e.g. bunny.net) crashed the Playwright client with `TypeError: Cannot read properties of undefined (reading 'url')`. Root cause: upstream Playwright Juggler added a required `location` field to the `Page.uncaughtError` event in the 2026-05-07 roll ([microsoft/playwright@c8604ec](https://github.com/microsoft/playwright/commit/c8604ecd97)); our fork was carrying the pre-roll schema in every `firefox-N` build. Fix matches upstream - Runtime.js builds the `errorLocation`, PageAgent.js forwards it on both worker and runtime error paths, Protocol.js declares the schema field. Reporter: [@dionorgua](https://github.com/dionorgua).
|
||||
|
||||
### Changed
|
||||
- `BINARY_VERSION` bumped from `firefox-3` to `firefox-4`. JS-only change inside `chrome/juggler/`; `xul.dll` and `firefox.exe` are byte-identical to `firefox-3`.
|
||||
@@ -33,23 +297,23 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||
## [0.1.3] - 2026-05-19
|
||||
|
||||
### Changed
|
||||
- `BINARY_VERSION` bumped from `firefox-2` to `firefox-3`. The new archives on both Windows and Linux are built from a clean clone of [feder-cr/invisible-firefox#stealth/150](https://github.com/feder-cr/invisible-firefox/tree/stealth/150) — the consolidated source-of-truth fork (renamed from `feder-cr/firefox`; the companion `feder-cr/firefox-stealth` patches repo was deleted, all patches now live as commits on top of `mozilla-firefox/firefox`).
|
||||
- `BINARY_VERSION` bumped from `firefox-2` to `firefox-3`. The new archives on both Windows and Linux are built from a clean clone of [feder-cr/firefox_antidetect_patch#stealth/150](https://github.com/feder-cr/firefox_antidetect_patch/tree/stealth/150) - the consolidated source-of-truth fork (renamed from `feder-cr/firefox`; the companion `feder-cr/firefox-stealth` patches repo was deleted, all patches now live as commits on top of `mozilla-firefox/firefox`).
|
||||
- The patched Firefox archive now ships the **proper C++ implementation** of `windowUtils.jugglerSendMouseEvent`, replacing the JS shim from 0.1.2.
|
||||
|
||||
### C++ fixes landed in this release
|
||||
- **C1+C2**: `setDownloadInterceptor` IDL + cpp (re-landed for FF150).
|
||||
- **C4**: 5 `nsIDocShell` stealth attributes (`fileInputInterceptionEnabled`, `overrideHasFocus`, `bypassCSPEnabled`, `forceActiveState`, `disallowBFCache`).
|
||||
- **C5**: `LauncherProcessWin.cpp` + `nsWindowsWMain.cpp` juggler-pipe handle inheritance — without this, the Playwright pipe disconnects immediately on launch.
|
||||
- **C6**: `juggler-navigation-started-renderer` / `-browser` observer notifications in `nsDocShell.cpp` and `CanonicalBrowsingContext.cpp` — without these, `Page.ready` never fires and `ctx.new_page()` hangs.
|
||||
- **C5**: `LauncherProcessWin.cpp` + `nsWindowsWMain.cpp` juggler-pipe handle inheritance - without this, the Playwright pipe disconnects immediately on launch.
|
||||
- **C6**: `juggler-navigation-started-renderer` / `-browser` observer notifications in `nsDocShell.cpp` and `CanonicalBrowsingContext.cpp` - without these, `Page.ready` never fires and `ctx.new_page()` hangs.
|
||||
- **C7 (partial)**: storage stub for `nsIDocShell.languageOverride`. Workaround `InvisiblePlaywright(locale="")` recommended until full BC FIELD port lands.
|
||||
|
||||
### Verified
|
||||
- Both archives built from same source: feder-cr/invisible-firefox commit `68906f1f9c55`.
|
||||
- Both archives built from same source: feder-cr/firefox_antidetect_patch commit `68906f1f9c55`.
|
||||
- Windows + Linux smoke suite green: launch, `ctx.new_page()`, `page.mouse.{move,down,up,click,wheel}`, `navigator.webdriver=false`, sannysoft 32/33 PASS.
|
||||
- SHA256 published in `checksums.txt` on the `firefox-3` release.
|
||||
|
||||
### Notes
|
||||
- This is the first release with a native Linux build of the patched binary (previous `firefox-3` draft mentioned shipping the Linux firefox-2 archive byte-for-byte; that no longer applies — Linux now has the full C++ patch series).
|
||||
- This is the first release with a native Linux build of the patched binary (previous `firefox-3` draft mentioned shipping the Linux firefox-2 archive byte-for-byte; that no longer applies - Linux now has the full C++ patch series).
|
||||
|
||||
## [0.1.2] - 2026-05-18
|
||||
|
||||
@@ -63,8 +327,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||
## [0.1.1] - 2026-05-18
|
||||
|
||||
### Fixed
|
||||
- **Critical**: every `page.mouse.*`, `page.click(selector)`, `locator.click()`, `page.hover()`, `mouse.wheel()` failed on the patched Firefox 150 binary with `win.windowUtils.jugglerSendMouseEvent is not a function`. The Juggler JS was porting calls to a Playwright-specific C++ method that was never landed in the FF146→FF150 port; replaced with the Mozilla chrome-scope `win.synthesizeMouseEvent` helper which is present in FF150. Six call sites patched across `juggler/protocol/PageHandler.js` and `juggler/content/PageAgent.js`. Reporter: [@trob9](https://github.com/trob9) — [#9](https://github.com/feder-cr/invisible_playwright/issues/9).
|
||||
- `_linkedBrowser.scrollRectIntoViewIfNeeded()` is now guarded at both call sites in `PageHandler.js` (`dispatchMouseEvent` and `dispatchWheelEvent`) — the method is not present on the shipped FF150 `<browser>` element, so the unguarded call threw before the mouse event was dispatched.
|
||||
- **Critical**: every `page.mouse.*`, `page.click(selector)`, `locator.click()`, `page.hover()`, `mouse.wheel()` failed on the patched Firefox 150 binary with `win.windowUtils.jugglerSendMouseEvent is not a function`. The Juggler JS was porting calls to a Playwright-specific C++ method that was never landed in the FF146→FF150 port; replaced with the Mozilla chrome-scope `win.synthesizeMouseEvent` helper which is present in FF150. Six call sites patched across `juggler/protocol/PageHandler.js` and `juggler/content/PageAgent.js`. Reporter: [@trob9](https://github.com/trob9) - [#9](https://github.com/feder-cr/invisible_playwright/issues/9).
|
||||
- `_linkedBrowser.scrollRectIntoViewIfNeeded()` is now guarded at both call sites in `PageHandler.js` (`dispatchMouseEvent` and `dispatchWheelEvent`) - the method is not present on the shipped FF150 `<browser>` element, so the unguarded call threw before the mouse event was dispatched.
|
||||
|
||||
### Added
|
||||
- `tests/test_mouse.py`: 12-case regression suite covering every patched code path (mouse.move/click/dblclick/right-click, modifiers, locator.click/hover, wheel, manual mousedown+up, off-viewport move, humanize intermediate moves, scroll-and-click on offscreen element). Test cases inspired by `microsoft/playwright-python/tests/async/test_click.py`.
|
||||
@@ -72,14 +336,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||
|
||||
### Notes
|
||||
- The Stealthfox humanize Bezier expansion continues to fire intermediate `mousemove` events; the swap to `synthesizeMouseEvent` does not change the human-trajectory behavior (verified by test).
|
||||
- The reCAPTCHA v3 score (0.90) and FingerprintPro / CreepJS results documented in the README are unaffected — `synthesizeMouseEvent` is a legitimate Mozilla helper that does not increase the anti-detect surface.
|
||||
- The reCAPTCHA v3 score (0.90) and FingerprintPro / CreepJS results documented in the README are unaffected - `synthesizeMouseEvent` is a legitimate Mozilla helper that does not increase the anti-detect surface.
|
||||
- A binary refresh of the patched Firefox archive on GitHub Releases is required for users to receive this fix (the Juggler JS is shipped inside the archive). The `BINARY_VERSION` will be bumped to `firefox-2` in that release.
|
||||
|
||||
## [0.1.0] - 2026-05-13
|
||||
|
||||
### Added
|
||||
- Initial public release.
|
||||
- `InvisiblePlaywright` sync and async context managers — drop-in replacement for `playwright.sync_api.Browser` / `async_api.Browser`.
|
||||
- `InvisiblePlaywright` sync and async context managers - drop-in replacement for `playwright.sync_api.Browser` / `async_api.Browser`.
|
||||
- StealthFox humanize hook: Bezier-curve mouse trajectories enabled by default.
|
||||
- `_fpforge` Bayesian fingerprint sampler with ~400 fields per session.
|
||||
- CLI: `invisible-playwright fetch | path | version | clear-cache`.
|
||||
@@ -87,6 +351,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||
- SOCKS5 / SOCKS4 / HTTP / HTTPS proxy support with auth.
|
||||
- Linux x86_64 and Windows x86_64 binary support.
|
||||
|
||||
[Unreleased]: https://github.com/feder-cr/invisible_playwright/compare/v0.1.1...HEAD
|
||||
[0.4.3]: https://github.com/feder-cr/invisible_playwright/releases/tag/v0.4.3
|
||||
[0.1.1]: https://github.com/feder-cr/invisible_playwright/compare/v0.1.0...v0.1.1
|
||||
[0.1.0]: https://github.com/feder-cr/invisible_playwright/releases/tag/v0.1.0
|
||||
[0.4.4]: https://github.com/feder-cr/invisible_playwright/releases/tag/v0.4.4
|
||||
[0.4.5]: https://github.com/feder-cr/invisible_playwright/releases/tag/v0.4.5
|
||||
[0.4.6]: https://github.com/feder-cr/invisible_playwright/releases/tag/v0.4.6
|
||||
@@ -6,8 +6,8 @@ Thanks for your interest in improving this project. Contributions are welcome vi
|
||||
|
||||
- **Bug?** Open a [bug report](https://github.com/feder-cr/invisible_playwright/issues/new?template=bug_report.yml).
|
||||
- **Idea?** Open a [feature request](https://github.com/feder-cr/invisible_playwright/issues/new?template=feature_request.yml).
|
||||
- **Security issue?** Do **not** open a public issue — see [SECURITY.md](SECURITY.md).
|
||||
- **The C++ patches** live in the companion repo [feder-cr/invisible-firefox](https://github.com/feder-cr/invisible-firefox) (branch `stealth/150`). Bugs in fingerprint spoofing usually belong there.
|
||||
- **Security issue?** Do **not** open a public issue - see [SECURITY.md](SECURITY.md).
|
||||
- **The C++ patches** live in the companion repo [feder-cr/firefox_antidetect_patch](https://github.com/feder-cr/firefox_antidetect_patch) (branch `stealth/150`). Bugs in fingerprint spoofing usually belong there.
|
||||
|
||||
## Scope
|
||||
|
||||
@@ -18,7 +18,7 @@ This repository ships the **Python wrapper** (`invisible_playwright`) around a p
|
||||
- Binary download/caching, CLI, proxy plumbing
|
||||
- Tests, docs, examples, packaging
|
||||
|
||||
Out of scope (belongs in `invisible-firefox`):
|
||||
Out of scope (belongs in `firefox_antidetect_patch`):
|
||||
|
||||
- Changes to the Firefox C++ source
|
||||
- New preferences exposed by the patched binary
|
||||
@@ -26,6 +26,9 @@ Out of scope (belongs in `invisible-firefox`):
|
||||
|
||||
## Development setup
|
||||
|
||||
To *use* the package you do not need any of this: `pip install invisible-playwright`.
|
||||
The steps below are for working on the code.
|
||||
|
||||
```bash
|
||||
git clone https://github.com/feder-cr/invisible_playwright.git
|
||||
cd invisible_playwright
|
||||
@@ -40,7 +43,7 @@ Requires Python 3.11+ and one of: Windows x86_64, Linux x86_64.
|
||||
## Running tests
|
||||
|
||||
```bash
|
||||
pytest # unit + integration (default — fast)
|
||||
pytest # unit + integration (default - fast)
|
||||
pytest -m e2e # end-to-end, requires the patched binary
|
||||
pytest -m slow # wheel-build regression tests
|
||||
```
|
||||
@@ -50,7 +53,7 @@ Markers are defined in `pyproject.toml`. The default run excludes `slow` and `e2
|
||||
## Pull requests
|
||||
|
||||
1. Fork and create a topic branch (`fix/...`, `feat/...`, `docs/...`).
|
||||
2. Keep PRs focused — one logical change per PR.
|
||||
2. Keep PRs focused - one logical change per PR.
|
||||
3. Add or update tests for any behavior change.
|
||||
4. Make sure the default `pytest` run is green.
|
||||
5. Follow [Conventional Commits](https://www.conventionalcommits.org/) for commit messages (e.g. `fix(launcher): handle missing profile dir`).
|
||||
@@ -63,9 +66,9 @@ CI must be green before merge.
|
||||
|
||||
Before opening, please:
|
||||
|
||||
- Search [existing issues](https://github.com/feder-cr/invisible_playwright/issues) — the bug may already be tracked.
|
||||
- Search [existing issues](https://github.com/feder-cr/invisible_playwright/issues) - the bug may already be tracked.
|
||||
- Reproduce on the **latest release** if possible.
|
||||
- Confirm the issue is in the Python wrapper, not the patched Firefox itself. If a fingerprint is leaking or a detector flags the browser, open the issue at `feder-cr/invisible-firefox` instead.
|
||||
- Confirm the issue is in the Python wrapper, not the patched Firefox itself. If a fingerprint is leaking or a detector flags the browser, open the issue at `feder-cr/firefox_antidetect_patch` instead.
|
||||
|
||||
Include:
|
||||
|
||||
|
||||
@@ -1,96 +1,55 @@
|
||||
# invisible_playwright
|
||||
<p align="center">
|
||||
<b>Trouble with captchas - reCAPTCHA, hCaptcha, Turnstile? With proxies? Is your headless browser detected every time?</b><br>
|
||||
<sub>Join the group and ask. Someone in there has already solved it.</sub>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="https://t.me/scrapingtheweb"><img src="https://raw.githubusercontent.com/feder-cr/invisible_playwright/main/docs/badges/telegram.svg" alt="Join on Telegram" height="38"></a>
|
||||
</p>
|
||||
|
||||
[](https://github.com/feder-cr/invisible_playwright/actions/workflows/tests.yml)
|
||||
[](LICENSE)
|
||||
[](https://www.python.org/downloads/)
|
||||
[](https://www.mozilla.org/firefox/)
|
||||
[](https://github.com/feder-cr/invisible_playwright/releases)
|
||||
[](https://github.com/feder-cr/invisible_playwright/stargazers)
|
||||
<h2></h2>
|
||||
|
||||
[](https://it.linkedin.com/in/federico-elia-5199951b6)
|
||||
<div align="center">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/feder-cr/invisible_playwright/main/docs/banner-dark.png">
|
||||
<img src="https://raw.githubusercontent.com/feder-cr/invisible_playwright/main/docs/banner-light.png" alt="invisible_playwright" width="720">
|
||||
</picture>
|
||||
<h3 align="center">Free antidetect browser stealth for Playwright: undetected Firefox fingerprint, headless or headed.<br>
|
||||
Python web scraping and captcha bypass. Open source, and it passes every bot detection test.</h3>
|
||||
</div>
|
||||
|
||||
A patched Firefox **100% Playwright-compatible** that passes the hardest browser-fingerprint detectors in the wild.
|
||||

|
||||
|
||||
## How it works
|
||||
|
||||
## Results
|
||||
Anti-bots ask two questions, and reCAPTCHA, hCaptcha and Cloudflare Turnstile score the answers. invisible_playwright answers yes to both.
|
||||
|
||||
### Google reCAPTCHA v3 - **0.90 / 1.0**
|
||||
**1. Is this a real browser?** Yes. It is Firefox, patched at the C++ source level.
|
||||
|
||||
Top-tier score. Google classifies the session as "very likely a human". Most anti-detect stacks plateau around 0.3-0.7.
|
||||
- The browser fingerprint is set inside the engine, not injected into the page: navigator, screen, GPU/WebGL, canvas, fonts, audio, WebRTC, timezone, network. Headless or headed, the same values either way.
|
||||
- No JS shim, no override, no seam to read.
|
||||
|
||||

|
||||
**2. Is a real person using it?** Yes. The actions are humanized in the driver.
|
||||
|
||||
### Fingerprint Pro - **bot: not detected, VPN: false, tampering: false, dev tools: not detected**
|
||||
- Every click, hover and drag follows a natural mouse path with human timing, no teleporting cursor.
|
||||
- Each input is byte-identical to a real mouse: real input source, pressure, trusted events.
|
||||
|
||||
FingerprintJS Pro's full Smart Signals battery flips every flag to "Not detected". Browser correctly identified as Firefox 150 on Windows 10. Confidence score 0.9.
|
||||
|
||||

|
||||
|
||||
### CreepJS - **0 lies**, fingerprint is internally coherent
|
||||
|
||||
No contradictions between headless hints, spoofed values, and real rendering output. That "0 lies" is what kills most anti-detect browsers: one inconsistency (e.g. Chrome UA + Firefox WebGL) and the trust score collapses.
|
||||
|
||||

|
||||
|
||||
### BrowserLeaks WebRTC - **no public IP leak**
|
||||
|
||||
WebRTC srflx address is the proxy egress IP; host candidates are private LAN. The real public IP never leaks via STUN, even on pages that configure their own ICE servers. Stock Firefox exposes an mDNS hostname (e.g. `abc-1234.local`) as a host ICE candidate, which is itself a stable per-session signal detectors fingerprint. invisible_playwright replaces host candidates with synthetic private-LAN IPs that match the spoofed network, removing the mDNS tell.
|
||||
|
||||

|
||||
|
||||
### bot.sannysoft.com - **all checks pass**
|
||||
|
||||
Every row green: WebDriver not present, Chrome-only properties absent, plugin/mime/languages arrays coherent, permissions API correct, iframe/source window checks pass.
|
||||
|
||||

|
||||
Driven by the standard Playwright API. Full breakdown: [feder-cr/firefox_antidetect_patch](https://github.com/feder-cr/firefox_antidetect_patch).
|
||||
|
||||
---
|
||||
|
||||
## Why it's powerful
|
||||
|
||||
**Most anti-detect browsers patch Chromium at the JavaScript level** - they override `navigator`, `WebGLRenderingContext.getParameter`, canvas APIs, and so on via injected scripts. This has two fatal problems:
|
||||
|
||||
1. **JS patches are detectable.** Anti-bots enumerate native function `.toString()`, check descriptor configurability, compare property enumeration order, watch for prototype mutations. Every patch leaves a fingerprint of its own. CreepJS has an entire battery of "lies detectors" built around this.
|
||||
2. **Chromium itself is now suspect.** Residential-proxy bot traffic is overwhelmingly Chromium-based, so detectors weight anything Chromium-shaped as risky by default. Chromium-based forks inherit Chrome's open-source layers (BoringSSL, Blink, V8, ANGLE) cleanly, but they still cannot fully match Chrome in practice: Chrome ships closed-source components on top (Widevine, proprietary codecs, Google Update / Safe Browsing endpoints) that flip detectable JS feature flags and network signals, and forks lag Chrome's release cadence by days to weeks, leaving telltale version-specific behaviours that detectors lock onto.
|
||||
|
||||
**invisible_playwright patches Firefox at the C++ level.** The spoofed values come back out through the normal Gecko paths - there is no JS shim, no override, no `Object.defineProperty`. **From the page's point of view, the browser is just telling the truth.** Anti-bot lie-detectors have nothing to latch onto.
|
||||
|
||||
invisible_playwright spoofs **all the layers that matter, together, coherently** — Navigator, screen, GPU/WebGL, Canvas, fonts, audio, WebRTC, timezone, DevTools detection, SOCKS5 auth, and the rest. See [feder-cr/invisible-firefox](https://github.com/feder-cr/invisible-firefox) for the full per-layer breakdown of which C++ files are patched and why.
|
||||
|
||||
Everything is driven by preferences - no hardcoded values in the binary. You change one pref, you change the spoofed value.
|
||||
|
||||
---
|
||||
|
||||
## How it compares
|
||||
|
||||
Commercial anti-detect browsers (Multilogin Mimic, GoLogin Orbita, AdsPower, Dolphin Anty) ship patched Chromium and apply most spoofing at the JavaScript layer. A few (Kameleo, Multilogin Stealthfox) also offer Firefox-based profiles, but the spoofing pattern is the same: runtime overrides on top of an unmodified rendering engine. That's the ceiling - and it's a low one.
|
||||
|
||||
| | invisible_playwright | Multilogin / GoLogin | AdsPower / Dolphin | Kameleo |
|
||||
|---|---|---|---|---|
|
||||
| Engine | Firefox (open source) | Chromium fork | Chromium fork | Chromium |
|
||||
| Patch depth | C++ source | JS overrides | JS overrides | JS overrides |
|
||||
| `.toString()` clean | ✅ Native Gecko path | ❌ Detectable shims | ❌ Detectable shims | ❌ Detectable shims |
|
||||
| Canvas / WebGL | ✅ C++ level | ⚠️ JS override | ⚠️ JS override | ⚠️ JS override |
|
||||
| SOCKS5 auth | ✅ Patched | ⚠️ Varies | ⚠️ Varies | ❌ |
|
||||
| Self-hosted | ✅ | ❌ SaaS | ❌ SaaS | ❌ Cloud |
|
||||
| reCAPTCHA v3 score | **0.90** | ~0.3-0.6 | ~0.3-0.5 | ~0.3-0.5 |
|
||||
| FP Pro - bot detected | ✅ Not detected | ❌ Detected | ❌ Detected | ❌ Detected |
|
||||
| FP Pro - tampering | ✅ Not detected | ❌ Detected | ❌ Detected | ❌ Detected |
|
||||
| FP Pro - VPN flag | ✅ false | ❌ true | ❌ true | ❌ true |
|
||||
| CreepJS lies | ✅ 0 | ❌ multiple | ❌ multiple | ❌ multiple |
|
||||
|
||||
Competitor scores reflect our own testing on Windows 10 against the same five detection suites used above; results may vary with their evolving builds.
|
||||
## Still seeing captchas or anti-bot? It's the proxy.
|
||||
Once the browser is handled it stops being the variable. If you are still getting challenged, the tell is no longer the browser, it is the IP you come from. Around 90% of proxies are public: anyone can rent the same address, so it is already known and sits on the blocked-IP lists sites check. A perfect browser on a known IP still loses.
|
||||
|
||||
---
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
pip install git+https://github.com/feder-cr/invisible_playwright.git
|
||||
python -m invisible_playwright fetch # one-time ~100 MB download, SHA256-verified
|
||||
pip install invisible-playwright
|
||||
python -m invisible_playwright fetch # one-time ~238 MB download (~544 MB unpacked), sha256-verified
|
||||
```
|
||||
|
||||
Supported platforms: **Windows x86_64**, **Linux x86_64**.
|
||||
Supported platforms: **Windows x86_64**, **Linux x86_64 / arm64**, **macOS arm64 / x86_64**. On macOS the app is ad-hoc signed (not notarized): if Gatekeeper complains, clear the quarantine flag once with `xattr -dr com.apple.quarantine` on the cached `Firefox.app`.
|
||||
|
||||
---
|
||||
|
||||
@@ -106,7 +65,7 @@ Supported platforms: **Windows x86_64**, **Linux x86_64**.
|
||||
+ with InvisiblePlaywright() as browser:
|
||||
```
|
||||
|
||||
Every session gets a unique, coherent fingerprint drawn from real-world Firefox telemetry (GPU / audio / fonts / ~400 other fields) and Bezier-curve mouse motion baked into the browser itself.
|
||||
Every session gets a distinct fingerprint (GPU, audio, fonts, screen, ~200 fields) and Bezier-curve mouse motion.
|
||||
|
||||
**Sync**
|
||||
```python
|
||||
@@ -130,19 +89,7 @@ async with InvisiblePlaywright(proxy={"server": "socks5://...", "username": "u",
|
||||
|
||||
The `browser` object is a `playwright.sync_api.Browser` / `playwright.async_api.Browser` - every Playwright method works as-is.
|
||||
|
||||
---
|
||||
|
||||
### Random fingerprint per session
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright() as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://creepjs-api.web.app")
|
||||
```
|
||||
|
||||
Every call samples a new coherent profile. Log the seed to reproduce interesting runs:
|
||||
Log the seed to replay a run:
|
||||
|
||||
```python
|
||||
sf = InvisiblePlaywright()
|
||||
@@ -170,7 +117,22 @@ with InvisiblePlaywright(proxy=proxy) as browser:
|
||||
...
|
||||
```
|
||||
|
||||
Schemes supported: `socks5`, `socks4`, `http`, `https`. Auth works on all of them (SOCKS5 via patched `nsProtocolProxyService.cpp`, HTTP/HTTPS via Playwright). DNS is routed through the proxy by default, no local leak.
|
||||
Schemes supported: `socks5`, `socks4`, `http`, `https`. DNS is routed through the proxy by default, no local leak.
|
||||
|
||||
### Timezone
|
||||
|
||||
The browser timezone follows `timezone=`:
|
||||
|
||||
```python
|
||||
# default: timezone is auto-derived from the egress IP (proxy egress if a
|
||||
# proxy is set, otherwise the host's own public IP)
|
||||
with InvisiblePlaywright(proxy=proxy) as browser:
|
||||
...
|
||||
|
||||
# explicit IANA zone always wins, the only way to force a specific zone
|
||||
with InvisiblePlaywright(proxy=proxy, timezone="America/New_York") as browser:
|
||||
...
|
||||
```
|
||||
|
||||
### Pinning specific fingerprint fields
|
||||
|
||||
@@ -196,41 +158,103 @@ Full list of pinnable keys, how pinning interacts with the Bayesian sampler, and
|
||||
|
||||
## CLI
|
||||
|
||||
The installed command is `invisible-playwright`, with a hyphen. `python -m
|
||||
invisible_playwright` works identically and needs nothing on PATH.
|
||||
|
||||
```bash
|
||||
invisible_playwright fetch # download the binary if missing
|
||||
invisible_playwright path # print the absolute path to the cached binary
|
||||
invisible_playwright version # wrapper and binary versions
|
||||
invisible_playwright clear-cache # remove all cached binaries
|
||||
invisible-playwright fetch # download the engine if missing, check every cached
|
||||
# one against the seal, print the path
|
||||
invisible-playwright version # wrapper, core and engine versions, and where the
|
||||
# engine is cached
|
||||
```
|
||||
|
||||
## Known issues
|
||||
## Documentation, guides and comparisons
|
||||
|
||||
### `headless=True` on Windows can cause tab crashes on sites with heavy cross-process navigation
|
||||
All of it reads better, and is searchable, in
|
||||
**[the wiki](https://github.com/feder-cr/invisible_playwright/wiki)**,
|
||||
organised into four sections instead of one flat list:
|
||||
|
||||
Reported as [#18](https://github.com/feder-cr/invisible_playwright/issues/18) (`id.sky.com` and similar). On Windows, `headless=True` runs Firefox headed on a hidden alt-desktop created via `CreateDesktop`. Some sites (id.sky.com, anything else loading Adobe AppMeasurement in a way that triggers cross-process navigation) end up firing `page.on('crash')` after about 10 seconds. The cause is a window-parenting interaction between the alt-desktop and the GPU/content processes; the workaround is one of:
|
||||
- **[Documentation](docs/documentation.md)** -
|
||||
installation, the two-line switch from plain Playwright, proxy/timezone
|
||||
configuration, pinning specific fields, the CLI.
|
||||
- **[Guides](docs/guides.md)** - how
|
||||
detection actually works, in seven groups: browser identity, canvas/WebGL/fonts/
|
||||
audio, network and WebRTC, the automation layer, AI agents, the detectors themselves
|
||||
explained from source, and testing.
|
||||
- **[Comparisons](docs/comparisons.md)** -
|
||||
against Camoufox, Patchright, nodriver and playwright-stealth, and the case for
|
||||
Firefox over Chromium generally.
|
||||
- **[Integrations](docs/integrations/)** -
|
||||
Scrapy, Crawlee, Robot Framework, CodeceptJS, test runners, Playwright MCP, and the
|
||||
frameworks it does not fit, by name.
|
||||
|
||||
```python
|
||||
# Option A — keep the visible window (no alt-desktop)
|
||||
with InvisiblePlaywright(seed=42, headless=False) as browser:
|
||||
...
|
||||
|
||||
# Option B — run inside Xvfb on Linux (alt-desktop bug is Windows-only)
|
||||
```
|
||||
|
||||
The visible window case works on every site we've tested. Linux + Xvfb is unaffected.
|
||||
|
||||
---
|
||||
If you don't know where to start: [Three ways to make Playwright undetected](docs/playwright-stealth-levels.md)
|
||||
is the map most other pages link back to, [Playwright detected as a bot on one site](docs/playwright-detected-as-bot.md)
|
||||
is the troubleshooting order, and [navigator.webdriver is not the tell you think it is](docs/navigator-webdriver-explained.md)
|
||||
explains the most famous property in this space and why patching it alone buys you
|
||||
almost nothing.
|
||||
- [crawl4ai stealth and custom browser engines](docs/crawl4ai-stealth-custom-browser.md) - browser_type accepts firefox but there is no executable_path; where the adapter seam is
|
||||
- [Why headless browsers render different fonts](docs/headless-fonts-differ.md) - the three causes, the per-platform font sets, and why the fix is not installing more fonts
|
||||
- [How to make Linux and macOS report real Windows fonts](docs/bundled-fonts-cross-platform.md) - one manifest, three font backends convinced not to ask the host, and the four seams still open
|
||||
- [measureText and TextMetrics as a fingerprinting surface](docs/measuretext-textmetrics-fingerprinting.md) - ten-plus numbers from one call needing no permission prompt, and the two mistakes we made fixing it
|
||||
- [What privacy.resistFingerprinting really does](docs/resist-fingerprinting.md) - and why this project sets it to false on purpose
|
||||
- [The ChromeDriver cdc_ variable](docs/cdc-variable-explained.md) - why renaming it is not removing it, and what that generalises to
|
||||
- [What bot.sannysoft.com actually checks](docs/sannysoft-explained.md) - row by row, and the canvas-in-iframe test nobody reads
|
||||
- [How CreepJS decides you are lying](docs/creepjs-explained.md) - four detection techniques, and why blocking the probe is itself recorded
|
||||
- [Firefox preferences that silently do nothing](docs/firefox-prefs-not-applying.md) - five reasons, starting with the one that cost us a real bug
|
||||
- [What BotD actually detects](docs/botd-explained.md) - twenty detectors, and why most are not about bots at all
|
||||
- [Why a FingerprintJS visitor ID changes](docs/fingerprintjs-visitor-id.md) - it is a hash of 41 components, so one moving moves all of it
|
||||
|
||||
## Related projects
|
||||
|
||||
invisible_playwright takes a different angle than the major Firefox-hardening projects but stands on their shoulders:
|
||||
The open-source neighbours, and what each one is for.
|
||||
|
||||
- **[arkenfox/user.js](https://github.com/arkenfox/user.js)** - the canonical Firefox configuration for privacy/security hardening via prefs. Reading arkenfox is how you understand which `user.js` knobs matter; invisible_playwright goes further by patching the C++ source where prefs alone are insufficient (Canvas noise, WebGL parameter overrides, font whitelisting, WebRTC IP swap, DevTools detection bypass).
|
||||
- **[LibreWolf](https://librewolf.net)** - a Firefox fork bundled with sensible privacy defaults. Same audience, different distribution model: LibreWolf ships a configured Firefox binary, invisible_playwright ships source patches + a wrapper for automation.
|
||||
- **[Camoufox](https://github.com/daijro/camoufox)** - the most well-known open-source anti-detect Firefox project. We share design goals on the fingerprint-spoofing side; the implementation approach differs (Camoufox patches a wider surface and ships its own fingerprint database, while invisible_playwright sticks closer to vanilla and drives spoofing from a Bayesian sampler).
|
||||
**On the Firefox side**
|
||||
|
||||
- **[Camoufox](https://github.com/daijro/camoufox)** - an anti-detect Firefox that also patches at the C++ level. It covers a wider surface and ships its own fingerprint database; this project derives a fingerprint from a seed with a Bayesian sampler, so one number reproduces one machine. [Full comparison](docs/vs-camoufox.md).
|
||||
- **[LibreWolf](https://librewolf.net)** - a Firefox fork with privacy defaults. It ships a configured binary for people to browse with; this ships source patches plus an automation wrapper.
|
||||
- **[arkenfox/user.js](https://github.com/arkenfox/user.js)** - Firefox hardening through preferences. Where a preference is enough, use it; this project patches C++ where one is not.
|
||||
|
||||
**On the Chromium side**
|
||||
|
||||
- **[Patchright](https://github.com/Kaliiiiiiiiii-Vinyzu/patchright)** - a patched Playwright fork, so the stealth work lands in the driver rather than in the browser binary. [Full comparison](docs/vs-patchright.md).
|
||||
- **[nodriver](https://github.com/ultrafunkamsterdam/nodriver)** - the successor to `undetected-chromedriver`, driving Chrome over CDP directly and removing the WebDriver-flavoured tells. [Full comparison](docs/vs-nodriver.md).
|
||||
- **[playwright-stealth](https://github.com/Mattwmaster58/playwright_stealth)** - an init-script patch applied before the page loads. Its own maintainer calls it a proof-of-concept; [full comparison](docs/vs-playwright-stealth.md).
|
||||
- **[puppeteer-extra-plugin-stealth](https://github.com/berstend/puppeteer-extra)** - the original of this init-script lineage, still widely recommended. Its repository's last substantive commit is from mid-2024; [what that means in practice](docs/puppeteer-extra-stealth-unmaintained.md).
|
||||
- **[selenium-stealth](https://github.com/diprajpatra/selenium-stealth)** - the same approach on Selenium/CDP. Its repository's last commit is from December 2021; [what that means in practice](docs/selenium-stealth-unmaintained.md).
|
||||
- **[pyppeteer](https://github.com/pyppeteer/pyppeteer)** - the unofficial Python port of Puppeteer. Its own README says it's unmaintained and points to `playwright-python` instead; [what that recommendation is actually about](docs/pyppeteer-unmaintained-playwright.md).
|
||||
- **[rebrowser-patches](https://github.com/rebrowser/rebrowser-patches)** - fixes the `Runtime.enable` CDP leak on Chromium, independently converging on close to the same fix Patchright uses. [Full comparison](docs/vs-rebrowser-patches.md).
|
||||
- **[fingerprint-suite](https://github.com/apify/fingerprint-suite)** - generates a coherent fingerprint with a Bayesian network, close to this project's own generation approach, then injects it into a Playwright or Puppeteer page on either Chromium or Firefox. [Full comparison](docs/vs-fingerprint-suite.md).
|
||||
- **[playwright-with-fingerprints](https://github.com/bablosoft/playwright-with-fingerprints)** - injects fingerprint values sourced from a remote paid service, Windows-only, pinned to a specific Chromium build. [Full comparison](docs/vs-playwright-with-fingerprints.md).
|
||||
|
||||
Which of these fits depends on the layer your problem is at, and on whether you need Firefox or Chromium. [Three ways to make Playwright undetected](docs/playwright-stealth-levels.md) works through what each layer can and cannot reach, including what this one costs.
|
||||
|
||||
If you are picking between engines rather than tools, note that a large share of AI agent frameworks drive Chromium over CDP, which decides the question for you: [AI browser agents and stealth](docs/ai-browser-agents-stealth.md).
|
||||
|
||||
---
|
||||
|
||||
## License
|
||||
|
||||
MIT - see [LICENSE](LICENSE). The patched Firefox binary is distributed under the MPL-2.0 (Firefox upstream license). The C++ patches against mozilla-central that produce that binary are at [feder-cr/invisible-firefox](https://github.com/feder-cr/invisible-firefox).
|
||||
MIT - see [LICENSE](https://github.com/feder-cr/invisible_playwright/blob/main/LICENSE). The patched Firefox binary is distributed under the MPL-2.0 (Firefox upstream license). The C++ patches against mozilla-central that produce that binary are at [feder-cr/firefox_antidetect_patch](https://github.com/feder-cr/firefox_antidetect_patch).
|
||||
|
||||
---
|
||||
|
||||
## Disclaimer
|
||||
|
||||
This project is for educational purposes only. It is provided as-is, with no warranties. I take no responsibility for how it is used. Use it at your own risk and in compliance with the laws of your jurisdiction.
|
||||
|
||||
---
|
||||
|
||||
<p align="center">
|
||||
Built by <a href="https://it.linkedin.com/in/federico-elia-5199951b6">Federico Elia</a>
|
||||
<a href="https://it.linkedin.com/in/federico-elia-5199951b6"><img src="https://raw.githubusercontent.com/feder-cr/invisible_playwright/main/docs/badges/linkedin.svg" alt="LinkedIn"></a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/feder-cr/invisible_playwright/actions/workflows/tests.yml"><img src="https://github.com/feder-cr/invisible_playwright/actions/workflows/tests.yml/badge.svg" alt="tests"></a>
|
||||
<a href="https://github.com/feder-cr/invisible_playwright/blob/main/LICENSE"><img src="https://raw.githubusercontent.com/feder-cr/invisible_playwright/main/docs/badges/license.svg" alt="License: MIT"></a>
|
||||
<a href="https://www.python.org/downloads/"><img src="https://raw.githubusercontent.com/feder-cr/invisible_playwright/main/docs/badges/python.svg" alt="Python 3.11+"></a>
|
||||
<a href="https://github.com/feder-cr/firefox_antidetect_patch/releases"><img src="https://raw.githubusercontent.com/feder-cr/invisible_playwright/main/docs/badges/firefox.svg" alt="Firefox 151.0"></a>
|
||||
<a href="https://github.com/feder-cr/invisible_playwright/stargazers"><img src="https://raw.githubusercontent.com/feder-cr/invisible_playwright/main/docs/badges/stars.svg" alt="GitHub stars"></a>
|
||||
<a href="https://github.com/feder-cr/invisible_firefox/releases/tag/usage-counter"><img src="https://raw.githubusercontent.com/feder-cr/invisible_playwright/main/docs/badges/launches.svg" alt="browser launches"></a>
|
||||
</p>
|
||||
@@ -1,8 +1,12 @@
|
||||
# Security Policy
|
||||
|
||||
## Disclaimer
|
||||
|
||||
This is an educational project. It is provided as-is, with no warranties. The maintainers take no responsibility for how it is used. Use it at your own risk and in compliance with the laws of your jurisdiction.
|
||||
|
||||
## Supported versions
|
||||
|
||||
Only the latest release on `main` receives security fixes.
|
||||
Only the latest release on `main` receives fixes.
|
||||
|
||||
| Version | Supported |
|
||||
|---------|-----------|
|
||||
@@ -11,44 +15,33 @@ Only the latest release on `main` receives security fixes.
|
||||
|
||||
## Reporting a vulnerability
|
||||
|
||||
**Please do not report security issues via public GitHub issues, discussions, or pull requests.**
|
||||
Do not report security issues via public GitHub issues, discussions, or pull requests.
|
||||
|
||||
Use one of the following private channels:
|
||||
Send a report to `federico.elia.majo@gmail.com` with subject prefix `[security][invisible_playwright]`.
|
||||
|
||||
1. **GitHub Private Vulnerability Reporting** (preferred): open an advisory at https://github.com/feder-cr/invisible_playwright/security/advisories/new
|
||||
2. **Email**: `federico.elia.majo@gmail.com` with subject prefix `[security][invisible_playwright]`
|
||||
Include:
|
||||
|
||||
Please include:
|
||||
|
||||
- A clear description of the issue and impact
|
||||
- Steps to reproduce (minimal repro preferred)
|
||||
- The version of `invisible_playwright` and OS where it was observed
|
||||
- Whether you have a suggested fix
|
||||
|
||||
## What to expect
|
||||
|
||||
- Acknowledgement of your report within **7 days**
|
||||
- An initial assessment and tracking issue (private) within **14 days**
|
||||
- Coordinated disclosure: a fix and public advisory are released together; reporters are credited unless they prefer to remain anonymous
|
||||
- What the issue is and what it affects
|
||||
- Steps to reproduce
|
||||
- Version of `invisible_playwright` and OS
|
||||
- Fix suggestion if you have one
|
||||
|
||||
## Scope
|
||||
|
||||
In scope:
|
||||
|
||||
- The Python wrapper `invisible_playwright` (this repo)
|
||||
- The binary download/verification flow (SHA256 pinning, fetch endpoints)
|
||||
- The Python wrapper (this repo)
|
||||
- The binary download and verification flow
|
||||
- The CLI
|
||||
|
||||
Out of scope here (report to the relevant project):
|
||||
Out of scope:
|
||||
|
||||
- Vulnerabilities in the patched Firefox C++ source — open a private report at [feder-cr/invisible-firefox](https://github.com/feder-cr/invisible-firefox/security/advisories/new)
|
||||
- Vulnerabilities in upstream Firefox / mozilla-central — report to Mozilla per https://www.mozilla.org/security/
|
||||
- Vulnerabilities in third-party dependencies (`playwright`, `requests`, etc.) — report to those projects directly
|
||||
- Vulnerabilities in the patched Firefox source - report to [feder-cr/firefox_antidetect_patch](https://github.com/feder-cr/firefox_antidetect_patch/security/advisories/new)
|
||||
- Upstream Firefox / mozilla-central - report to Mozilla directly
|
||||
- Third-party dependencies - report to those projects
|
||||
|
||||
## Out of scope
|
||||
Not security issues:
|
||||
|
||||
- Reports that the browser is detected by a specific anti-bot service — open a regular GitHub issue, this is a product-quality concern, not a security one
|
||||
- Social engineering of maintainers
|
||||
- Denial of service requiring physical access or local privileged access
|
||||
|
||||
Thank you for helping keep the project and its users safe.
|
||||
- The browser being detected by an anti-bot service - open a regular issue
|
||||
- Social engineering
|
||||
- DoS requiring physical or local privileged access
|
||||
@@ -0,0 +1,107 @@
|
||||
day_utc,launches
|
||||
2026-08-06,43902
|
||||
2026-08-07,47483
|
||||
2026-08-08,68985
|
||||
2026-08-09,75299
|
||||
2026-08-10,79120
|
||||
2026-08-11,82291
|
||||
2026-08-12,80847
|
||||
2026-08-13,57613
|
||||
2026-08-14,117227
|
||||
2026-08-15,90144
|
||||
2026-08-16,89517
|
||||
2026-08-20,48
|
||||
2026-08-21,72
|
||||
2026-08-22,95
|
||||
2026-08-23,144
|
||||
2026-08-24,243
|
||||
2026-08-25,118
|
||||
2026-08-26,16
|
||||
2026-08-27,754
|
||||
2026-08-28,2617
|
||||
2026-08-29,3373
|
||||
2026-08-30,4837
|
||||
2026-08-31,7659
|
||||
2026-09-01,20643
|
||||
2026-09-02,20388
|
||||
2026-09-03,20897
|
||||
2026-09-04,24253
|
||||
2026-09-05,17769
|
||||
2026-09-06,30024
|
||||
2026-09-07,30598
|
||||
2026-09-08,30627
|
||||
2026-09-09,33608
|
||||
2026-09-10,32708
|
||||
2026-09-11,36429
|
||||
2026-09-12,20820
|
||||
2026-09-13,21215
|
||||
2026-09-14,22865
|
||||
2026-09-15,20973
|
||||
2026-09-16,23391
|
||||
2026-09-17,22358
|
||||
2026-09-18,21594
|
||||
2026-09-19,21910
|
||||
2026-09-20,21781
|
||||
2026-09-21,22973
|
||||
2026-09-22,26919
|
||||
2026-09-23,25595
|
||||
2026-09-24,23369
|
||||
2026-09-25,28670
|
||||
2026-09-26,19867
|
||||
2026-09-29,27963
|
||||
2026-09-30,27972
|
||||
2026-10-01,27639
|
||||
2026-10-02,28570
|
||||
2026-10-03,26792
|
||||
2026-10-04,28722
|
||||
2026-10-05,30100
|
||||
2026-10-06,29412
|
||||
2026-10-07,28235
|
||||
2026-10-08,33668
|
||||
2026-10-09,37187
|
||||
2026-10-10,39522
|
||||
2026-10-11,40271
|
||||
2026-10-12,43620
|
||||
2026-10-13,53059
|
||||
2026-10-14,51631
|
||||
2026-10-15,53094
|
||||
2026-10-16,53945
|
||||
2026-10-17,53686
|
||||
2026-10-18,55090
|
||||
2026-10-19,59207
|
||||
2026-10-20,61199
|
||||
2026-10-21,60832
|
||||
2026-10-22,63064
|
||||
2026-10-23,61741
|
||||
2026-10-24,61546
|
||||
2026-10-25,123954
|
||||
2026-10-26,63404
|
||||
2026-10-27,61405
|
||||
2026-10-28,63297
|
||||
2026-10-29,62917
|
||||
2026-10-30,62435
|
||||
2026-10-31,61738
|
||||
2026-11-01,64895
|
||||
2026-11-08,105447
|
||||
2026-11-09,129333
|
||||
2026-11-10,123111
|
||||
2026-11-11,134869
|
||||
2026-11-12,130378
|
||||
2026-11-13,132793
|
||||
2026-11-14,126169
|
||||
2026-11-15,127694
|
||||
2026-11-16,136873
|
||||
2026-11-17,128657
|
||||
2026-11-18,132390
|
||||
2026-11-19,132299
|
||||
2026-11-20,133197
|
||||
2026-11-21,132589
|
||||
2026-11-22,139563
|
||||
2026-11-23,158681
|
||||
2026-11-24,137658
|
||||
2026-11-25,142632
|
||||
2026-11-26,146716
|
||||
2026-11-29,145865
|
||||
2026-11-30,180952
|
||||
2026-12-01,169518
|
||||
2026-12-04,173851
|
||||
|
@@ -0,0 +1,15 @@
|
||||
---
|
||||
title: "docs/ source folder"
|
||||
description: "This folder is the Jekyll source for the published documentation site. Read it there, with search and proper navigation, not as raw files."
|
||||
nav_exclude: true
|
||||
search_exclude: true
|
||||
sitemap: false
|
||||
---
|
||||
|
||||
# docs/ source folder
|
||||
|
||||
This folder is the source the wiki is rendered from. Read it with search and
|
||||
navigation in **[the wiki](https://github.com/feder-cr/invisible_playwright/wiki)**.
|
||||
|
||||
`index.md` is what the site root actually serves. This file exists so the folder
|
||||
still shows something sensible when browsed directly on github.com.
|
||||
@@ -0,0 +1,270 @@
|
||||
---
|
||||
title: "about:webrtc: read your real ICE candidates"
|
||||
description: "Read your live ICE candidates in Firefox's built-in about:webrtc: tell a real LAN-IP leak from a masked .local host and a proxy-egress srflx line."
|
||||
parent: "Network, Proxy and WebRTC"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 17
|
||||
---
|
||||
|
||||
|
||||
# about:webrtc: read your real ICE candidates
|
||||
|
||||
A public leak site gives you a verdict and a couple of IP strings. Firefox ships a
|
||||
page that gives you the raw material behind that verdict: every
|
||||
[ICE candidate](https://datatracker.ietf.org/doc/html/rfc8445) the
|
||||
browser gathered, its type, its address, its priority, and the timeline of when each
|
||||
one arrived. It is `about:webrtc`, it is built in, it needs no extension, and it is
|
||||
the first place to look after any change to a WebRTC or proxy setting.
|
||||
|
||||
This page is how to read it, what the three interesting candidate states look like
|
||||
line by line, how to pair it with `about:config`, and how to reproduce the same read
|
||||
from a Playwright script so a bad candidate fails a test instead of a real session.
|
||||
|
||||
## Why a leak site is not enough
|
||||
|
||||
A leak site aggregates. It runs the gathering for you, picks the addresses it thinks
|
||||
matter, and prints something like "Local IP" and "Public IP" with a green or red
|
||||
badge. That summary hides exactly the distinctions you need while debugging, because
|
||||
three very different underlying states can round to the same badge:
|
||||
|
||||
- A host candidate carrying a raw `192.168.x.x` LAN address. This is a real leak, and
|
||||
it is *worse* than a stock browser, which hides that address by default.
|
||||
- A host candidate carrying an obfuscated `<uuid>.local` name. This is the correct
|
||||
state, and it is what a stock Firefox produces.
|
||||
- A server-reflexive (`srflx`) candidate whose address is your proxy egress, with a
|
||||
plausible NAT port and a priority in the range a real candidate uses.
|
||||
|
||||
A "No Leak" badge can be produced by the second and third states working correctly,
|
||||
and it can also be produced by WebRTC being suppressed to the point that nothing is
|
||||
gathered at all, which is [its own detectable signal](webrtc-leak-proxy.md). The
|
||||
badge does not tell you which. The candidate list does.
|
||||
|
||||
## Opening about:webrtc and reading a session
|
||||
|
||||
Type `about:webrtc` into the address bar. The page is empty until a peer connection
|
||||
exists, so open a page that creates one first, then come back to it. Each connection
|
||||
gets a collapsible block; expand it and the two things worth reading are:
|
||||
|
||||
- **ICE Stats / the candidate table.** Every gathered candidate with its type
|
||||
(`host`, `srflx`, `relay`), its address, its port, its protocol and its priority.
|
||||
- **The ICE gathering log / timeline.** Timestamped lines showing when gathering
|
||||
started, when each candidate was added, and when it finished. A candidate that
|
||||
arrives suspiciously early (time zero, no round trip) is as much a tell as a wrong
|
||||
address, and the timeline is the only view that shows arrival time.
|
||||
|
||||
You are reading for three things: that a host candidate exists and is masked, that a
|
||||
server-reflexive candidate exists and points at the exit you expect, and that the
|
||||
timeline looks like a browser talking to a STUN server rather than fabricating an
|
||||
answer instantly.
|
||||
|
||||
## The three states a leak site collapses into one
|
||||
|
||||
Three candidate states, plus a suppressed section that gathers nothing, all round to
|
||||
the same one-word leak-site badge. The table below is how each reads in the candidate
|
||||
list; the lines underneath show the exact shape of each one.
|
||||
|
||||
| State | Candidate line | Leak-site badge | Verdict |
|
||||
|---|---|---|---|
|
||||
| Leak | `typ host` with a raw `192.168.x.x` LAN address | "Local IP" / red warning | Real leak, worse than stock |
|
||||
| Correct host | `typ host` with a `<uuid>.local` name | "No Leak", local IP shown as "-" | Shipped, correct |
|
||||
| Correct srflx | `typ srflx` with your proxy egress address | contributes to "No Leak" | Correct exit |
|
||||
| Suppressed | nothing gathered at all | "No Leak" | Detectable tell, a FAIL |
|
||||
|
||||
Here is what each state looks like as a candidate line, so you can recognise it on
|
||||
sight in the table.
|
||||
|
||||
**Leak (worst case).** The host candidate carries the machine's real LAN address:
|
||||
|
||||
```text
|
||||
candidate:0 1 UDP 2122252543 192.168.1.24 51894 typ host
|
||||
```
|
||||
|
||||
If you see a private `192.168.x.x`, `10.x.x.x` or `172.16-31.x.x` address on a `typ
|
||||
host` line, WebRTC is handing out your internal network address. A stock browser does
|
||||
not do this; it masks it. Seeing it means a masking setting is off, and you are now
|
||||
more identifiable than a default install.
|
||||
|
||||
**Correct host.** The same candidate with the address replaced by a per-session mDNS
|
||||
name:
|
||||
|
||||
```text
|
||||
candidate:0 1 UDP 2122252543 3f1c9a7e-....local 51894 typ host
|
||||
```
|
||||
|
||||
The `.local` name is what a stock Firefox emits by default, and a leak site reads it
|
||||
as "No Leak" with the local IP shown as "-". This is the shipped state here: the
|
||||
patched engine keeps host-address obfuscation on, so the host line is a `.local` name
|
||||
and never a raw LAN IP.
|
||||
|
||||
**Correct srflx.** The server-reflexive candidate carries your public exit and a NAT
|
||||
port:
|
||||
|
||||
```text
|
||||
candidate:1 1 UDP 1686052863 203.0.113.45 49731 typ srflx raddr 0.0.0.0 rport 0
|
||||
```
|
||||
|
||||
Behind a proxy, that address must be the proxy egress, not your real public IP and not
|
||||
a private address. The port should sit in the ephemeral NAT range and the priority
|
||||
should look like a real `srflx` priority rather than a round, hand-picked number.
|
||||
Getting the [priority and foundation right, not just the address](webrtc-ice-candidate-spoofing.md),
|
||||
is what separates a candidate that survives inspection from one that only survives a
|
||||
leak badge.
|
||||
|
||||
## Pairing it with about:config
|
||||
|
||||
`about:webrtc` shows you the result; `about:config` shows you the switches that
|
||||
produced it. Open a second tab on `about:config` and filter on two prefixes.
|
||||
|
||||
- **`media.peerconnection.*`** are the standard Firefox WebRTC prefs. The one that
|
||||
governs the host state above is `media.peerconnection.ice.obfuscate_host_addresses`:
|
||||
`true` gives you the `.local` name, `false` gives you the raw LAN IP. If
|
||||
`about:webrtc` shows a `192.168.x.x` host, this is the first pref to check.
|
||||
- **`zoom.stealth.webrtc.*`** is where the product exposes its own WebRTC controls,
|
||||
including the egress the synthetic `srflx` is built from and the IPv6 host
|
||||
suppression. These are set per session by the launcher from the proxy you pass, so
|
||||
in normal use you read them here to confirm the wrapper resolved the right exit,
|
||||
rather than editing them by hand.
|
||||
|
||||
The workflow is: change one pref, reload the page that builds the connection, refresh
|
||||
`about:webrtc`, and read the candidate that changed. One switch at a time keeps cause
|
||||
and effect legible, which is the same discipline that makes a bisect a bisect.
|
||||
|
||||
## Driving the same session from Playwright
|
||||
|
||||
The manual read is for exploring. Once you know which candidate line matters, you want
|
||||
it as an assertion that runs every session, and `InvisiblePlaywright` returns a real
|
||||
Playwright `Browser`, so the same code that opens `about:webrtc` can also gather
|
||||
candidates programmatically.
|
||||
|
||||
First, opening the built-in page under a seeded, proxied session so you can eyeball it:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
PROXY = {"server": "socks5://gate.example.com:1080", "username": "u", "password": "p"}
|
||||
|
||||
with InvisiblePlaywright(seed=42, proxy=PROXY) as browser:
|
||||
page = browser.new_page()
|
||||
# A peer connection has to exist before about:webrtc has anything to show.
|
||||
page.goto("https://example.com")
|
||||
page.evaluate("new RTCPeerConnection().createDataChannel('x')")
|
||||
|
||||
inspector = browser.new_page()
|
||||
inspector.goto("about:webrtc")
|
||||
print("Expand the session to read candidates + the gathering timeline")
|
||||
inspector.wait_for_timeout(3000)
|
||||
```
|
||||
|
||||
Then the same read as data, so a wrong candidate fails a check instead of a session.
|
||||
This gathers the candidate strings the page itself would list and prints them:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
PROXY = {"server": "socks5://gate.example.com:1080", "username": "u", "password": "p"}
|
||||
|
||||
GATHER = """
|
||||
async () => {
|
||||
const pc = new RTCPeerConnection();
|
||||
pc.createDataChannel("probe");
|
||||
const lines = [];
|
||||
pc.onicecandidate = (e) => { if (e.candidate) lines.push(e.candidate.candidate); };
|
||||
await pc.setLocalDescription(await pc.createOffer());
|
||||
await new Promise((r) => setTimeout(r, 3000));
|
||||
pc.close();
|
||||
return lines;
|
||||
}
|
||||
"""
|
||||
|
||||
with InvisiblePlaywright(seed=42, proxy=PROXY) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
candidates = page.evaluate(GATHER)
|
||||
|
||||
host = [c for c in candidates if "typ host" in c]
|
||||
srflx = [c for c in candidates if "typ srflx" in c]
|
||||
|
||||
for c in candidates:
|
||||
print(c)
|
||||
|
||||
# Assert the positive shape, not the absence of a leak.
|
||||
assert host and all(".local" in c for c in host), "host must be an mDNS .local name"
|
||||
assert srflx, "a proxied session must still produce a server-reflexive candidate"
|
||||
assert not any(
|
||||
p in c for c in host for p in ("192.168.", "10.", "172.16.")
|
||||
), "no raw LAN address on a host line"
|
||||
```
|
||||
|
||||
Because the identity is seed-derived, `seed=42` gives the same session every run, so a
|
||||
candidate that fails this on one run fails it on the next, and you can [replay the
|
||||
exact browser that produced it](quickstart.md) instead of chasing a random draw.
|
||||
|
||||
## A before-and-after you can measure
|
||||
|
||||
The distinction is not theoretical. With host obfuscation off, a leak page reports the
|
||||
host candidate as the real LAN address and shows the red "WebRTC exposes your Local IP"
|
||||
warning; the same page on the shipped baseline reports "No Leak" with the local IP as
|
||||
"-", because the host line is now a `<uuid>.local` name and the only routable address
|
||||
on the page is the proxy egress on the `srflx` line. Same session, one pref, and the
|
||||
difference is the whole point of reading candidates instead of badges.
|
||||
|
||||
Assert the presence of the right candidate, not the absence of a wrong one. A WebRTC
|
||||
section that comes back empty passes every "no leak" test and is itself a signal, which
|
||||
is the same false pass that a [verdict-based test hides and a field comparison
|
||||
catches](how-to-test-bot-detection.md).
|
||||
|
||||
## Conclusion
|
||||
|
||||
`about:webrtc` turns WebRTC from a badge into a list you can read. It shows the host
|
||||
candidate so you can confirm it is a `.local` name and not a raw LAN IP, the
|
||||
server-reflexive candidate so you can confirm it is your proxy egress with a plausible
|
||||
port and priority, and the gathering timeline so you can confirm the answers arrived
|
||||
the way a browser produces them rather than instantly. Pair it with `about:config` to
|
||||
see the switches behind each line, drive the same read from Playwright to make it a
|
||||
test, and change one pref at a time so every difference has a cause.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**What is about:webrtc for?** It is Firefox's built-in inspector for live peer
|
||||
connections: the full ICE candidate list, each candidate's type and address and
|
||||
priority, and the gathering timeline. It shows the detail a leak site summarises away.
|
||||
|
||||
**Why is my host candidate a 192.168 address?** Host-address obfuscation is off. A
|
||||
stock Firefox emits a `<uuid>.local` name instead, and a raw LAN address is a real
|
||||
leak. Check `media.peerconnection.ice.obfuscate_host_addresses` in `about:config`.
|
||||
|
||||
**What should the srflx candidate show behind a proxy?** Your proxy egress address,
|
||||
with a NAT-range port and a realistic priority. Not your real public IP, not a private
|
||||
address, and not a suspiciously round priority value.
|
||||
|
||||
**A leak site says "No Leak" but I still get flagged. Why?** "No Leak" can mean the
|
||||
candidates are correct, or it can mean WebRTC was suppressed and gathered nothing,
|
||||
which is itself detectable. The candidate list tells you which; the badge does not.
|
||||
|
||||
**Can I read about:webrtc from Playwright?** You can navigate to it with `page.goto`,
|
||||
and you can gather the same candidate strings programmatically with `page.evaluate`
|
||||
over a real [`RTCPeerConnection`](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection),
|
||||
which turns the manual read into an assertion.
|
||||
|
||||
**Why does an empty WebRTC section count as a failure?** Because a real browser behind
|
||||
NAT always emits at least a host and a server-reflexive candidate. Emitting nothing is
|
||||
not neutral; it is a shape no ordinary browser has, so assert presence, not absence.
|
||||
|
||||
## Sources
|
||||
|
||||
- Firefox's built-in `about:webrtc` and `about:config` pages, read directly rather
|
||||
than through a third-party summary.
|
||||
- This project's WebRTC release gates and their per-event diagnostics, including the
|
||||
incident where a negative-only check passed a fully blocked WebRTC section behind a
|
||||
proxy, and the host-obfuscation fix that moved the host line from a raw LAN IP to a
|
||||
`.local` name.
|
||||
|
||||
**See also:** [what actually leaks through a proxy](webrtc-leak-proxy.md),
|
||||
[the srflx fields beyond the address](webrtc-ice-candidate-spoofing.md), and
|
||||
[everything that has to agree with your exit IP](timezone-proxy-mismatch.md).
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. Every candidate line in
|
||||
this page is one I have read off about:webrtc while chasing a leak that a badge missed.*
|
||||
@@ -0,0 +1,233 @@
|
||||
---
|
||||
title: "Do accelerometer and gyroscope APIs leak on desktop?"
|
||||
description: "Desktop Firefox doesn't leak sensor data. Why a spoofed desktop must never invent motion events, and how to verify the sensor surface matches your platform claim."
|
||||
parent: "Browser Identity"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 32
|
||||
---
|
||||
|
||||
|
||||
# Do accelerometer and gyroscope APIs leak on desktop?
|
||||
|
||||
Short version: on a real desktop Firefox they do not leak, because there is
|
||||
nothing to leak. The generic Sensor APIs that expose an accelerometer or a
|
||||
gyroscope reading are a Chromium feature, and the older DeviceOrientation and
|
||||
DeviceMotion events stay silent on a machine with no motion hardware. So the
|
||||
interesting question is not "how do I hide my sensors" - it is "am I sure my
|
||||
automated desktop is not inventing motion data a real desktop would never
|
||||
produce". A desktop that emits accelerometer or gyroscope readings is a
|
||||
mobile-or-fake tell, and it contradicts the platform string sitting right next
|
||||
to it.
|
||||
|
||||
This page walks through what a genuine desktop exposes, why faking motion is a
|
||||
consistency failure rather than a clever disguise, what the patched build
|
||||
reports, and how to check the surface yourself.
|
||||
|
||||
## What desktop Firefox actually exposes
|
||||
|
||||
Desktop Firefox exposes almost nothing on this surface: the generic Sensor
|
||||
API is absent entirely, and the older DeviceMotion/DeviceOrientation events
|
||||
exist as properties but never fire without motion hardware. Those are the two
|
||||
separate families of device-motion API, and they behave very differently
|
||||
across engines.
|
||||
|
||||
The **generic Sensor APIs** - [`Accelerometer`](https://developer.mozilla.org/en-US/docs/Web/API/Accelerometer),
|
||||
[`Gyroscope`](https://developer.mozilla.org/en-US/docs/Web/API/Gyroscope),
|
||||
`LinearAccelerationSensor`, `AbsoluteOrientationSensor` and the rest of that
|
||||
family - are implemented in Chromium and, at time of writing, not in Firefox at
|
||||
all. On a real Firefox, `typeof Accelerometer` is `"undefined"`. A page that
|
||||
tries `new Gyroscope()` gets a `ReferenceError`. This is not a stealth trick;
|
||||
it is simply what the engine ships.
|
||||
|
||||
The **[DeviceOrientation and DeviceMotion](https://developer.mozilla.org/en-US/docs/Web/API/DeviceMotionEvent) events** - `window.ondeviceorientation`,
|
||||
`window.ondevicemotion` - do exist as properties in Firefox, because they are
|
||||
part of an older, more widely shipped spec. But existing as a property is not
|
||||
the same as firing. On a desktop with no accelerometer and no gyroscope, you can
|
||||
add a `devicemotion` listener and it will never be called. The event surface is
|
||||
present; the data behind it is silent.
|
||||
|
||||
So a truthful desktop Firefox answers the sensor question three ways at once:
|
||||
the generic Sensor constructors are absent, the motion event handlers exist but
|
||||
never fire, and `DeviceMotionEvent.requestPermission` (the iOS gesture gate) is
|
||||
also absent because it is a mobile Safari construct. All three of those agree
|
||||
with each other and with a `navigator.platform` of `Win32`.
|
||||
|
||||
## Why a desktop that emits motion is a tell
|
||||
|
||||
The failure mode here is not "a detector reads your accelerometer". It is a
|
||||
detector noticing that your accelerometer exists at all when your platform says
|
||||
it should not.
|
||||
|
||||
Detection on this surface is a cross-check, the same shape as every other
|
||||
consistency check. A page reads `navigator.platform`, `navigator.userAgent` and
|
||||
`navigator.oscpu`, decides you are claiming a Windows desktop, and then asks a
|
||||
question a Windows desktop has a known answer to: does `window.DeviceMotionEvent`
|
||||
ever produce a non-null reading? A desktop says no. If yours says yes - if some
|
||||
well-meaning spoof layer decided to synthesize plausible-looking motion so the
|
||||
sensor "would not look dead" - you have just told the page you are a phone
|
||||
wearing a desktop user agent, which is a contradiction no real device produces.
|
||||
|
||||
This is why the honest move is silence, not simulation. The instinct to fill
|
||||
every surface with realistic data is exactly wrong here: on a desktop the
|
||||
realistic data is no data. The values that have to agree are your platform, your
|
||||
oscpu, your touch surface and your motion surface, and they agree by all
|
||||
pointing at the same kind of machine. If you want the platform side of that
|
||||
in depth, see
|
||||
[keeping navigator.platform and oscpu consistent](navigator-platform-oscpu-consistency.md);
|
||||
the closely related touch side, where a desktop must report zero touch points,
|
||||
is in [maxTouchPoints and pointer type](navigator-maxtouchpoints-pointer.md).
|
||||
|
||||
The general rule, which shows up on every fingerprint surface: a suppressed or
|
||||
absent signal is not automatically a red flag. It is a red flag only when it
|
||||
disagrees with what you claim to be. A desktop with no motion sensor is
|
||||
correct. A mobile user agent with no motion sensor is the tell.
|
||||
|
||||
## What the patched build reports
|
||||
|
||||
invisible_playwright is a real Firefox patched at the C++ level and driven by
|
||||
stock Playwright. On the sensor surface its job is the easy kind: report exactly
|
||||
what a real Windows Firefox reports, which is silence. The generic Sensor
|
||||
constructors stay absent, the DeviceMotion and DeviceOrientation handlers exist
|
||||
but never fire, and nothing invents a reading to fill the gap. Because the whole
|
||||
identity is seed-derived, the platform string, the oscpu string, the touch
|
||||
surface and this motion surface all come from one coherent machine rather than
|
||||
from four independent guesses, so they agree by construction.
|
||||
|
||||
That is the point of the demonstration below. There is nothing to configure and
|
||||
no sensor flag to set - the correct desktop behaviour is the default, and the
|
||||
launch is the ordinary two lines.
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
|
||||
report = page.evaluate("""() => {
|
||||
const motionFired = [];
|
||||
window.addEventListener('devicemotion', e => motionFired.push(e), { once: true });
|
||||
return {
|
||||
platform: navigator.platform,
|
||||
hasAccelerometerCtor: typeof Accelerometer !== 'undefined',
|
||||
hasGyroscopeCtor: typeof Gyroscope !== 'undefined',
|
||||
hasDeviceMotionEvent: 'DeviceMotionEvent' in window,
|
||||
hasRequestPermission:
|
||||
typeof (window.DeviceMotionEvent || {}).requestPermission === 'function',
|
||||
motionEventsSeen: motionFired.length,
|
||||
};
|
||||
}""")
|
||||
|
||||
print(report)
|
||||
# platform: 'Win32'
|
||||
# hasAccelerometerCtor: False <- generic Sensor API is Chromium-only
|
||||
# hasGyroscopeCtor: False
|
||||
# hasDeviceMotionEvent: True <- handler exists...
|
||||
# hasRequestPermission: False <- iOS-only, correctly absent
|
||||
# motionEventsSeen: 0 <- ...but never fires: no motion hardware
|
||||
```
|
||||
|
||||
Pass the same `seed` and the surrounding identity comes back identical every
|
||||
run, so if you are bisecting a block you are changing one thing at a time rather
|
||||
than chasing a fresh random machine on each attempt.
|
||||
|
||||
## Verify it yourself against a stock browser
|
||||
|
||||
Do not take the output above on faith - the useful test is a diff, not a
|
||||
verdict. Open the same probe in a stock desktop Firefox on the same machine and
|
||||
compare field by field. The two should agree on every line: same absent
|
||||
constructors, same present-but-silent event handlers, same zero motion events.
|
||||
Anything that differs between the automated browser and the stock one, other
|
||||
than the exit address, is a candidate worth explaining.
|
||||
|
||||
Then extend the same probe to the neighbouring surfaces that have to tell the
|
||||
same story - platform, oscpu, `maxTouchpoints`, screen. A detector reads them
|
||||
together, so you should too. The method for turning that comparison into
|
||||
something trustworthy, including why one green run is not a pass and why an empty
|
||||
result is a failure rather than a clean sheet, is in
|
||||
[how to test bot detection without a false pass](how-to-test-bot-detection.md).
|
||||
For the wider point that a missing signal counts as a signal, the
|
||||
[screen-size and headless tells](screen-size-headless-tells.md) page covers the
|
||||
same idea on a different surface.
|
||||
|
||||
## What this fixes and what it does not
|
||||
|
||||
Matching the sensor surface makes invisible_playwright look like a genuine
|
||||
desktop Firefox on one more axis, and that is real: the fingerprint, the TLS
|
||||
handshake and the driver layer read as an ordinary Firefox, which is why a
|
||||
consistent identity passes most in-page detection. But the sensor surface is a
|
||||
narrow win, and it is worth being blunt about the boundary.
|
||||
|
||||
Reporting the correct silence does nothing for the parts of a session that are
|
||||
not browser properties at all. It does not clean your **IP reputation** - a
|
||||
perfectly consistent desktop on a datacenter or already-flagged address still
|
||||
loses on the address. It does not manage **per-account quotas or rate limits** -
|
||||
those are counted server-side regardless of how real the browser looks. And it
|
||||
does not shape your **behaviour or timing** - a pointer that teleports, a form
|
||||
filled in eighty milliseconds, or an agent that pauses in a shape that looks
|
||||
like model latency will be flagged no matter how honest the sensor readings are.
|
||||
Those are yours to supply: a clean residential exit and human pacing. If your
|
||||
fingerprint is clean and you are still blocked, that separation is the whole
|
||||
subject of [why you can be blocked with a clean fingerprint](why-blocked-with-a-clean-fingerprint.md).
|
||||
|
||||
So the honest framing: device-sensor consistency is one correct answer among
|
||||
many, it costs you nothing here because the default is already right, and it is
|
||||
necessary but nowhere near sufficient on its own.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Accelerometer and gyroscope do not leak on desktop Firefox because desktop
|
||||
Firefox has nothing to report: the generic Sensor APIs are Chromium-only, and
|
||||
the motion events exist as handlers that never fire. The mistake to avoid is
|
||||
over-correction - synthesizing motion data so the surface "does not look dead"
|
||||
turns a correct silence into a contradiction with your platform string. The
|
||||
patched build reports the same silence a real Windows Firefox does, keeps it
|
||||
coherent with platform, oscpu and the touch surface because they all derive from
|
||||
one seed, and leaves the parts it cannot touch - address, quotas, behaviour -
|
||||
clearly labelled as yours.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Does desktop Firefox expose accelerometer or gyroscope data?** No. The generic
|
||||
Sensor API constructors are Chromium-only and absent in Firefox, and the older
|
||||
DeviceMotion and DeviceOrientation events stay silent with no motion hardware.
|
||||
|
||||
**Is a silent sensor surface a red flag?** Only if it disagrees with what you
|
||||
claim. A desktop with no motion sensor is correct; a mobile user agent with no
|
||||
motion sensor is the tell.
|
||||
|
||||
**Should I fake motion events to look more real on a desktop?** No. That is the
|
||||
one thing that breaks it - a desktop emitting accelerometer or gyroscope
|
||||
readings contradicts its own platform string.
|
||||
|
||||
**Do the DeviceMotion event handlers exist at all in Firefox?** Yes, the
|
||||
`ondevicemotion` and `ondeviceorientation` properties are present, but they never
|
||||
fire without hardware, so a listener is simply never called.
|
||||
|
||||
**Does invisible_playwright need a sensor flag set for this?** No. Reporting the
|
||||
correct desktop silence is the default; there is nothing to configure.
|
||||
|
||||
**Does getting the sensor surface right mean I will not be detected?** No. It
|
||||
helps with fingerprint consistency, not with IP reputation, account quotas, rate
|
||||
limits, or behaviour and timing, which you still have to supply.
|
||||
|
||||
## Sources
|
||||
|
||||
- The generic Sensor APIs (`Accelerometer`, `Gyroscope` and family) as an
|
||||
engine feature present in Chromium and not in Firefox, read from each engine's
|
||||
own behaviour rather than from a summary.
|
||||
- The DeviceOrientation and DeviceMotion event model, and its behaviour on
|
||||
hardware with no motion sensor.
|
||||
- This project's release gates, which compare the patched build's surfaces field
|
||||
by field against a stock desktop Firefox on the same machine.
|
||||
|
||||
**See also:** [navigator.platform and oscpu consistency](navigator-platform-oscpu-consistency.md),
|
||||
[maxTouchpoints and pointer type](navigator-maxtouchpoints-pointer.md), and
|
||||
[why you can be blocked with a clean fingerprint](why-blocked-with-a-clean-fingerprint.md).
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The sensor surface
|
||||
is the easy kind of honest: the correct answer is to report nothing, and the only
|
||||
way to fail is to invent data a real desktop would never send.*
|
||||
@@ -0,0 +1,223 @@
|
||||
---
|
||||
title: "Accept-Language header vs navigator.languages"
|
||||
description: "Accept-Language and navigator.languages must agree: one Firefox pref feeds both, so an injection-only spoof that moves one and not the other is a clear tell."
|
||||
parent: "Browser Identity"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 21
|
||||
---
|
||||
|
||||
|
||||
# Accept-Language header vs navigator.languages
|
||||
|
||||
A real browser reports its preferred languages in two completely separate places. It
|
||||
sends an `Accept-Language` header on every HTTP request, decided by the network stack
|
||||
before any page runs. And it exposes `navigator.language` and `navigator.languages` to
|
||||
JavaScript, read from the page after it loads. Two surfaces, two code paths, and a
|
||||
detector that reads both expects them to tell the same story.
|
||||
|
||||
They do, in a stock browser, because both come from one setting. The interesting failure
|
||||
is what happens when a stealth layer touches only one of them.
|
||||
|
||||
## One preference feeds both surfaces
|
||||
|
||||
In Firefox the language preference lives in a single about:config string,
|
||||
`intl.accept_languages`, with a value like `en-US,en`. That one string is the source for
|
||||
two different consumers:
|
||||
|
||||
- The **network stack** formats it into the `Accept-Language` request header, adding the
|
||||
quality values (`en-US,en;q=0.5`) a browser normally attaches.
|
||||
- The **JavaScript engine** parses the same string into the `navigator.languages` array
|
||||
and its first element into `navigator.language`.
|
||||
|
||||
Because both read the same preference, they cannot disagree. Change the preference and
|
||||
the header changes and the array changes, together, in the same load. There is no way,
|
||||
inside a genuine browser, to make the header say one thing and the property say another,
|
||||
because there is only one value and both surfaces quote it.
|
||||
|
||||
That single-source property is worth stating plainly, because it is exactly the invariant
|
||||
a naive spoof breaks.
|
||||
|
||||
## Why an injection-only spoof splits the two
|
||||
|
||||
A large class of stealth tooling works by running JavaScript in the page before the
|
||||
site's own code: it redefines `navigator.languages` with `Object.defineProperty`, or it
|
||||
patches the getter. That reaches exactly one of the two surfaces. It can make
|
||||
`navigator.languages` return `["en-US", "en"]` to any script that asks.
|
||||
|
||||
It never touches the header. The `Accept-Language` header was formatted and sent by the
|
||||
network layer, which is compiled C++ and does not read the JavaScript you injected. So
|
||||
the request that fetched the page carried whatever the underlying browser's real
|
||||
preference was, while the property in the page now claims something else.
|
||||
|
||||
The split lines up field by field like this:
|
||||
|
||||
| Surface | Real browser | Injection-only spoof |
|
||||
|---|---|---|
|
||||
| `Accept-Language` header | formatted from the language preference | unchanged real value (sent by the network layer) |
|
||||
| `navigator.languages` | parsed from the same preference | overridden in the page |
|
||||
| Do the two agree? | yes, one shared source | no, they diverge |
|
||||
|
||||
A detector does not need to be clever to catch this. It reads the `Accept-Language` it
|
||||
received on the request, reads `navigator.languages` from a script it served, and
|
||||
compares the two strings. When the header says one language set and the property says
|
||||
another, that contradiction is the tell. It is the same shape of mistake as
|
||||
[running two spoofers that answer the same question differently](playwright-detected-as-bot.md):
|
||||
one value moves, its twin does not, and the gap between them is louder than either value
|
||||
alone.
|
||||
|
||||
The same reasoning extends to the request headers a browser sends about itself, which is
|
||||
why [the Sec-Fetch and client-hint headers](client-hints-sec-fetch.md) have to line up
|
||||
with the rest of the identity for the same structural reason: a header the page cannot
|
||||
see is a header an injection cannot fix.
|
||||
|
||||
## How this project keeps header and property in agreement
|
||||
|
||||
Because the fingerprint is applied at the browser level rather than in the page, the
|
||||
language is set through the same native preference a real profile uses, so both surfaces
|
||||
read from it. There is nothing to inject into the page and nothing to keep in sync: the
|
||||
header and the array are the same value formatted twice, by the browser, the way they
|
||||
always are.
|
||||
|
||||
The code that drives it is stock Playwright. Switching a normal Playwright script over is
|
||||
the launch line and nothing else:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
langs = page.evaluate("navigator.languages")
|
||||
print("navigator.languages =", langs)
|
||||
```
|
||||
|
||||
The `browser` returned is a real Playwright `Browser`, so every method you already use
|
||||
works unchanged. The seed makes the whole identity reproducible: the same seed yields the
|
||||
same language set, the same GPU, the same screen, run after run, which is what lets a
|
||||
failure be replayed instead of guessed at.
|
||||
|
||||
## Prove they match, do not assume it
|
||||
|
||||
The point of this page is a check you can run rather than a claim to trust. Capture the
|
||||
`Accept-Language` header the browser actually sent, read `navigator.languages` from the
|
||||
loaded page, and compare the two directly. Use any endpoint that echoes request headers
|
||||
back; the snippet below reads the header off the outgoing request instead, so it needs no
|
||||
particular server:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
|
||||
sent_header = {}
|
||||
def capture(request):
|
||||
if "accept-language" in request.headers:
|
||||
sent_header["value"] = request.headers["accept-language"]
|
||||
page.on("request", capture)
|
||||
|
||||
page.goto("https://example.com")
|
||||
|
||||
header = sent_header.get("value", "")
|
||||
array = page.evaluate("navigator.languages")
|
||||
|
||||
print("Accept-Language header :", header)
|
||||
print("navigator.languages :", array)
|
||||
|
||||
# The header's primary tag and the array's first entry must be the same language.
|
||||
header_primary = header.split(",")[0].split(";")[0].strip()
|
||||
assert header_primary == array[0], (header_primary, array[0])
|
||||
print("header and property agree")
|
||||
```
|
||||
|
||||
Follow the method from
|
||||
[how to test whether your browser is detected](how-to-test-bot-detection.md): assert the
|
||||
values are present and agree, rather than asserting nothing looks wrong. A property that
|
||||
comes back empty, or a header your capture never saw, is a failure and not a pass. Run it
|
||||
against a stock browser on the same machine too, and the header and array should match
|
||||
there in exactly the same way.
|
||||
|
||||
## Match the language to the exit, the same way you match the timezone
|
||||
|
||||
Header and property agreeing with each other is necessary but not sufficient. Both of
|
||||
them also have to agree with where the request appears to come from.
|
||||
|
||||
A session whose exit address resolves to one country while the browser advertises the
|
||||
language of another is a contradiction of the same family as
|
||||
[a timezone that does not match the proxy](timezone-proxy-mismatch.md). The two values
|
||||
are individually plausible and jointly wrong, which is precisely what field-by-field
|
||||
comparison catches and a single-value check does not. If you
|
||||
[rotate through several exits](how-to-rotate-proxies-playwright.md), the language set is
|
||||
one more field that should track the exit rather than staying pinned to whatever the host
|
||||
machine happens to prefer. Pass the proxy at launch and let the identity be built to fit
|
||||
it, rather than setting the language by hand and hoping it lines up:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
proxy = {"server": "socks5://gate.example.com:1080", "username": "u", "password": "p"}
|
||||
|
||||
with InvisiblePlaywright(seed=42, proxy=proxy) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
print("languages =", page.evaluate("navigator.languages"))
|
||||
```
|
||||
|
||||
## Conclusion
|
||||
|
||||
The `Accept-Language` header and `navigator.languages` are read from one browser
|
||||
preference, so in a genuine browser they cannot diverge. That is the whole reason the
|
||||
pair is worth checking: a stealth layer that lives in the page can move the property and
|
||||
never the header, and the gap it opens is a cleaner signal than any single value. Set the
|
||||
language where the browser itself reads it, keep it consistent with the exit, and verify
|
||||
by comparison rather than assumption.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Do Accept-Language and navigator.languages have to match?** Yes. In a real browser both
|
||||
are formatted from one preference, so a mismatch is a contradiction that only a spoof
|
||||
produces.
|
||||
|
||||
**Why does setting navigator.languages in JavaScript not work?** Because it reaches only
|
||||
the page-facing property. The `Accept-Language` header was already sent by the network
|
||||
layer, which does not read your injected script, so the header still carries the old
|
||||
value.
|
||||
|
||||
**How do I set the browser language in Playwright?** Let the fingerprint layer set the
|
||||
native preference so both surfaces read from it, rather than overriding the property in
|
||||
the page. Here the language comes with the seeded identity.
|
||||
|
||||
**Should the language match the proxy country?** It should be consistent with the exit,
|
||||
the same way the timezone has to be. A language from one continent on an exit in another
|
||||
is a mismatch a detector can pair up.
|
||||
|
||||
**How do I check the two agree?** Capture the `Accept-Language` header the browser sent,
|
||||
read `navigator.languages` from the loaded page, and compare the primary language tag of
|
||||
each. Do it against a stock browser as well.
|
||||
|
||||
**Does the q-value in the header matter?** It should be present. A real browser attaches
|
||||
quality values like `;q=0.5`; a header that is a bare comma list with none is itself
|
||||
slightly unusual.
|
||||
|
||||
## Sources
|
||||
|
||||
- Firefox's `intl.accept_languages` preference, which is the single value both the request
|
||||
header and the `navigator.languages` array are formatted from.
|
||||
- [MDN: `Navigator.languages`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/languages)
|
||||
and [MDN: `navigator.language`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/language),
|
||||
the page-facing properties an injection redefines.
|
||||
- [MDN: the `Accept-Language` request header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Accept-Language),
|
||||
including the quality (`q`) values a browser attaches, sent by the network stack before any page script runs.
|
||||
- This project's own realness gates, which compare request headers against in-page
|
||||
properties field by field rather than reading either in isolation.
|
||||
|
||||
**See also:** [when the timezone does not match the proxy](timezone-proxy-mismatch.md),
|
||||
[when the TLS fingerprint and the user agent disagree](tls-fingerprint-user-agent-mismatch.md),
|
||||
[the checklist for being detected on one site](playwright-detected-as-bot.md), and
|
||||
[how to test whether your browser is detected](how-to-test-bot-detection.md).
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The header and the array
|
||||
come from one preference, which is exactly what an injection-only spoof gets wrong.*
|
||||
@@ -0,0 +1,221 @@
|
||||
---
|
||||
title: "AI agent retry loops trip rate limits, not fingerprints"
|
||||
description: "Why AI agent retry loops multiply requests into a volume signal that trips rate limits, and why throttling belongs in the agent loop, not the browser engine."
|
||||
parent: "AI Agents and Frameworks"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 17
|
||||
---
|
||||
|
||||
|
||||
# AI agent retry loops trip rate limits, not fingerprints
|
||||
|
||||
An agent that gets a browser to look like a real person will still get blocked if it
|
||||
asks for a page thirty times in ten seconds. That block has nothing to do with the
|
||||
fingerprint. It is a counter.
|
||||
|
||||
This page is about the failure mode that a perfect disguise does not touch: an agent
|
||||
retries and re-plans on failure, every retry is another request, and a stack of retries
|
||||
per second is a volume and behaviour signal that trips rate limits and quotas long
|
||||
before any fingerprint check runs. The fix does not live in the browser. It lives in
|
||||
the loop that drives it.
|
||||
|
||||
## Why an agent makes more traffic than a scraper
|
||||
|
||||
A hand-written scraper visits a known list of URLs once. An agent does not. It observes
|
||||
a page, decides a next action, acts, and when the action fails it re-plans and tries
|
||||
again. That control loop is the whole point of an agent, and it is also a request
|
||||
multiplier.
|
||||
|
||||
Three things stack up:
|
||||
|
||||
- **Retries.** A transient error, a slow load, a missing element, and the agent tries
|
||||
the same step again. One logical action becomes three or five HTTP requests.
|
||||
- **Re-planning.** When a step fails the agent often re-reads the page, or reloads it,
|
||||
or navigates back and forward to re-orient. Each of those is a fresh visit to a URL a
|
||||
human would have loaded once.
|
||||
- **Exploration.** An agent that does not know the site's layout probes it: opens a
|
||||
page to see what is there, backs out, opens another. A person who knows what they want
|
||||
does not.
|
||||
|
||||
The result is that a single high-level task ("find the price of item X") can produce
|
||||
ten or twenty page loads, most of them to the same few URLs, in a burst measured in
|
||||
seconds. That pattern is trivial to count, and counting is exactly what a rate limiter
|
||||
does.
|
||||
|
||||
## Rate limits read volume, not the browser
|
||||
|
||||
A fingerprint check and a rate limit answer two different questions, and a convincing
|
||||
disguise only answers one of them: one asks whether this browser is real, the other only
|
||||
counts how many requests just arrived.
|
||||
|
||||
A fingerprint check reads properties of the browser: the GPU string, the canvas hash,
|
||||
the font list, the TLS handshake. It asks "is this a real browser". invisible_playwright
|
||||
is built to make that answer yes, which is why it passes most of that class of check:
|
||||
the engine is a genuine Firefox patched at the C++ level, so the values are real rather
|
||||
than spoofed on top of a headless build.
|
||||
|
||||
A rate limit reads something completely different: how many requests arrived from this
|
||||
address, this account, or this session, in this window. It does not open the browser at
|
||||
all. It increments a counter and compares it to a threshold. The request could come from
|
||||
the most convincing browser ever built and the counter would go up by exactly one.
|
||||
|
||||
So the two defences are orthogonal:
|
||||
|
||||
| Signal | What it reads | Does a real-looking browser help |
|
||||
|---|---|---|
|
||||
| Fingerprint / driver / TLS | Properties of the client | Yes - this is what the engine is for |
|
||||
| Rate limit / quota | Count of requests over time | No - N requests is N requests |
|
||||
| Per-account quota | Actions tied to one identity | No - the account is the unit, not the browser |
|
||||
| Behaviour / velocity | Timing and shape of the traffic | No - the loop decides the timing |
|
||||
|
||||
The bottom three rows are not something an engine can fix, because the engine only
|
||||
controls what one request looks like, not how many of them you send or how fast. That is
|
||||
a property of the loop.
|
||||
|
||||
## Put the budget in the loop, not the engine
|
||||
|
||||
The consequence is a design rule: **backoff, throttling and a request budget belong in
|
||||
the agent loop.** No browser setting throttles an agent that has been told to retry
|
||||
until it succeeds.
|
||||
|
||||
Three controls cover most of it:
|
||||
|
||||
- **Exponential backoff on retry.** When a step fails, wait, and wait longer each time,
|
||||
instead of retrying immediately. A failed request answered by an instant identical
|
||||
request is the clearest velocity signal there is.
|
||||
- **A hard request budget.** Cap the number of requests per task and per unit of time.
|
||||
When the budget is spent, stop and surface the failure rather than letting the loop
|
||||
spend the site's patience for you.
|
||||
- **A cap on re-plans.** Bound how many times the agent may re-read or reload the same
|
||||
URL before it gives up. An unbounded re-plan loop is an accidental refresh storm.
|
||||
|
||||
The unit to think in is requests per minute from one address and one account, not
|
||||
requests per browser. Ten agents behind one exit IP each politely pacing themselves are,
|
||||
to the counter, one very busy client.
|
||||
|
||||
## A retry loop that backs off
|
||||
|
||||
Here is the two-line launch plus a retry wrapper that carries a budget and backs off.
|
||||
The browser is a stealth Firefox; the throttling is plain Python, because that is where
|
||||
it has to be.
|
||||
|
||||
```python
|
||||
import time
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
def fetch_with_budget(page, url, *, max_attempts=4, budget):
|
||||
"""Load url with exponential backoff. Raises when the budget is spent."""
|
||||
for attempt in range(max_attempts):
|
||||
if budget["spent"] >= budget["limit"]:
|
||||
raise RuntimeError("request budget exhausted; stopping instead of retrying")
|
||||
budget["spent"] += 1
|
||||
try:
|
||||
page.goto(url, wait_until="domcontentloaded")
|
||||
return page
|
||||
except Exception:
|
||||
if attempt == max_attempts - 1:
|
||||
raise
|
||||
backoff = 2 ** attempt # 1s, 2s, 4s, ...
|
||||
time.sleep(backoff)
|
||||
return page
|
||||
|
||||
budget = {"spent": 0, "limit": 30} # hard cap for the whole task
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
fetch_with_budget(page, "https://example.com", budget=budget)
|
||||
# ... agent observes, decides, acts; every navigation goes through the budget
|
||||
```
|
||||
|
||||
The `browser` returned is a real Playwright
|
||||
[`Browser`](https://playwright.dev/python/docs/api/class-browser), so every standard
|
||||
method works unchanged - `new_page`, `goto`, `click`, `wait_for_selector`. The stealth is
|
||||
in the engine; the pacing is in `fetch_with_budget`. Nothing about `seed=42` slows the loop
|
||||
down, and nothing about the loop changes the fingerprint. They are separate jobs.
|
||||
|
||||
Pacing the actions themselves matters too, because uniform, machine-fast timing is its
|
||||
own tell independent of volume. That is the subject of
|
||||
[the pause shaped like model latency](ai-browser-agents-stealth.md), and it is worth
|
||||
reading alongside this page: one is about how many requests, the other about their
|
||||
shape.
|
||||
|
||||
## What invisible_playwright fixes, and what it does not
|
||||
|
||||
The honest split, because overclaiming here is both wrong and a way to get someone
|
||||
blocked while they trust a promise that was never true.
|
||||
|
||||
**What the engine handles.** The fingerprint, driver and TLS layers read as a genuine
|
||||
Firefox, so the class of check that asks "is this a real browser driven by a real
|
||||
person" mostly answers yes. That is measurable: on the public tampering suites a session
|
||||
comes back internally consistent rather than flagged, and the same seed produces the
|
||||
same machine every run so a failure is reproducible.
|
||||
|
||||
**What you supply.** The engine does not change your IP's reputation, it does not create
|
||||
per-account quota out of nothing, it does not slow your loop down, and it does not shape
|
||||
your timing. Those are yours to bring:
|
||||
|
||||
- A clean exit, because a real-looking browser on a
|
||||
[datacenter IP is still on a datacenter IP](can-websites-detect-a-datacenter-proxy-ip.md),
|
||||
and a counter on the address does not care how good the browser is.
|
||||
- Human pacing, from the loop, using the controls above.
|
||||
- Respect for the account's own limits, which are counted against the identity and not
|
||||
the browser.
|
||||
|
||||
Put plainly: invisible_playwright makes each request look like it came from a real
|
||||
person. It does not make a thousand requests look like one. That second job is the
|
||||
loop's, and no engine setting will do it for you. When a clean fingerprint still gets
|
||||
blocked, volume and address are the usual reasons -
|
||||
[which is a page of its own](why-blocked-with-a-clean-fingerprint.md).
|
||||
|
||||
## Conclusion
|
||||
|
||||
Retries and re-planning are what make an agent an agent, and they are also what turn one
|
||||
task into a burst of requests. A burst is counted, and a counter is a different defence
|
||||
from a fingerprint check: the most convincing browser in the world still increments it by
|
||||
one per request. So the throttle cannot live in the engine. Give the loop a budget, back
|
||||
off on failure, cap the re-plans, and put a clean exit under it. The browser's job is to
|
||||
make each request real; keeping the requests few and well-spaced is yours.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Will a stealth browser stop my agent from being rate limited?** No. Rate limits count
|
||||
requests; they do not inspect the browser. A real-looking fingerprint helps with
|
||||
detection, not with volume.
|
||||
|
||||
**Why does my agent get blocked when a manual visit works fine?** Almost always because
|
||||
the agent sent many more requests, much faster, than the person did. Retries and reloads
|
||||
multiply traffic that a human never generates.
|
||||
|
||||
**Where should backoff and throttling live?** In the agent loop, not the engine. No
|
||||
browser setting paces an agent that was told to retry until it succeeds.
|
||||
|
||||
**Does the seed or fingerprint affect how fast I can go?** No. The seed controls the
|
||||
identity, not the timing. Speed and request count are decided entirely by your loop.
|
||||
|
||||
**Is a per-account quota a fingerprint problem?** No. A quota is counted against the
|
||||
identity or the account, not the browser, so a better fingerprint does nothing for it.
|
||||
Budget the actions instead.
|
||||
|
||||
**How many requests per minute is safe?** There is no universal number; it depends on
|
||||
the site. The safe habit is a hard budget per task and per window, plus backoff, so a
|
||||
failing loop stops itself rather than accelerating.
|
||||
|
||||
## Sources
|
||||
|
||||
- This project's own velocity flag, raised against invisible_playwright during testing,
|
||||
which turned out to be the test harness hammering one scoring endpoint from one
|
||||
address - the same volume signal described here, produced by our own gate.
|
||||
- The wrapper's documented API (`InvisiblePlaywright`, seed reproducibility, a real
|
||||
[Playwright `Browser`](https://playwright.dev/python/docs/api/class-browser) return)
|
||||
as shipped, used verbatim in the example above.
|
||||
|
||||
**See also:** [the pause shaped like model latency](ai-browser-agents-stealth.md) for
|
||||
the timing side of the same problem, [how to rate limit your scraper](how-to-rate-limit-your-scraper-playwright.md)
|
||||
for the pacing mechanics in detail, and [what actually detects an agent](browser-use-detection.md)
|
||||
across the layers a fingerprint does not cover.
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The velocity flag that
|
||||
started this page was ours, and it belonged to the harness, not the browser.*
|
||||
@@ -0,0 +1,229 @@
|
||||
---
|
||||
title: "Why AI browser agents have their own timing signal"
|
||||
description: "An LLM loop emits machine-regular action gaps and instant pointer jumps - a behavioral signal no fingerprint fixes. Where pacing and dwell time live in your code."
|
||||
parent: "AI Agents and Frameworks"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 10
|
||||
---
|
||||
|
||||
|
||||
# Why AI browser agents have their own timing signal
|
||||
|
||||
A stealth engine can make your browser read as a genuine Firefox down to the TLS
|
||||
handshake, and an AI agent driving it can still stand out for a reason that has nothing
|
||||
to do with the browser at all: the rhythm of the loop that controls it.
|
||||
|
||||
An LLM agent runs a think-act cycle. It looks at the page, decides on an action, emits
|
||||
the action, waits for the result, and looks again. That cycle has a shape, and the shape
|
||||
is measurable. The gaps between actions cluster around the model's latency, the actions
|
||||
themselves land effectively instantly, and the pointer arrives at each target without a
|
||||
human's approach, overshoot or correction. None of that is in the fingerprint. It is a
|
||||
separate signal, orthogonal to every value a fingerprinting page reads, and a site can
|
||||
check it on its own.
|
||||
|
||||
This page is about that signal: what produces it, why a clean fingerprint does not
|
||||
touch it, and where the fix has to live, which is in your code and not in the engine.
|
||||
|
||||
## What the timing signal actually is
|
||||
|
||||
Behaviour is a fingerprint of a different kind. A fingerprinting page reads static
|
||||
properties: the GPU string, the font list, the canvas hash. A behavioural check reads
|
||||
the stream of events a session produces over time: when clicks happen relative to each
|
||||
other, how a pointer travels between two points, how long a value takes to type, whether
|
||||
anything is read before it is acted on.
|
||||
|
||||
A human session is full of small irregularities. There is a pause to read that varies
|
||||
from a second to several. The pointer curves toward a target, arrives a little off, and
|
||||
corrects. Typing has an uneven cadence with the occasional longer gap. Time is spent on
|
||||
the page doing nothing measurable.
|
||||
|
||||
An agent loop, left to its own timing, produces almost none of that. The interesting
|
||||
part is that this is true even when the engine underneath is perfect, which is what makes
|
||||
it worth a page of its own.
|
||||
|
||||
## Why a perfect fingerprint does not touch it
|
||||
|
||||
invisible_playwright is designed to look like a real browser driven by a real person, and
|
||||
that is why it passes most detection checks: the engine fingerprint, the TLS handshake and
|
||||
the driver layer all read as a genuine Firefox rather than an automated one. That is a real
|
||||
result and it is most of what people are blocked for.
|
||||
|
||||
It is also not everything. The same honesty that makes the product worth using means being
|
||||
clear about the edges: on its own it does not fix IP reputation, per-account quotas, rate
|
||||
limits, or behaviour. Those are supplied by you, a clean exit and human pacing among them.
|
||||
The timing signal is squarely in that last category. The engine controls what the browser
|
||||
*is*; it does not control the cadence at which your loop decides to act, because that cadence
|
||||
is produced above the browser, in the code that calls it.
|
||||
|
||||
Put differently: a fingerprint is a photograph and behaviour is a motion study. Making the
|
||||
photograph perfect does nothing to the motion study, and the two are read by different parts
|
||||
of a detection system. This is the same reason the [testing method that catches false
|
||||
passes](how-to-test-bot-detection.md) lists behaviour among the things no in-page suite
|
||||
covers.
|
||||
|
||||
## What the loop leaks: gaps and pointer jumps
|
||||
|
||||
Two specifics, because they are the ones an agent produces without meaning to.
|
||||
|
||||
**Inter-action gaps that cluster.** Between one action and the next sits a wait for the
|
||||
model to respond. That wait is not random the way a human pause is; it clusters around
|
||||
whatever the model's latency happens to be, run after run. A distribution of gaps that is
|
||||
tight and repeatable, rather than the broad, ragged spread a person produces, is itself the
|
||||
tell. It does not matter that the individual number looks plausible. The *shape* of the
|
||||
distribution is the signal.
|
||||
|
||||
**Actions that land instantly, and pointers that jump.** When an agent decides to click a
|
||||
coordinate, the naive path is to dispatch the click at that coordinate with no travel and
|
||||
no dwell. The pointer teleports from wherever it was to the target, and the action fires
|
||||
with zero read time in front of it. A form filled field by field with no gaps, a click on
|
||||
an element the instant it appears, a pointer that never passes through the space between two
|
||||
targets: each is a motion no hand produces. The [detected-on-one-site checklist](playwright-detected-as-bot.md)
|
||||
reaches this at step five, after the machine and the automation tells, because it is what is
|
||||
left once the browser itself is clean.
|
||||
|
||||
invisible_playwright does smooth one piece of this for you: a click arcs the pointer to the
|
||||
target on a Bezier curve rather than teleporting, so an individual click's *path* is
|
||||
human-shaped. What it cannot smooth is the *cadence* between your actions and the dwell time
|
||||
in front of them, because your loop, not the browser, decides when the next action happens.
|
||||
|
||||
## Pacing and pointer motion live in your code, not the engine
|
||||
|
||||
The consequence is a division of labour, and it is a clean one.
|
||||
|
||||
The engine owns the browser identity: the fingerprint, the TLS layer, the driver surface.
|
||||
You own the rhythm: how long to dwell before acting, how much to vary the gap between
|
||||
actions, whether to read the page before touching it. No engine can supply the rhythm for
|
||||
you, because the rhythm is produced by the loop calling the engine, and that loop is yours.
|
||||
|
||||
Concretely, that means adding pacing and dwell to the code between your actions rather than
|
||||
expecting the browser to add it underneath. Here is the minimal shape, using the real
|
||||
two-line launch and standard Playwright methods on the returned browser:
|
||||
|
||||
```python
|
||||
import random
|
||||
import time
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
|
||||
def dwell(low=0.6, high=2.4):
|
||||
"""A varied pause, the kind reading and deciding actually produces."""
|
||||
time.sleep(random.uniform(low, high))
|
||||
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
|
||||
dwell(1.2, 3.0) # read before acting, not act on arrival
|
||||
page.click("#open") # the engine arcs the pointer on a Bezier curve
|
||||
|
||||
dwell()
|
||||
for ch in "a search phrase": # per-key rhythm, not one instant fill
|
||||
page.keyboard.type(ch)
|
||||
time.sleep(random.uniform(0.04, 0.19))
|
||||
|
||||
dwell()
|
||||
page.click("#submit")
|
||||
```
|
||||
|
||||
The `browser` returned by `InvisiblePlaywright` is a real Playwright `Browser`, so every
|
||||
method is the one you already know; the `seed=42` makes the identity reproducible so a run
|
||||
that gets flagged can be replayed exactly. The only thing added above the plain automation is
|
||||
the pacing, and that is the point: it has to be added, because it is the part the engine
|
||||
cannot produce for you.
|
||||
|
||||
A note on doing it well. Uniform delays are their own tell. `time.sleep(1.0)` between every
|
||||
action just moves the cluster from "instant" to "exactly one second", and a tight cluster at
|
||||
one second is as machine-regular as a tight cluster at zero. Vary the pauses, make them
|
||||
depend on what the step is doing (a long read before a decision, a short gap between two
|
||||
keystrokes), and avoid the same number twice. The goal is the ragged, context-dependent
|
||||
spread a person produces, not a constant with a label on it.
|
||||
|
||||
## Measuring your own rhythm before a site does
|
||||
|
||||
You can read this signal off your own agent the same way a site would, which is the honest
|
||||
way to know whether your pacing is doing anything. Record a timestamp at each action, then
|
||||
look at the distribution of the gaps.
|
||||
|
||||
```python
|
||||
import time
|
||||
|
||||
timestamps = []
|
||||
|
||||
|
||||
def mark():
|
||||
timestamps.append(time.monotonic())
|
||||
|
||||
|
||||
# call mark() immediately before each page action, then afterward:
|
||||
gaps = [b - a for a, b in zip(timestamps, timestamps[1:])]
|
||||
print("count:", len(gaps))
|
||||
print("min / max:", round(min(gaps), 3), round(max(gaps), 3))
|
||||
print("mean:", round(sum(gaps) / len(gaps), 3))
|
||||
```
|
||||
|
||||
If the min and max are close together, or the mean sits right on top of your model's
|
||||
typical response time, your loop is emitting the clustered distribution described above and
|
||||
the pacing is not varied enough yet. A human trace has a wide spread and a long tail. This is
|
||||
the same instinct as reading the fingerprint report field by field rather than trusting a
|
||||
verdict: measure the actual stream, do not assume the shape. For the related case of an agent
|
||||
whose pauses line up with tool latency in a devtools context, see
|
||||
[timing detection through the debugger](debugger-timing-detection.md).
|
||||
|
||||
## Conclusion
|
||||
|
||||
The engine fingerprint and the agent's rhythm are two different signals, read by two
|
||||
different parts of a detection system, and a stealth browser addresses the first and not the
|
||||
second. invisible_playwright makes the browser read as a genuine person's Firefox, which is
|
||||
why it clears most checks; the cadence of your think-act loop is produced above the browser,
|
||||
so pacing, dwell time and read-before-act have to live in your own code. Add them
|
||||
deliberately, vary them so they are not merely a slower constant, and measure your own trace
|
||||
the way a site would. That is the honest division of labour, and it is the one that holds up.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Does a stealth browser hide that I am an AI agent?** It hides that the browser is
|
||||
automated. It does not hide the rhythm of your control loop, which is a separate signal you
|
||||
produce above the browser.
|
||||
|
||||
**What is the timing signal, exactly?** The gaps between your actions cluster around the
|
||||
model's latency instead of spreading like a human's pauses, and actions land instantly with
|
||||
pointers that jump straight to targets. Both are visible without reading any fingerprint.
|
||||
|
||||
**Can invisible_playwright fix my pacing for me?** No, and no engine can. It smooths an
|
||||
individual click's pointer path on a Bezier curve, but the cadence between actions is decided
|
||||
by your loop, so pacing and dwell have to live in your code.
|
||||
|
||||
**Do I just add a fixed sleep between actions?** That helps with "instant" but creates a new
|
||||
tell: a tight cluster at one second is as regular as a tight cluster at zero. Vary the pauses
|
||||
and make them depend on the step.
|
||||
|
||||
**Will fixing the timing get me past everything?** No. Behaviour is one signal among several.
|
||||
A clean rhythm on a bad IP, over quota, or against a rate limit still fails; those are yours
|
||||
to supply too, a clean exit and sane request volume among them.
|
||||
|
||||
**How do I know if my rhythm looks robotic?** Record a timestamp at each action and look at
|
||||
the spread of the gaps. If min and max are close, or the mean sits on your model's response
|
||||
time, the distribution is too tight.
|
||||
|
||||
## Sources
|
||||
|
||||
- This project's own testing notes, which list behaviour and the pause shaped like model
|
||||
latency among the things no in-page suite covers.
|
||||
- Standard Playwright's documented [`Browser`](https://playwright.dev/python/docs/api/class-browser),
|
||||
[`Page`](https://playwright.dev/python/docs/api/class-page) and
|
||||
[`Keyboard`](https://playwright.dev/python/docs/api/class-keyboard) methods, used unchanged
|
||||
on the browser this wrapper returns.
|
||||
- The behavioural step of this set's detected-on-one-site checklist, which reaches pointer
|
||||
motion and typing cadence after the browser itself is clean.
|
||||
|
||||
**See also:** [what fits and what does not for AI browser agents](ai-browser-agents-stealth.md),
|
||||
[why a CDP-driven agent has a tell of its own](browser-use-detection.md), and
|
||||
[testing bot detection without a false pass](how-to-test-bot-detection.md).
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The engine makes the browser
|
||||
real; the rhythm is yours to write, and this page is the part I keep having to add back into
|
||||
my own agent loops.*
|
||||
@@ -0,0 +1,230 @@
|
||||
---
|
||||
title: "AI browser agents and stealth: what fits and what does not"
|
||||
description: "Most AI browser agents drive Chromium over CDP, so a stealth Firefox does not drop in. What each tool exposes, checked from source, and what applies regardless."
|
||||
parent: "AI Agents and Frameworks"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 1
|
||||
---
|
||||
|
||||
|
||||
# AI browser agents and stealth: what fits and what does not
|
||||
|
||||
Most AI browser agents cannot run a stealth Firefox, because they speak the Chrome
|
||||
DevTools Protocol (CDP) and Firefox does not answer it. The few built on Playwright can
|
||||
select Firefox in principle, but rarely expose a custom binary. And on a server the engine
|
||||
is usually not what gets the agent blocked in the first place.
|
||||
|
||||
If your agent works on your laptop and gets challenge pages on a server, there are two
|
||||
separate questions and they get answered as one. The first is whether you can swap the
|
||||
browser underneath. The second is whether swapping it would fix your problem.
|
||||
|
||||
For most of these tools the first answer is no, for a reason that is structural rather
|
||||
than accidental. The second answer is often no as well, and for a different reason.
|
||||
|
||||
This page is what each project actually exposes, checked by reading its source, the split
|
||||
that decides all of it, what applies no matter which engine you run, the signal specific
|
||||
to agent-driven sessions, and the one route that does accept a different engine.
|
||||
|
||||
## The split that decides everything: CDP or Playwright
|
||||
|
||||
Browser automation divides into two families and the boundary matters more than any
|
||||
configuration option.
|
||||
|
||||
**Tools that speak the Chrome DevTools Protocol** talk directly to a Chromium-family
|
||||
browser. CDP is Chromium's own protocol. Firefox does not implement it in the way these
|
||||
drivers expect, so an `executablePath` pointing at a Firefox build does not produce a
|
||||
working session: the driver would be speaking a language the browser does not answer.
|
||||
|
||||
**Tools built on Playwright** go through an abstraction that already supports
|
||||
[three engines](https://playwright.dev/docs/browsers) - Chromium, Firefox and WebKit.
|
||||
Swapping the binary is then a question of whether the tool exposes the launch option,
|
||||
not of whether the protocol matches.
|
||||
|
||||
Almost every AI browser agent is in the first family. That is a reasonable engineering
|
||||
choice, since CDP gives fine-grained control that agent loops want, and it is also why
|
||||
"can I use a stealth Firefox with my agent" usually has a short answer.
|
||||
|
||||
## What each project actually exposes
|
||||
|
||||
Only two of these five projects expose a custom-binary option, and both expect a Chromium
|
||||
build. The table below is read from each repository on 2026-07-27 and 2026-07-28, with
|
||||
star counts from the same check.
|
||||
|
||||
| Project | Stars | Family | Custom binary | Firefox |
|
||||
|---|---|---|---|---|
|
||||
| browser-use | 107k | CDP, Chrome | `executable_path` on `BrowserProfile` | no |
|
||||
| Stagehand | 24k | CDP, Chromium | `executablePath`, documented | no |
|
||||
| Skyvern | 23k | CDP | not exposed | no |
|
||||
| crawl4ai | 75k | Playwright | **no `executable_path`** | `browser_type="firefox"` |
|
||||
| Maxun | 17k | Playwright | not exposed | not exposed |
|
||||
|
||||
Three others that come up in these searches are not Playwright tools at all:
|
||||
`agent-browser` and `obscura` are written in Rust, and `BrowserOS` has no Playwright
|
||||
dependency in its manifest. Star count does not tell you what a project drives.
|
||||
|
||||
### browser-use
|
||||
|
||||
The configuration is real: `executable_path`, `channel`, `user_data_dir`, `proxy`, `args`
|
||||
and `headless` on `BrowserProfile`. The surrounding code is Chrome executable discovery
|
||||
and Chrome profile handling, and the channel type is a Chromium channel.
|
||||
|
||||
The useful move there is pointing `executable_path` at your **real installed Chrome**
|
||||
rather than the bundled Chromium, and pointing `user_data_dir` at a profile that has been
|
||||
used. [The full version is here](browser-use-detection.md).
|
||||
|
||||
### Stagehand
|
||||
|
||||
Exposes `executablePath` and documents it, which is more than most. The rest of the
|
||||
codebase is CDP: local CDP discovery, CDP tailing, a CDP client. Chromium references
|
||||
outnumber Firefox ones by a wide margin, and the Firefox mentions are in an OpenAPI
|
||||
schema and a client for someone else's API rather than in a launch path.
|
||||
|
||||
So the option exists and it expects a Chromium build.
|
||||
|
||||
### Skyvern
|
||||
|
||||
CDP throughout. There is no exposed way to point at a different binary, and the protocol
|
||||
would not match if there were.
|
||||
|
||||
### crawl4ai
|
||||
|
||||
The only one of these built on Playwright with Firefox genuinely selectable, through
|
||||
`browser_type="firefox"`. What is missing is any field naming a binary, so you get
|
||||
Playwright's managed build. Its own stealth mode applies `playwright-stealth`, which its
|
||||
documentation notes does not support Firefox, so that combination is largely inert.
|
||||
[The full version is here](crawl4ai-stealth-custom-browser.md).
|
||||
|
||||
### Maxun
|
||||
|
||||
Playwright is in the manifest and no executable path is exposed. As a no-code platform
|
||||
that is a coherent product decision rather than an oversight.
|
||||
|
||||
## What applies regardless of the engine
|
||||
|
||||
Swapping the browser engine changes none of the tells a server leaks, and those tells
|
||||
matter more than the binary question because they are true for every tool, CDP or
|
||||
Playwright. On a server, all of these are true at once and none of them is about
|
||||
automation:
|
||||
|
||||
- **No GPU**, so WebGL reports a software renderer.
|
||||
[What those strings give away](webgl-renderer-strings.md).
|
||||
- **A container font set** that does not match the claimed platform.
|
||||
[Why installing more is not the fix](headless-fonts-differ.md).
|
||||
- **No audio device**, and no speech voices.
|
||||
[The seven audio values](audiocontext-fingerprinting.md) and
|
||||
[the voice list](speech-synthesis-voices.md).
|
||||
- **A screen with no taskbar** and a default resolution.
|
||||
[The relationships that must hold](screen-size-headless-tells.md).
|
||||
- **Codec support** describing a slim build, including whether decoding is hardware
|
||||
accelerated. [Three surfaces in one API](codec-fingerprinting.md).
|
||||
- **A TLS handshake** decided before any of this.
|
||||
[Which nothing above the network stack can reach](ja3-ja4-tls-fingerprint.md).
|
||||
|
||||
Swapping the browser engine does not change a single item on that list. If your agent
|
||||
fails in a container and works on your laptop, this is almost certainly where the
|
||||
difference is, and it is the same for a CDP tool and a Playwright tool.
|
||||
[The container walkthrough](playwright-docker-detection.md) goes through it in order.
|
||||
|
||||
## The signal that is specific to agents
|
||||
|
||||
One signal no fingerprint work touches is the rhythm of the agent loop itself. An agent
|
||||
thinks between actions: it reads the page, calls a model, waits, then acts. The resulting
|
||||
rhythm has a shape no person produces.
|
||||
|
||||
- Long pauses clustered around **model latency** rather than around reading speed.
|
||||
- **No movement during the pause.** A person drifts, scrolls slightly, hovers. An agent's
|
||||
pointer is motionless for two seconds and then arrives.
|
||||
- Actions landing **dead centre** on targets, because coordinates come from an
|
||||
accessibility tree rather than from a hand.
|
||||
- **No wasted actions.** People hover over things they do not click and change their
|
||||
minds.
|
||||
|
||||
This explains blocks that arrive **after** a few interactions rather than at first load,
|
||||
and that timing is the cheapest diagnostic you have.
|
||||
[Human-like pointer motion](human-mouse-movement.md) covers what can be done about the
|
||||
mechanical half, and it is honest that the deliberation pattern is a different problem.
|
||||
|
||||
## This stopped being a theoretical concern in 2026
|
||||
|
||||
Agent-driven browsing used to be rare enough that most detection stacks didn't bother
|
||||
building a dedicated signal for it. That changed this year. Fingerprint, the
|
||||
commercial fingerprinting vendor behind FingerprintJS, shipped a product in early
|
||||
2026 specifically aimed at classifying AI agent traffic - not bot detection in
|
||||
general, agent detection as its own category, with its own signal set. Academic
|
||||
research published in the same period has been measuring the same target directly:
|
||||
building multi-layer fingerprints specifically to separate an LLM-driven browsing
|
||||
session from a human one, using exactly the rhythm-based signals described above
|
||||
plus whatever else the page surface gives away.
|
||||
|
||||
The practical upshot for anyone running an agent against a real site: the timing
|
||||
and pointer-behavior signal in the previous section is not a corner case anymore.
|
||||
It is an active, funded area of detection work, aimed specifically at the traffic
|
||||
pattern an agent loop produces, independent of whatever engine sits underneath it.
|
||||
Fixing the browser's fingerprint and fixing the agent's behavior are now both live
|
||||
requirements, not one obvious fix and one theoretical afterthought.
|
||||
|
||||
## The route that does accept a different engine
|
||||
|
||||
If you want an engine whose fingerprint is set in its own source and you want an agent to
|
||||
drive it, the working combination today is MCP rather than CDP.
|
||||
|
||||
Microsoft's `playwright-mcp` accepts a browser and an executable path and speaks MCP, so
|
||||
any agent framework that talks MCP can drive a patched Firefox through it.
|
||||
[That integration is written up here](integrations/playwright-mcp.md).
|
||||
|
||||
The trade is explicit: you give up the agent loop of whichever framework you were using
|
||||
and get an engine-level fingerprint. Whether that is worth it depends on which of the two
|
||||
problems at the top of this page you actually have.
|
||||
|
||||
## Conclusion
|
||||
|
||||
The honest summary is that the agent ecosystem standardised on CDP, and CDP means
|
||||
Chromium. A Firefox engine does not drop into browser-use, Stagehand or Skyvern, and
|
||||
crawl4ai is one missing field away rather than one protocol away.
|
||||
|
||||
More importantly, for most people the engine is not the binding constraint. The container
|
||||
is. Every item in the machine list above is true whichever tool you picked, and none of
|
||||
them is fixed by a stealth setting inside it.
|
||||
|
||||
Work out which problem you have first: a block at the first request points at the machine
|
||||
or the address, and a block after several actions points at behaviour.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Can I use a stealth Firefox with browser-use?** No. It drives Chrome over CDP.
|
||||
|
||||
**Does Stagehand support a custom browser?** Yes, `executablePath`, and it expects a
|
||||
Chromium build.
|
||||
|
||||
**Can crawl4ai use a patched engine?** Not through configuration. It accepts
|
||||
`browser_type="firefox"` but has no field naming a binary.
|
||||
|
||||
**Why does my agent work locally and fail in Docker?** Because the container answers
|
||||
differently about the GPU, the fonts, the audio device and the screen. The agent is
|
||||
identical.
|
||||
|
||||
**Which AI agent framework is most stealth-friendly?** The question is usually the wrong
|
||||
one. Pick on the agent loop, then fix the machine, then consider the engine.
|
||||
|
||||
**Is there any agent route to an engine-level fingerprint?** MCP, through Microsoft's own
|
||||
Playwright MCP server, which takes a browser and an executable path.
|
||||
|
||||
**See also:** [browser-use in detail](browser-use-detection.md),
|
||||
[crawl4ai in detail](crawl4ai-stealth-custom-browser.md),
|
||||
[Playwright MCP](integrations/playwright-mcp.md), and
|
||||
[the checklist for being detected on one site](playwright-detected-as-bot.md).
|
||||
|
||||
## Sources
|
||||
|
||||
- `browser_use/browser/profile.py` and `chrome.py`; Stagehand's
|
||||
`packages/core/lib/v3/launch/local.ts` and its browser configuration docs; Skyvern's
|
||||
CDP client; `crawl4ai/async_configs.py`; Maxun's package manifest. All read
|
||||
2026-07-27 and 2026-07-28.
|
||||
- Star counts from the GitHub API on the same dates.
|
||||
- The machine-level surfaces are each documented on their own page, linked above.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level. This page exists because eight separate articles all
|
||||
concluding "does not fit" would have been worse for you than one that says why.*
|
||||
@@ -0,0 +1,211 @@
|
||||
---
|
||||
title: "What is ASN and IP reputation in bot detection?"
|
||||
description: "What ASN and IP reputation are: how they score requests before JavaScript runs, how reputation builds and decays, and why a clean browser on a burned IP loses."
|
||||
parent: "Network, Proxy and WebRTC"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 23
|
||||
---
|
||||
|
||||
|
||||
# What is ASN and IP reputation in bot detection?
|
||||
|
||||
An ASN identifies which network operator an address belongs to, and IP reputation is the
|
||||
abuse history attached to that address; together they let a detector score a connection
|
||||
before a single line of JavaScript runs. This is the layer a browser cannot touch, and it
|
||||
is why a session with a flawless fingerprint can still be turned away at the door.
|
||||
|
||||
This page explains what an ASN is, how IP reputation gets built and how it decays, why a
|
||||
perfect browser on a flagged block loses anyway, and where the browser's job ends and the
|
||||
proxy's job begins.
|
||||
|
||||
## What an ASN actually is
|
||||
|
||||
An ASN, an [Autonomous System Number](https://datatracker.ietf.org/doc/html/rfc1930),
|
||||
identifies the network operator that announces a block of IP addresses to the rest of the
|
||||
internet. A residential internet provider has one or more ASNs. A cloud host has its own.
|
||||
When a connection reaches a server, the server can look up the address and learn, in a
|
||||
single query, which operator it belongs to and what kind of operator that is.
|
||||
|
||||
That last part is the point. ASNs carry a category. A range that belongs to a consumer
|
||||
internet provider looks like a person at home. A range that belongs to a hosting company
|
||||
or a cloud region looks like a server, because that is what almost everything in it is.
|
||||
The lookup is cheap, it happens at the very first packet, and it does not care in the
|
||||
slightest what browser you plan to run. A datacenter ASN is a strong prior on its own:
|
||||
real customers rarely browse a shopping site from a cloud region, so a request from one
|
||||
starts the session already suspected. This is covered in more depth in
|
||||
[can websites detect a datacenter or proxy IP](can-websites-detect-a-datacenter-proxy-ip.md),
|
||||
and the short version is that they can, directly, at the network layer.
|
||||
|
||||
## How IP reputation is built and how it decays
|
||||
|
||||
The ASN category is the coarse signal. Reputation is the fine one, and it is per-address
|
||||
and per-block rather than per-operator.
|
||||
|
||||
A reputation service records what addresses have done. If a particular IP, or the /24
|
||||
block around it, has recently been the source of credential-stuffing traffic, scraping
|
||||
runs, spam, or a burst of failed logins, that history attaches to the address. It is
|
||||
shared: the block was burned by whoever used it before you, and you inherit the score. A
|
||||
single address can also burn itself inside one session, purely by volume. If one IP opens
|
||||
several hundred sessions against the same endpoint in an hour, that velocity is itself the
|
||||
signal, independent of how human each individual session looks.
|
||||
|
||||
Reputation decays, but slowly and unevenly. An address that sat quiet for a long stretch
|
||||
recovers some standing. An address that is being actively abused right now does not, and
|
||||
the decay resets every time the block is used again. This is why a cheap shared proxy
|
||||
never really recovers: the moment its score drifts back toward neutral, the next user on
|
||||
the same block drives it back down. You are not renting a clean address, you are renting a
|
||||
position in a queue of people degrading it.
|
||||
|
||||
Three inputs, then, all read before the browser matters: the ASN's category, the block's
|
||||
abuse history, and the live session count from that address.
|
||||
|
||||
## Why a perfect fingerprint on a burned block still loses
|
||||
|
||||
A perfect fingerprint on a burned block still loses because a detector scores the network
|
||||
layer and the fingerprint layer independently, and a flawless browser can only zero out the
|
||||
second one - it has no way to reach the first.
|
||||
|
||||
invisible_playwright is designed to look like a real browser driven by a real person. The
|
||||
fingerprint is coherent, the TLS handshake belongs to a genuine Firefox, and the driver
|
||||
layer does not announce automation. That is why it passes most detection checks: the parts
|
||||
a browser controls, it controls well. What it cannot do is change the address the
|
||||
connection arrives on. A coherent browser on a burned IP is still on a burned IP.
|
||||
|
||||
The two layers are scored independently and both have to be right. Picture a detector as
|
||||
adding up evidence. The network layer contributes its verdict, a datacenter ASN or a block
|
||||
with recent abuse, before any script runs. The fingerprint layer contributes its verdict
|
||||
after. A perfect browser sets the second contribution to roughly zero, which is exactly
|
||||
what you want, but it cannot make the first contribution negative. If the network layer
|
||||
alone crosses the threshold, the session is challenged or blocked no matter how clean
|
||||
everything downstream reads. This is the mechanism behind
|
||||
[being blocked with a clean fingerprint](why-blocked-with-a-clean-fingerprint.md): nothing
|
||||
is wrong with the browser, and the browser was never the thing that failed.
|
||||
|
||||
You can prove which layer you are hitting in about a minute. Open the same URL by hand,
|
||||
from the same machine and the same exit, in a stock browser. If the manual visit is also
|
||||
challenged, the browser is not your problem and no fingerprint change will help. If the
|
||||
manual visit passes and the automated one does not, the difference is in the browser or
|
||||
the behaviour, and that is a different investigation entirely.
|
||||
|
||||
## Where the browser ends and the proxy begins
|
||||
|
||||
The division of labour is clean, and being clear about it saves a lot of wasted effort.
|
||||
|
||||
The browser's job is everything the server reads after the connection is established: the
|
||||
fingerprint fields, the TLS handshake, the absence of automation tells, the driver layer.
|
||||
invisible_playwright handles those from one seed, reproducibly. Your job, the part the
|
||||
browser cannot do for you, is three things it has no access to.
|
||||
|
||||
- **A clean exit.** An address on a consumer ASN, on a block without recent abuse, not
|
||||
already shared by a crowd. Around 90% of proxy addresses are public and therefore
|
||||
already known and scored before you send a byte through them. The clean fraction is the
|
||||
part worth paying for.
|
||||
- **Human pacing.** Session count per address is a reputation input, so hundreds of
|
||||
sessions from one IP burns it regardless of browser quality. Spread the work across
|
||||
addresses and across time.
|
||||
- **Behaviour and quotas.** Per-account limits, rate limits, and the timing of your
|
||||
actions are yours to supply. The browser looks human; whether it acts human is up to
|
||||
the code driving it.
|
||||
|
||||
One more thing that is genuinely the browser's job and is easy to mistake for a network
|
||||
problem: the browser and the exit have to tell the same story. An exit in one country
|
||||
behind a browser claiming another is a contradiction the detector reads directly, and it
|
||||
is cheap to get right. invisible_playwright derives the timezone from the egress IP by
|
||||
default, which is why
|
||||
[a timezone that does not match the proxy](timezone-proxy-mismatch.md) has its own page.
|
||||
|
||||
## A runnable example
|
||||
|
||||
The browser side is two lines. You supply the proxy; the wrapper wires it, routes DNS
|
||||
through it, and derives the timezone from its exit so the browser and the network agree.
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
proxy = {
|
||||
"server": "socks5://gate.example.com:1080",
|
||||
"username": "user",
|
||||
"password": "pass",
|
||||
}
|
||||
|
||||
# seed=42 makes the identity reproducible; the proxy is the exit you supply
|
||||
with InvisiblePlaywright(seed=42, proxy=proxy) as browser:
|
||||
page = browser.new_page()
|
||||
# confirm the exit the browser is actually leaving from,
|
||||
# rather than assuming it
|
||||
page.goto("https://example.com/ip")
|
||||
print(page.inner_text("body"))
|
||||
```
|
||||
|
||||
The `browser` object is a real Playwright
|
||||
[`Browser`](https://playwright.dev/python/docs/api/class-browser), so every standard
|
||||
method works exactly as documented upstream. Note what the example does and does not
|
||||
claim: it pins the fingerprint so a failure is reproducible, and it reads back the exit so
|
||||
you know which address your reputation is riding on. It does not make a bad address good.
|
||||
If the printed IP sits on a datacenter ASN or a burned block, the cleanest browser in the
|
||||
world is still leaving from there.
|
||||
|
||||
## Conclusion
|
||||
|
||||
ASN and IP reputation are the part of bot detection that runs before your browser gets a
|
||||
turn. The ASN says what kind of network you are on, the reputation says what that address
|
||||
and its neighbours have been doing, and the session count says how hard you are leaning on
|
||||
it right now. All three are read at connection time, none of them are in a browser's
|
||||
gift to change, and a perfect fingerprint sets its own layer to zero without touching
|
||||
theirs.
|
||||
|
||||
So the honest framing is the useful one. invisible_playwright makes the browser layer look
|
||||
like a real person's real browser, which is most of the battle and the part most tools get
|
||||
wrong. The network layer is yours: a clean exit, human pacing, and quotas you respect. Get
|
||||
both right and the session passes. Get the browser perfect on a burned block and it does
|
||||
not, and now you know exactly why.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**What is an ASN in bot detection?** The number identifying the network operator that owns
|
||||
the address you connect from. Detectors read it at the first packet to learn whether you
|
||||
look like a home connection or a datacenter, before any JavaScript runs.
|
||||
|
||||
**Can a good fingerprint fix a bad IP?** No. The two are scored independently. A perfect
|
||||
browser zeroes out its own layer but cannot make a burned or datacenter address look
|
||||
clean, so the session can still be blocked on the network verdict alone.
|
||||
|
||||
**Why does my clean browser still get blocked?** Almost always the exit. Prove it by
|
||||
opening the same URL by hand from the same machine and exit in a stock browser; if that is
|
||||
challenged too, the browser was never the problem.
|
||||
|
||||
**How does an IP get a bad reputation?** From abuse history on the address or its block,
|
||||
inherited from whoever used it before you, plus live session volume. Shared cheap proxies
|
||||
never recover because the next user re-burns the block as it decays.
|
||||
|
||||
**Does invisible_playwright give me a clean IP?** No, and it does not claim to. It handles
|
||||
the browser fingerprint, TLS and driver layers. You supply the proxy, the pacing and the
|
||||
quotas; the browser cannot change the address it arrives on.
|
||||
|
||||
**How many sessions can one IP make?** Fewer than you would like, because session count is
|
||||
itself a reputation input. Hundreds of sessions from one address burns it regardless of
|
||||
how human each session looks. Spread across addresses and across time.
|
||||
|
||||
## Sources
|
||||
|
||||
- [RFC 1930](https://datatracker.ietf.org/doc/html/rfc1930), the IETF guidelines that
|
||||
define an Autonomous System as a routing policy unit and specify the ASN that identifies
|
||||
it.
|
||||
- [Playwright's `Browser` class reference](https://playwright.dev/python/docs/api/class-browser),
|
||||
for what a launched `Browser` object exposes once the wrapper hands it back.
|
||||
- This project's release and validation gates, which test the browser layer through a real
|
||||
proxy and confirm the exit address inside the browser rather than assuming it.
|
||||
- The network-layer behaviour described here is read from public reputation and ASN-lookup
|
||||
mechanics, cross-checked against the browser layer this project controls.
|
||||
|
||||
**See also:** [can websites detect a datacenter or proxy IP](can-websites-detect-a-datacenter-proxy-ip.md)
|
||||
for the network layer in detail, [browser trust scores explained](browser-trust-score-explained.md)
|
||||
for how the fingerprint layer is scored separately, and
|
||||
[why you can be blocked with a clean fingerprint](why-blocked-with-a-clean-fingerprint.md)
|
||||
when every browser check comes back green.
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The browser layer is the
|
||||
part we can make perfect; the IP is the part only you can keep clean.*
|
||||
@@ -0,0 +1,192 @@
|
||||
---
|
||||
title: "AudioContext fingerprinting, and why adding noise backfired"
|
||||
description: "AudioContext fingerprinting is usually beaten with noise. We shipped that defence, measured it, and it made sessions easier to detect. The seven values and why."
|
||||
parent: "Canvas, WebGL, Fonts and Audio"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 8
|
||||
---
|
||||
|
||||
|
||||
# AudioContext fingerprinting, and why adding noise backfired
|
||||
|
||||
Audio fingerprinting has a reputation for being hard to defeat. It deserves it, but
|
||||
not for the reason usually given.
|
||||
|
||||
The usual reason is that the audio pipeline is low-level and mathematically involved.
|
||||
The real reason is simpler and more annoying: **the obvious defence makes you easier
|
||||
to detect, not harder.** We shipped that defence, measured it, and turned it off. This
|
||||
page is what the measurements said.
|
||||
|
||||
## What is actually being measured
|
||||
|
||||
Audio fingerprinting collects seven values from the [Web Audio
|
||||
API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API), a rendered
|
||||
sample buffer plus six device and analyser readings, and checks that they agree with
|
||||
each other. Almost every guide stops at "it hashes how your device processes sound",
|
||||
which is true and useless. Here is the concrete shape.
|
||||
|
||||
A fingerprinting script builds a short offline audio graph, usually an oscillator into
|
||||
a dynamics compressor, renders it without playing anything, and reads the resulting
|
||||
samples back:
|
||||
|
||||
```js
|
||||
const ctx = new OfflineAudioContext(1, 44100, 44100);
|
||||
const osc = ctx.createOscillator();
|
||||
const comp = ctx.createDynamicsCompressor();
|
||||
osc.connect(comp); comp.connect(ctx.destination);
|
||||
osc.start(0); ctx.startRendering();
|
||||
// then: sum the rendered samples, hash the sum
|
||||
```
|
||||
|
||||
But the rendered buffer is only one of the values collected. The full set is wider
|
||||
than people expect, and this matters because they have to agree with each other:
|
||||
|
||||
| Value | What it is |
|
||||
|---|---|
|
||||
| `AudioContext.sampleRate` | 44100 or 48000, from the audio device |
|
||||
| `AudioContext.outputLatency` | the driver's reported latency |
|
||||
| `AudioContext.destination.maxChannelCount` | stereo, 5.1, whatever the device has |
|
||||
| the rendered sample sum | the oscillator-compressor output |
|
||||
| `AnalyserNode` frequency data sum | the same graph seen through an FFT |
|
||||
| `AnalyserNode` time domain data sum | the same graph in amplitude |
|
||||
| `DynamicsCompressorNode.reduction` | one float, the applied gain reduction |
|
||||
|
||||
Seven values, one machine. A profile claiming a 5.1 sound card with a laptop's latency
|
||||
and a rendered buffer that belongs to neither is caught by comparison, and no
|
||||
individual value in it is unusual.
|
||||
|
||||
## The mistake: noise that gets asked about twice
|
||||
|
||||
The intuitive defence is the canvas one: add a small amount of noise to the rendered
|
||||
samples so the hash differs per session. We implemented exactly that, seeded so the
|
||||
same identity always produced the same audio.
|
||||
|
||||
Two things went wrong, and the second one is the interesting one.
|
||||
|
||||
### Silence is a trap
|
||||
|
||||
[CreepJS](https://abrahamjuliot.github.io/creepjs/) has a check called
|
||||
`hasFakeAudio`. It does not compare your hash to a database. It builds a buffer that
|
||||
should be **silent**, renders it, and looks at whether anything is in it.
|
||||
|
||||
```js
|
||||
new OfflineAudioContext(1, 100, 44100) // 100 samples, oscillator frequency 0
|
||||
```
|
||||
|
||||
Nothing should come out of that. On real hardware nothing does. A tool adding noise to
|
||||
every rendered buffer puts noise into silence, which is physically impossible, and the
|
||||
check records a lie.
|
||||
|
||||
It also inspects the first 100 samples of a normal buffer and counts distinct values
|
||||
there, for the same reason: the beginning of a render is predictable, so variation
|
||||
there is manufactured.
|
||||
|
||||
The fix is not to stop adding noise, it is to add it only where noise can legitimately
|
||||
exist: skip buffers short enough to be a probe, skip the opening samples, and skip
|
||||
channels that carry no input at all. Noise on a silent channel is not subtle. It is a
|
||||
claim that your sound card produces sound when it is off.
|
||||
|
||||
**The general shape, which is worth more than the specific check:** a detector does not
|
||||
have to recognise your noise. It only has to ask a question whose correct answer is
|
||||
*nothing*, and see whether it gets something.
|
||||
|
||||
### The defence was the signal
|
||||
|
||||
The second problem was not expected: with the noise correctly guarded and passing the
|
||||
silence checks, a commercial fingerprinting service still scored the browser as
|
||||
tampered. We isolated the audio noise with a kill switch and ran it both ways on the
|
||||
same machine and the same identity:
|
||||
|
||||
| Audio noise | tampering score |
|
||||
|---|---|
|
||||
| on | 0.4349 |
|
||||
| off | 0.0564 |
|
||||
|
||||
Nearly an order of magnitude, from one feature. The audio noise was not one
|
||||
contributor among many, it was the dominant one.
|
||||
|
||||
So we ship with it **off**. The un-noised audio output is still host-independent,
|
||||
because the values around it are set from the seed and the render is deterministic, and
|
||||
it matches what a real Firefox on that configuration produces. Turning the noise off
|
||||
did not make sessions linkable: it made them identical to the honest answer, which is
|
||||
what everything else on that machine is claiming anyway.
|
||||
|
||||
That inversion is the lesson worth carrying:
|
||||
|
||||
> A randomised value is not automatically safer than a fixed one. If everyone with a
|
||||
> given browser and OS produces the same audio hash, producing that same hash makes you
|
||||
> one of them. Producing a unique one makes you the only person on the internet whose
|
||||
> sound card is a snowflake.
|
||||
|
||||
Randomising helps where the honest value identifies your specific machine. It hurts
|
||||
where the honest value identifies your *class* of machine, because there the crowd is
|
||||
the disguise.
|
||||
|
||||
## Getting the details right, if you do add noise
|
||||
|
||||
Two things we got wrong on the first attempt and had to measure our way out of.
|
||||
|
||||
**Scale is per-surface.** Frequency data is in decibels, roughly -100 to 0. Time domain
|
||||
data is amplitude, -1 to 1. The same epsilon on both is either invisible on one and
|
||||
enormous on the other. We ended up around `1e-4` for frequency, `1e-7` for time domain,
|
||||
and `1e-5` for the compressor's single reduction float.
|
||||
|
||||
**The noise has to be a function of the seed and the position, not of a random number
|
||||
generator.** If it is random per call, reading the same value twice returns two
|
||||
different answers, and a script that reads it twice is a script anyone can write. Ours
|
||||
hashes the seed together with the channel index and the sample position, so the same
|
||||
identity renders the same buffer forever, and two reads agree.
|
||||
|
||||
That second point is the one that catches most tools. It is easy to check and it is
|
||||
checked.
|
||||
|
||||
## What to look at on your own setup
|
||||
|
||||
```js
|
||||
const ctx = new AudioContext();
|
||||
console.log(ctx.sampleRate, ctx.outputLatency, ctx.destination.maxChannelCount);
|
||||
ctx.close();
|
||||
```
|
||||
|
||||
- **`sampleRate` is 44100 or 48000.** Anything else is rare enough to be interesting.
|
||||
- **The three device values describe one plausible device.** A 5.1 channel count with a
|
||||
laptop latency is two devices in one answer.
|
||||
- **[`outputLatency`](https://developer.mozilla.org/en-US/docs/Web/API/AudioContext/outputLatency)
|
||||
is not zero and not identical across machines.** A container with no sound device is
|
||||
a real tell here, in the same way that [a machine with no GPU is one for
|
||||
WebGL](webgl-renderer-strings.md).
|
||||
- **Read the rendered sum twice in one session.** It must match. If it does not, your
|
||||
noise is per-call, and that is the single cheapest tampering check there is.
|
||||
- **Render a silent buffer and confirm it is silent.**
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Can I just disable AudioContext?** You can, and then you have a browser without the
|
||||
Web Audio API, which every real browser has. That is a stronger signal than any hash.
|
||||
|
||||
**Do the privacy extensions that randomise audio work?** They stop the hash being
|
||||
stable, which is what they promise. They also generally randomise per call and put
|
||||
noise in silence, both of which are detectable in one line. Against tracking, they
|
||||
help. Against a system asking whether you are tampering, they are the thing it finds.
|
||||
|
||||
**Is audio fingerprinting stronger than canvas?** It has less entropy on its own. It is
|
||||
harder to fake convincingly, because it is seven values that have to agree plus a
|
||||
render that has to look like it came from the device the other six describe.
|
||||
|
||||
**Why does my audio fingerprint differ between headless and headed?** Usually the audio
|
||||
device. A headless container often has none, so the values fall back to defaults that
|
||||
say so.
|
||||
|
||||
**See also:** [why a FingerprintJS visitor ID changes](fingerprintjs-visitor-id.md),
|
||||
since the audio hash is one of the components that ID is made of,
|
||||
[why headless browsers render different fonts](headless-fonts-differ.md)
|
||||
and [your renderer string says NVIDIA, your pixels say software](renderer-string-vs-render.md),
|
||||
which are the same "the honest answer describes your machine" problem on other
|
||||
surfaces, and [how CreepJS decides you are lying](creepjs-explained.md).
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level. The two scores above are our own A/B, on one
|
||||
machine and one identity, with the audio noise as the only variable. The feature they
|
||||
killed was one we wrote.*
|
||||
@@ -0,0 +1,226 @@
|
||||
---
|
||||
title: "AudioContext sampleRate and latency as a fingerprint"
|
||||
description: "AudioContext.sampleRate, outputLatency and maxChannelCount are read from the audio driver, so a headless server leaks. How a seeded browser keeps them coherent."
|
||||
parent: "Canvas, WebGL, Fonts and Audio"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 13
|
||||
---
|
||||
|
||||
|
||||
# AudioContext sampleRate and latency as a fingerprint
|
||||
|
||||
An `AudioContext` fingerprints a machine before it renders a single sample: `sampleRate`,
|
||||
`outputLatency` and `destination.maxChannelCount` are read straight from the operating
|
||||
system's audio driver, so a headless server with no sound hardware answers them with
|
||||
tell-tale defaults. The defence is not to spoof each number, but to return all three as
|
||||
one coherent device profile that a real machine could actually have.
|
||||
|
||||
Most writing about audio fingerprinting is about the rendered buffer: you run an
|
||||
`OfflineAudioContext`, hash the samples it produces, and treat that hash as the signal.
|
||||
That is a real surface and it has [its own page here](audiocontext-fingerprinting.md).
|
||||
|
||||
This page is about the other half, the part that needs no rendering at all. Before a
|
||||
single sample is generated, an `AudioContext` already exposes three plain numbers that
|
||||
come straight from the operating system's audio stack: `sampleRate`, `outputLatency`,
|
||||
and `destination.maxChannelCount`. They are cheaper to read than any buffer hash, they
|
||||
are stable within a session, and on a headless server they are one of the clearest
|
||||
tells that no real sound hardware is present.
|
||||
|
||||
## The three numbers a real audio stack exposes
|
||||
|
||||
Open an `AudioContext` on a normal desktop and read four fields:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
profile = page.evaluate("""() => {
|
||||
const ctx = new AudioContext();
|
||||
const out = {
|
||||
sampleRate: ctx.sampleRate,
|
||||
outputLatency: ctx.outputLatency,
|
||||
baseLatency: ctx.baseLatency,
|
||||
maxChannelCount: ctx.destination.maxChannelCount,
|
||||
};
|
||||
ctx.close();
|
||||
return out;
|
||||
}""")
|
||||
print(profile)
|
||||
```
|
||||
|
||||
Each of those fields is a question to the driver, not to the browser:
|
||||
|
||||
- **`sampleRate`** is the rate the audio device is running at, almost always `44100` or
|
||||
`48000` Hz. It is decided by the sound card and its driver, not by the page.
|
||||
- **`outputLatency`** is roughly how long it takes a sample to travel from the graph to
|
||||
the speaker. It reflects the buffer size the driver negotiated, and it differs between
|
||||
onboard audio, a USB interface, and a surround setup.
|
||||
- **`maxChannelCount`** on the destination node is how many output channels the device
|
||||
can drive: `2` for ordinary stereo, `6` for a 5.1 setup, `8` for 7.1.
|
||||
|
||||
None of these is an automation flag. They are hardware facts, and that is exactly what
|
||||
makes them useful to a detector: JavaScript cannot invent a sound card it does not have.
|
||||
|
||||
## Why the values have to agree with each other
|
||||
|
||||
The trap here is not any single value being unusual. Every one of these numbers, taken
|
||||
alone, is common. The signal is in the combination.
|
||||
|
||||
Real devices come in a small number of shapes. Onboard laptop audio tends to run stereo
|
||||
at 48000 Hz with a modest latency. A cheap USB headset might report 44100 Hz. A discrete
|
||||
sound card feeding a 5.1 receiver reports six channels and a latency in a range that
|
||||
matches a card built for that job. What you never see on real hardware is the
|
||||
cross-product: a `maxChannelCount` of 6 paired with the sample rate and latency of a
|
||||
thin laptop codec, because no such device exists.
|
||||
|
||||
That cross-value contradiction is precisely what a consistency-minded detector looks
|
||||
for, and it is the same class of check that catches a Windows user agent over a Linux
|
||||
font set, or [hardware concurrency and device memory](hardware-concurrency-device-memory.md)
|
||||
that pair oddly with the machine being claimed. A fingerprint is not a list of values,
|
||||
it is a set of relationships, and the relationships are where a naive spoof falls apart.
|
||||
|
||||
## What a headless container reports instead
|
||||
|
||||
Run the same three reads inside a server container with no sound hardware and you get one
|
||||
of two failure shapes, both of them loud.
|
||||
|
||||
The first is a null audio backend: the context comes back with a default sample rate and
|
||||
a latency that is suspiciously round or zero, the same on every container image, because
|
||||
there is no driver underneath negotiating anything. A value that is byte-identical across
|
||||
thousands of visitors is not neutral, it is a cohort.
|
||||
|
||||
The second is worse. Some headless setups fail to construct the context at all, or
|
||||
suspend it immediately, so the page sees a `state` that never reaches `running`. As with
|
||||
every other surface, [an empty or blocked result is itself a signal](how-to-test-bot-detection.md),
|
||||
not a clean pass. A detector that records suppression by name counts the absence against
|
||||
you exactly as it would count a wrong value.
|
||||
|
||||
This is the same reason [an empty speech-voice list](speech-synthesis-voices.md) gives a
|
||||
server away: both audio output and installed voices are reads into the operating system,
|
||||
and a datacenter answers them with defaults that say "datacenter".
|
||||
|
||||
## How this browser keeps the profile coherent
|
||||
|
||||
The fix is not to pick three plausible numbers independently, because independent draws
|
||||
are what produce the impossible device. The engine returns all three together as one
|
||||
coherent profile, chosen for the session from a small set of real device archetypes, so
|
||||
the values always describe a machine that could actually exist:
|
||||
|
||||
| Device archetype | `sampleRate` | `outputLatency` | `maxChannelCount` |
|
||||
|---|---|---|---|
|
||||
| Plain stereo desktop | 44100 Hz | around 40 ms | 2 |
|
||||
| USB audio interface | 48000 Hz | lower, near 30 ms | 2 |
|
||||
| 5.1-capable sound card | 48000 Hz | near 40 ms | 6 |
|
||||
|
||||
Each row is a machine that exists; the impossible combinations between rows are the ones a
|
||||
detector is looking for.
|
||||
|
||||
Because the whole profile is keyed off the session seed, a six-channel destination never
|
||||
lands next to a laptop's latency, and the same seed reproduces the same audio device on
|
||||
every run. The three fields move as a unit, which is the property the detector is testing
|
||||
for. This is the general principle these patches follow: the goal is to look like a real
|
||||
machine, not merely to avoid an obvious default, and a suppressed or arbitrary value
|
||||
fails that goal as surely as a wrong one.
|
||||
|
||||
## Measuring it yourself with a fixed seed
|
||||
|
||||
The point of a seed is that a finding is reproducible. Read the profile under two seeds
|
||||
and confirm two things at once: that each profile is internally coherent, and that the
|
||||
same seed returns the same device every time.
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
READ = """() => {
|
||||
const ctx = new AudioContext();
|
||||
const out = [ctx.sampleRate, ctx.destination.maxChannelCount,
|
||||
Math.round((ctx.outputLatency || 0) * 1000)];
|
||||
ctx.close();
|
||||
return out;
|
||||
}"""
|
||||
|
||||
for seed in (42, 1337):
|
||||
with InvisiblePlaywright(seed=seed) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
rate, channels, latency_ms = page.evaluate(READ)
|
||||
print(f"seed={seed}: {rate} Hz, {channels} ch, ~{latency_ms} ms")
|
||||
```
|
||||
|
||||
Two checks turn this into evidence rather than a single reading:
|
||||
|
||||
1. **Run each seed twice.** The tuple must be identical across runs of the same seed. If
|
||||
it drifts, something is randomising per call, which is
|
||||
[the cheapest tampering check a detector has](audiocontext-fingerprinting.md).
|
||||
2. **Sanity-check the pairing by hand.** Six channels should never appear beside a
|
||||
latency that belongs to onboard stereo. If it does, you have found the exact
|
||||
contradiction this section exists to prevent.
|
||||
|
||||
Compare the output to a stock Firefox on the same machine and you will see the shape of
|
||||
the guarantee: the stock browser reports your real card, the seeded browser reports a
|
||||
coherent invented one, and neither reports the round, hardware-free defaults a bare
|
||||
container does. If you need a specific device rather than a seed-derived one,
|
||||
[pinning a field](pinning.md) leaves the rest of the identity untouched.
|
||||
|
||||
## Conclusion
|
||||
|
||||
`sampleRate`, `outputLatency` and `maxChannelCount` are read straight from the OS audio
|
||||
driver, which means a headless server has nothing truthful to say through them and a
|
||||
careless spoof says something impossible. The buffer hash gets all the attention, but
|
||||
these three static numbers are read first and cost nothing to check. Treating them as one
|
||||
coherent device profile, reproducible from a seed, is what keeps a six-channel count from
|
||||
ever sitting next to a laptop's latency, and that pairing is the thing a consistency check
|
||||
is actually built to find.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**What is AudioContext.sampleRate and can I change it from JavaScript?** It is the rate
|
||||
the audio device runs at, `44100` or `48000` Hz, read from the driver. Page JavaScript
|
||||
cannot change it truthfully; only the engine underneath can decide what the read returns.
|
||||
|
||||
**Why does my headless server report the same audio values on every run?** Because there
|
||||
is no sound hardware, so the context falls back to a fixed default. Identical values
|
||||
across every container are a cohort, not a clean fingerprint.
|
||||
|
||||
**Is outputLatency a reliable fingerprinting signal?** On its own, weakly. In combination
|
||||
with sample rate and channel count it is strong, because only certain triples correspond
|
||||
to devices that actually exist.
|
||||
|
||||
**What does maxChannelCount reveal?** How many output channels the device can drive: 2 for
|
||||
stereo, 6 for 5.1, 8 for 7.1. A value that contradicts the latency and rate is the tell.
|
||||
|
||||
**How do I make these values consistent with each other?** Do not draw them
|
||||
independently. Pick a real device archetype and take all three from it, which is what a
|
||||
seed-derived profile does automatically.
|
||||
|
||||
**Will an empty or suspended AudioContext pass a detector?** No. A blocked or suppressed
|
||||
read is recorded as its own signal, so an absent value fails the same way a wrong one
|
||||
does.
|
||||
|
||||
## Sources
|
||||
|
||||
- W3C Web Audio API specification, which defines `sampleRate`, `baseLatency` and
|
||||
`outputLatency` on `AudioContext` and `maxChannelCount` on the destination node:
|
||||
[www.w3.org/TR/webaudio/](https://www.w3.org/TR/webaudio/).
|
||||
- MDN Web Docs on the same properties, read from the engine rather than from any single
|
||||
detector's rendering of them:
|
||||
[AudioContext.sampleRate](https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext/sampleRate),
|
||||
[AudioContext.outputLatency](https://developer.mozilla.org/en-US/docs/Web/API/AudioContext/outputLatency),
|
||||
and [AudioDestinationNode.maxChannelCount](https://developer.mozilla.org/en-US/docs/Web/API/AudioDestinationNode/maxChannelCount).
|
||||
- This project's own audio patches and their release notes, which choose the three static
|
||||
audio properties together as one coherent device profile so the values never contradict
|
||||
each other.
|
||||
|
||||
**See also:** [AudioContext fingerprinting](audiocontext-fingerprinting.md) for the
|
||||
rendered-buffer side of the same surface, [why getVoices() comes back empty](speech-synthesis-voices.md)
|
||||
for the other operating-system read that gives a server away, and
|
||||
[the checklist for being detected on one site](playwright-detected-as-bot.md) for where
|
||||
the audio device sits in the order you should debug.
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The audio device is one of
|
||||
the machine tells no page-level plugin can reach, which is why it is solved in the engine.*
|
||||
@@ -0,0 +1,148 @@
|
||||
---
|
||||
title: "Why automating login is riskier than reusing a session"
|
||||
description: "Automating a login form runs the most monitored flow on most sites. Reusing a saved session skips it, if the fingerprint still matches the one that logged in."
|
||||
parent: "The Automation Layer"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 12
|
||||
---
|
||||
|
||||
|
||||
# Why automating login is riskier than reusing a session
|
||||
|
||||
**Automating a login form is riskier than reusing a session because the login form is
|
||||
the single most heavily monitored flow on most sites, and reusing a saved session avoids
|
||||
that flow entirely.** The catch is that a reused session only holds if the browser
|
||||
fingerprint still matches the one that created it.
|
||||
|
||||
A script that fills a username, types a password and clicks submit looks like the
|
||||
obvious way to get an automated session logged in. It is also, on most sites, the
|
||||
single most heavily instrumented sequence of actions a visitor can perform - the exact
|
||||
place account-takeover and credential-stuffing defenses concentrate, because that is
|
||||
where they matter most for the site.
|
||||
|
||||
This page explains why that flow draws the most scrutiny, how session reuse skips it,
|
||||
and the one condition - fingerprint consistency - that decides whether a reused session
|
||||
keeps working.
|
||||
|
||||
## Automating the login form vs reusing a session: which is safer
|
||||
|
||||
Reusing a saved session is safer on most sites, because it never runs the login form -
|
||||
the flow where abuse defenses are strongest - and instead starts already authenticated,
|
||||
the way a returning visitor does. Automating the form can work, but it runs directly
|
||||
into the site's most aggressive checks.
|
||||
|
||||
| | Automate the login form | Reuse a saved session |
|
||||
|---|---|---|
|
||||
| What runs | Username, password, submit: the most monitored flow | No login flow; the session starts authenticated |
|
||||
| Scrutiny | Highest on the site | Same as any returning visitor |
|
||||
| Main dependency | Human-like timing, focus order, pointer motion | Fingerprint matching the session's original |
|
||||
| Fails when | Any automation signal is caught at the form | The fingerprint or exit country changes |
|
||||
|
||||
## Why the login flow specifically gets more scrutiny than the rest of the site
|
||||
|
||||
Most pages on a site are read by anyone. A login form is different: it is the one
|
||||
place where getting it wrong has a direct cost to the operator, so it is where fraud
|
||||
and abuse defenses get the most investment, updated the most often, and tuned the most
|
||||
aggressively. A page that flags automation loosely everywhere else often flags it
|
||||
tightly at the one form that asks for credentials.
|
||||
|
||||
That means every automation-detectable signal on this site - the timing between
|
||||
keystrokes, whether the pointer travelled to the field or teleported, whether a field
|
||||
was focused before it was filled, the rhythm between filling the form and submitting
|
||||
it - gets checked hardest at exactly the moment a login script runs it.
|
||||
|
||||
## The alternative: don't run the flow at all
|
||||
|
||||
Playwright's [`storage_state`](https://playwright.dev/python/docs/api/class-browsercontext#browser-context-storage-state)
|
||||
captures cookies and local storage from a context and can load them into a new one.
|
||||
Log in once, by hand or through a session you trust,
|
||||
[save and reuse that state](save-reuse-login-storage-state-playwright.md), and every
|
||||
subsequent automated session starts already authenticated - no username field, no
|
||||
password field, no submit click, and none of the scrutiny attached to that specific
|
||||
sequence.
|
||||
|
||||
```python
|
||||
# once, from a session that actually logged in
|
||||
context.storage_state(path="session.json")
|
||||
|
||||
# every run after that
|
||||
context = browser.new_context(storage_state="session.json")
|
||||
```
|
||||
|
||||
This is not a workaround. It is the same mechanism a real returning visitor uses:
|
||||
nobody who logged into a site yesterday retypes their password today, they carry a
|
||||
session cookie that says who they already are. An automated session doing the same
|
||||
thing is not imitating unusual behaviour, it is doing what every session that isn't a
|
||||
first-time login already does.
|
||||
|
||||
## The condition this depends on, and it is not optional
|
||||
|
||||
A session was created by a specific browser, on a specific machine, presenting a
|
||||
specific fingerprint at the moment of login. Replaying that session's cookies from a
|
||||
different fingerprint is asking a site to believe that the same identity suddenly
|
||||
changed its GPU, its font list, its canvas output and its TLS handshake between one
|
||||
request and the next - which is exactly the kind of cross-session inconsistency
|
||||
[a detector is built to catch](timezone-proxy-mismatch.md), regardless of whether the
|
||||
cookie itself is genuinely valid.
|
||||
|
||||
Sites that bind a session to more than a cookie - checking the fingerprint against
|
||||
what was recorded at login, not just validating the token - will flag or invalidate a
|
||||
replayed session on a mismatched machine even though the credential is real. The
|
||||
cookie proves who logged in. It does not, on its own, prove the request came from the
|
||||
same browser that did.
|
||||
|
||||
The practical requirement follows directly: the fingerprint has to stay the same
|
||||
across the login and every session that reuses it. [A profile tied to one seed](persistent-profiles.md)
|
||||
is what makes that possible - the identity that logged in and the identity replaying
|
||||
the cookie later are the same one, not two that happen to share a token.
|
||||
|
||||
## What to actually do
|
||||
|
||||
1. **Log in once**, through a session using the exact identity - seed, profile, proxy
|
||||
country - you intend to keep using.
|
||||
2. **Save `storage_state` immediately after**, while the session is fresh.
|
||||
3. **Reuse it from a context built with the same identity**, not a fresh or different
|
||||
one. The cookie and the fingerprint are a pair; only one half being right is not
|
||||
enough.
|
||||
4. **Treat expiry as certain, not exceptional.** Sessions end. Build the re-login path
|
||||
once, using the same identity, rather than improvising it the first time a saved
|
||||
session stops working.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Is it safe to automate a login form at all?** It works, and it is the highest-scrutiny
|
||||
sequence on most sites. If a session can be captured and reused instead, that avoids
|
||||
the scrutiny rather than trying to survive it.
|
||||
|
||||
**Does a valid session cookie guarantee I won't be flagged?** No. A cookie proves a
|
||||
credential. Some sites separately check whether the fingerprint replaying it matches
|
||||
the one that created it, and a mismatch there is checked independently of whether the
|
||||
token itself is genuine.
|
||||
|
||||
**Can I use one saved session across different machines or proxies?** Not safely if
|
||||
the fingerprint or exit country changes. The session and the identity that created it
|
||||
are a pair for exactly the same reason [a proxy and a timezone have to agree](timezone-proxy-mismatch.md).
|
||||
|
||||
**What happens when the saved session expires?** The automation needs a real
|
||||
re-authentication path, through the same identity that created the original session,
|
||||
not a different one improvised under pressure.
|
||||
|
||||
**See also:** [Save and reuse login with storage_state in Playwright](save-reuse-login-storage-state-playwright.md),
|
||||
for the practical capture-and-reuse steps;
|
||||
[Playwright persistent profile: what it fixes and breaks](persistent-profiles.md), for
|
||||
the identity half of this pairing;
|
||||
[how to scrape data behind a login with Playwright](how-to-scrape-behind-login-playwright.md),
|
||||
for the end-to-end flow; and
|
||||
[human-like pointer motion](human-mouse-movement.md), for what the login flow itself
|
||||
checks when there is no way to avoid running it.
|
||||
|
||||
## Sources
|
||||
|
||||
- Playwright's own [`storage_state` / `storageState`](https://playwright.dev/python/docs/api/class-browsercontext#browser-context-storage-state)
|
||||
API, for the session capture and reuse mechanism described above.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level, on why the safest login is usually the one that
|
||||
never runs as automation at all.*
|
||||
@@ -0,0 +1,227 @@
|
||||
---
|
||||
title: "Back a computer-use agent with a real browser engine"
|
||||
description: "Run OpenAI's computer-use agent inside patched Firefox by implementing its Computer interface over an invisible_playwright page, and the honest limits."
|
||||
parent: "AI Agents and Frameworks"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 16
|
||||
---
|
||||
|
||||
|
||||
# Back a computer-use agent with a real browser engine
|
||||
|
||||
A computer-use agent is a loop: take a screenshot, send it to a model, get back a
|
||||
coordinate to click or some text to type, apply it, screenshot again. The interesting
|
||||
question for anyone running one against real sites is not the model. It is what browser
|
||||
the screenshots come from and where the clicks land, because that is the part a site can
|
||||
inspect.
|
||||
|
||||
The good news is that the popular reference implementation was built to let you swap that
|
||||
part out. This page shows how, using the real invisible_playwright API, and it is honest
|
||||
about what the swap fixes and what it leaves entirely up to you.
|
||||
|
||||
## The seam that makes this easy
|
||||
|
||||
OpenAI's open `cua-sample-app` does not hardcode a browser. The screenshot-and-click loop
|
||||
drives a small, pluggable `Computer` interface, and the repository ships one
|
||||
implementation of it called `LocalPlaywrightComputer`. Every action the model returns -
|
||||
`screenshot`, `click`, `type`, `scroll`, `keypress`, `goto` - is a method the loop calls
|
||||
on whatever `Computer` object you hand it. The loop does not know or care what is behind
|
||||
those methods.
|
||||
|
||||
That seam is the whole opportunity. If you implement the same interface over a browser you
|
||||
control, the same loop now runs inside your engine. Nothing about the agent's reasoning
|
||||
changes. What changes is the thing on the other side of `screenshot()` and `click()`.
|
||||
|
||||
## What backing it with a real engine actually fixes
|
||||
|
||||
`LocalPlaywrightComputer` drives a stock automation build. invisible_playwright is a
|
||||
Firefox patched at the C++ level and driven by stock Playwright, generating a full,
|
||||
internally consistent identity per session - GPU, canvas, audio, fonts, screen, roughly
|
||||
400 fields - from one seed. Point the `Computer` interface at one of its pages and two
|
||||
concrete things move:
|
||||
|
||||
- **The engine the screenshots come from.** The pixels the model sees are rendered by a
|
||||
browser whose fingerprint, TLS handshake and driver layer read as a genuine Firefox
|
||||
rather than as an automation build announcing itself. This is why it clears most
|
||||
fingerprint, TLS and driver-layer checks: it is built to look like a real browser
|
||||
driven by a real person, not to suppress signals. A suppressed or blank surface is its
|
||||
own tell, so the goal is a present, plausible value, not a missing one.
|
||||
- **The page the clicks land on.** Coordinate clicks arrive on a page inside that engine,
|
||||
and pointer motion between them follows a Bezier curve rather than teleporting from
|
||||
point to point.
|
||||
|
||||
What it does not touch is equally important, and the next section is about that.
|
||||
|
||||
## Two lines to launch, one class to adapt
|
||||
|
||||
The launch is the same two-line change as anywhere else in these docs. `InvisiblePlaywright`
|
||||
returns a real Playwright `Browser`, so every method you already use is available:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
page.mouse.click(200, 140) # the pointer arcs there on a Bezier curve
|
||||
```
|
||||
|
||||
To feed that page to the agent, wrap it in a class that satisfies the `Computer`
|
||||
interface. This is a representative subset of the methods the loop calls; each one is a
|
||||
plain call on the real Playwright `page`:
|
||||
|
||||
```python
|
||||
import base64
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
|
||||
class InvisibleComputer:
|
||||
"""Adapts an invisible_playwright page to cua-sample-app's Computer interface."""
|
||||
|
||||
environment = "browser"
|
||||
dimensions = (1280, 800)
|
||||
|
||||
def __init__(self, page):
|
||||
self._page = page
|
||||
|
||||
def screenshot(self) -> str:
|
||||
png = self._page.screenshot()
|
||||
return base64.b64encode(png).decode()
|
||||
|
||||
def click(self, x: int, y: int, button: str = "left") -> None:
|
||||
self._page.mouse.click(x, y, button=button)
|
||||
|
||||
def type(self, text: str) -> None:
|
||||
self._page.keyboard.type(text)
|
||||
|
||||
def keypress(self, keys: list[str]) -> None:
|
||||
for key in keys:
|
||||
self._page.keyboard.press(key)
|
||||
|
||||
def scroll(self, x: int, y: int, scroll_x: int, scroll_y: int) -> None:
|
||||
self._page.mouse.move(x, y)
|
||||
self._page.mouse.wheel(scroll_x, scroll_y)
|
||||
|
||||
def goto(self, url: str) -> None:
|
||||
self._page.goto(url)
|
||||
|
||||
def get_current_url(self) -> str:
|
||||
return self._page.url
|
||||
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
computer = InvisibleComputer(page)
|
||||
# hand `computer` to the cua-sample-app Agent in place of LocalPlaywrightComputer;
|
||||
# the screenshot-and-click loop now runs inside the patched Firefox.
|
||||
```
|
||||
|
||||
Everything here uses only documented Playwright methods on a real `Browser` and `Page`.
|
||||
There is no wrapped subset to learn, which is the point of the two-line switch. Pass a
|
||||
`seed` and the identity is reproducible, so a run that gets challenged can be replayed
|
||||
exactly instead of guessed at.
|
||||
|
||||
## What it does not fix, and who supplies that
|
||||
|
||||
Swapping the engine fixes the engine and the page. It does not change two things that
|
||||
decide most real outcomes, and pretending otherwise would be dishonest.
|
||||
|
||||
- **The click rhythm.** The loop still clicks a coordinate, waits for the model, and
|
||||
clicks the next coordinate. That cadence has a shape: long pauses clustered around model
|
||||
latency rather than around reading speed, and clicks that land dead-centre on targets.
|
||||
The Bezier motion between points helps, but the higher-level timing is the agent's, and
|
||||
a site that watches behaviour rather than fingerprints is watching that. Human pacing is
|
||||
something you add on top; see [the pause shaped like model latency](ai-browser-agents-stealth.md)
|
||||
and [what human pointer motion actually looks like](human-mouse-movement.md).
|
||||
- **The network path.** The screenshots come from a real-looking Firefox, but the traffic
|
||||
still exits wherever your host or proxy sends it. A genuine browser on a datacenter
|
||||
address, or on an IP a thousand other people are using this minute, still loses. IP
|
||||
reputation, per-account quotas and rate limits are not browser properties, and no engine
|
||||
swap touches them. You supply the clean exit.
|
||||
|
||||
Set a proxy the same way as any other session, and let the browser timezone follow the
|
||||
exit rather than pinning it by hand:
|
||||
|
||||
```python
|
||||
proxy = {"server": "socks5://gate.example.com:1080", "username": "u", "password": "p"}
|
||||
with InvisiblePlaywright(seed=42, proxy=proxy) as browser:
|
||||
page = browser.new_page()
|
||||
computer = InvisibleComputer(page)
|
||||
...
|
||||
```
|
||||
|
||||
The honest summary: this raises the browser and the page from "obvious automation" to
|
||||
"indistinguishable from a real Firefox", which clears the fingerprint, TLS and driver
|
||||
layer. It leaves behaviour timing and network reputation exactly where they were, on your
|
||||
side of the line. See [why a clean fingerprint can still be blocked](why-blocked-with-a-clean-fingerprint.md)
|
||||
for what remains after the engine stops being the problem.
|
||||
|
||||
## Prove the swap did what you think
|
||||
|
||||
Do not trust the diff, measure it. Run the agent's own `screenshot()` against a public
|
||||
fingerprinting page, once with `LocalPlaywrightComputer` and once with the adapter above,
|
||||
and compare the reports field by field rather than reading the verdicts. The fields that
|
||||
move - GPU renderer, canvas hash, the driver flag, the platform string - are what the
|
||||
swap bought you. The fields that do not move, and the timing and address it cannot touch,
|
||||
are what you still owe. The method is the same one in
|
||||
[how to test bot detection without a false pass](how-to-test-bot-detection.md): assert the
|
||||
right signal is present, not that a wrong one is absent, and run it more than once.
|
||||
|
||||
## Conclusion
|
||||
|
||||
The pluggable `Computer` interface in OpenAI's `cua-sample-app` is the seam that lets you
|
||||
run the exact same screenshot-and-click loop inside a different browser. Implementing it
|
||||
over an invisible_playwright page fixes the two things a site inspects first - the engine
|
||||
the screenshots come from and the page the clicks land on - and that is genuinely most of
|
||||
the fingerprint battle. It is not the whole session. The coordinate-click rhythm and the
|
||||
network path are still yours, and an agent that looks like a real Firefox on a bad IP with
|
||||
robotic pacing is still an agent that gets caught. Swap the engine, then supply the pacing
|
||||
and the exit.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Can I use invisible_playwright with OpenAI's computer-use agent?** Yes. The
|
||||
`cua-sample-app` drives a pluggable `Computer` interface; implement that interface over an
|
||||
invisible_playwright page and the loop runs inside the patched Firefox.
|
||||
|
||||
**Does this make my agent undetectable?** No, and no tool honestly can. It makes the
|
||||
browser engine, TLS and driver layer read as a real Firefox, which clears most
|
||||
fingerprint checks. It does not fix your IP, your rate limits, or the timing of the clicks.
|
||||
|
||||
**What exactly does the engine swap change?** The screenshots are rendered by a real-looking
|
||||
Firefox instead of an automation build, and the clicks land through Bezier pointer motion.
|
||||
The higher-level click cadence and the network path are unchanged.
|
||||
|
||||
**Do I have to rewrite the agent's loop?** No. You implement one small adapter class with
|
||||
methods like `screenshot`, `click`, `type` and `scroll`, each a plain call on the real
|
||||
Playwright page. The loop stays as it is.
|
||||
|
||||
**Why does behaviour timing still matter?** Because a site can watch when you act, not just
|
||||
what your browser reports. Pauses shaped like model latency and clicks dead-centre on
|
||||
targets are a behavioural signal the engine does not touch.
|
||||
|
||||
**What proxy should I use?** A clean one. [Around 90% of proxies are already known and
|
||||
blocked](configuration.md) before you ever use them, and a perfect browser on a known IP
|
||||
still loses. Set it via the `proxy` argument and let the timezone auto-derive from the exit.
|
||||
|
||||
**See also:** [AI browser agents and stealth](ai-browser-agents-stealth.md) for what
|
||||
applies across every agent framework, [how browser-use gets detected](browser-use-detection.md)
|
||||
for the CDP-driven case, and [the checklist for being detected on one site](playwright-detected-as-bot.md)
|
||||
for the order to debug in once something flags you.
|
||||
|
||||
## Sources
|
||||
|
||||
- OpenAI's open `cua-sample-app` and its `Computer` interface, including the shipped
|
||||
`LocalPlaywrightComputer` implementation, read from the repository rather than assumed.
|
||||
- This project's own API: `InvisiblePlaywright` returns a real Playwright `Browser`, so
|
||||
the adapter above uses only documented Playwright methods - [`Page`](https://playwright.dev/python/docs/api/class-page),
|
||||
[`Mouse`](https://playwright.dev/python/docs/api/class-mouse) and
|
||||
[`Keyboard`](https://playwright.dev/python/docs/api/class-keyboard) - unchanged.
|
||||
- This project's release gates and the field-by-field comparison method documented in the
|
||||
testing pages linked above.
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The engine swap is the easy
|
||||
half; the pacing and the exit are the half that decides the session.*
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"label": "engine downloads",
|
||||
"message": "394.76k",
|
||||
"color": "2EA44F",
|
||||
"namedLogo": "github",
|
||||
"logoColor": "white",
|
||||
"cacheSeconds": 3600
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="99" height="20" role="img" aria-label="Firefox: 151.0">
|
||||
<title>Firefox: 151.0</title>
|
||||
<linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient>
|
||||
<clipPath id="r"><rect width="99" height="20" rx="3" fill="#fff"/></clipPath>
|
||||
<g clip-path="url(#r)">
|
||||
<rect width="56" height="20" fill="#555"/>
|
||||
<rect x="56" width="43" height="20" fill="#FF7139"/>
|
||||
<rect width="99" height="20" fill="url(#s)"/>
|
||||
</g>
|
||||
<g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" font-size="11">
|
||||
<text x="28.0" y="15" fill="#010101" fill-opacity=".3">Firefox</text>
|
||||
<text x="28.0" y="14">Firefox</text>
|
||||
<text x="77.5" y="15" fill="#010101" fill-opacity=".3">151.0</text>
|
||||
<text x="77.5" y="14">151.0</text>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 855 B |
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"label": "browser launches",
|
||||
"message": "8.51M",
|
||||
"color": "FF7139",
|
||||
"namedLogo": "firefoxbrowser",
|
||||
"logoColor": "white",
|
||||
"cacheSeconds": 3600
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="157" height="20" role="img" aria-label="browser launches: 8.51M">
|
||||
<title>browser launches: 8.51M</title>
|
||||
<linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient>
|
||||
<clipPath id="r"><rect width="157" height="20" rx="3" fill="#fff"/></clipPath>
|
||||
<g clip-path="url(#r)">
|
||||
<rect width="116" height="20" fill="#555"/>
|
||||
<rect x="116" width="41" height="20" fill="#007ec6"/>
|
||||
<rect width="157" height="20" fill="url(#s)"/>
|
||||
</g>
|
||||
<g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" font-size="11">
|
||||
<text x="58.0" y="15" fill="#010101" fill-opacity=".3">browser launches</text>
|
||||
<text x="58.0" y="14">browser launches</text>
|
||||
<text x="136.5" y="15" fill="#010101" fill-opacity=".3">8.51M</text>
|
||||
<text x="136.5" y="14">8.51M</text>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 898 B |
@@ -0,0 +1,16 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="86" height="20" role="img" aria-label="License: MIT">
|
||||
<title>License: MIT</title>
|
||||
<linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient>
|
||||
<clipPath id="r"><rect width="86" height="20" rx="3" fill="#fff"/></clipPath>
|
||||
<g clip-path="url(#r)">
|
||||
<rect width="56" height="20" fill="#555"/>
|
||||
<rect x="56" width="30" height="20" fill="#dfb317"/>
|
||||
<rect width="86" height="20" fill="url(#s)"/>
|
||||
</g>
|
||||
<g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" font-size="11">
|
||||
<text x="28.0" y="15" fill="#010101" fill-opacity=".3">License</text>
|
||||
<text x="28.0" y="14">License</text>
|
||||
<text x="71.0" y="15" fill="#010101" fill-opacity=".3">MIT</text>
|
||||
<text x="71.0" y="14">MIT</text>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 847 B |
@@ -0,0 +1,16 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="159" height="20" role="img" aria-label="LinkedIn: Federico Elia">
|
||||
<title>LinkedIn: Federico Elia</title>
|
||||
<linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient>
|
||||
<clipPath id="r"><rect width="159" height="20" rx="3" fill="#fff"/></clipPath>
|
||||
<g clip-path="url(#r)">
|
||||
<rect width="63" height="20" fill="#555"/>
|
||||
<rect x="63" width="96" height="20" fill="#0A66C2"/>
|
||||
<rect width="159" height="20" fill="url(#s)"/>
|
||||
</g>
|
||||
<g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" font-size="11">
|
||||
<text x="31.5" y="15" fill="#010101" fill-opacity=".3">LinkedIn</text>
|
||||
<text x="31.5" y="14">LinkedIn</text>
|
||||
<text x="111.0" y="15" fill="#010101" fill-opacity=".3">Federico Elia</text>
|
||||
<text x="111.0" y="14">Federico Elia</text>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 896 B |
@@ -0,0 +1,16 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="93" height="20" role="img" aria-label="python: 3.11+">
|
||||
<title>python: 3.11+</title>
|
||||
<linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient>
|
||||
<clipPath id="r"><rect width="93" height="20" rx="3" fill="#fff"/></clipPath>
|
||||
<g clip-path="url(#r)">
|
||||
<rect width="50" height="20" fill="#555"/>
|
||||
<rect x="50" width="43" height="20" fill="#007ec6"/>
|
||||
<rect width="93" height="20" fill="url(#s)"/>
|
||||
</g>
|
||||
<g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" font-size="11">
|
||||
<text x="25.0" y="15" fill="#010101" fill-opacity=".3">python</text>
|
||||
<text x="25.0" y="14">python</text>
|
||||
<text x="71.5" y="15" fill="#010101" fill-opacity=".3">3.11+</text>
|
||||
<text x="71.5" y="14">3.11+</text>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 851 B |
@@ -0,0 +1,16 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="73" height="20" role="img" aria-label="Stars: 2.6k">
|
||||
<title>Stars: 2.6k</title>
|
||||
<linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient>
|
||||
<clipPath id="r"><rect width="73" height="20" rx="3" fill="#fff"/></clipPath>
|
||||
<g clip-path="url(#r)">
|
||||
<rect width="43" height="20" fill="#555"/>
|
||||
<rect x="43" width="30" height="20" fill="#e8a317"/>
|
||||
<rect width="73" height="20" fill="url(#s)"/>
|
||||
</g>
|
||||
<g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" font-size="11">
|
||||
<text x="21.5" y="15" fill="#010101" fill-opacity=".3">Stars</text>
|
||||
<text x="21.5" y="14">Stars</text>
|
||||
<text x="58.0" y="15" fill="#010101" fill-opacity=".3">2.6k</text>
|
||||
<text x="58.0" y="14">2.6k</text>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 843 B |
@@ -0,0 +1,16 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="204" height="38" viewBox="0 0 204 38" role="img" aria-label="Join on Telegram">
|
||||
<title>Join on Telegram</title>
|
||||
<defs>
|
||||
<linearGradient id="g" x1="0" y1="0" x2="0" y2="1">
|
||||
<stop offset="0" stop-color="#37AEE2"/>
|
||||
<stop offset="1" stop-color="#1E96C8"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<rect x="0.5" y="0.5" width="203" height="37" rx="18.5" fill="url(#g)"/>
|
||||
<g transform="translate(20 9.5)" fill="#fff">
|
||||
<path d="M18.6 1.1 1.2 7.9c-1.0.4-1.0.9-.2 1.2l4.4 1.4 1.7 5.2c.2.6.4.7.9.3l2.5-2.0 4.2 3.1c.8.4 1.3.2 1.5-.7l2.7-12.7c.2-1.0-.4-1.5-1.3-1.1Zm-4.0 3.1-7.3 6.6-.3 3.1-1.5-4.6 9.1-5.1Z"/>
|
||||
</g>
|
||||
<text x="123" y="24.5" fill="#fff" text-anchor="middle"
|
||||
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
|
||||
font-size="15" font-weight="600">Join on Telegram</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 863 B |
|
After Width: | Height: | Size: 102 KiB |
|
After Width: | Height: | Size: 103 KiB |
@@ -0,0 +1,202 @@
|
||||
---
|
||||
title: "Battery API fingerprint: does Firefox expose it?"
|
||||
description: "Does desktop Firefox expose the Battery Status API? No, it was removed in 2017, so a battery object under a Firefox user agent gives away a fake browser."
|
||||
parent: "Browser Identity"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 29
|
||||
---
|
||||
|
||||
|
||||
# Battery API fingerprint: does Firefox expose it?
|
||||
|
||||
Short version: on the desktop, no. Firefox removed the
|
||||
[Battery Status API](https://developer.mozilla.org/en-US/docs/Web/API/Battery_Status_API)'s
|
||||
`navigator.getBattery()` from web content in the 52 series back in 2017, on privacy
|
||||
grounds, and it has never come back.
|
||||
So a real desktop Firefox has no Battery Status API at all. `navigator.getBattery` is
|
||||
`undefined`, and there is nothing to read.
|
||||
|
||||
That single fact turns the Battery API into a small but reliable consistency check. A
|
||||
page that claims to be Firefox in its user agent, and then successfully obtains a
|
||||
battery object, has not measured your battery. It has caught a browser that is lying
|
||||
about what it is. This page explains why that happens, why the honest answer is to have
|
||||
no Battery API rather than a convincing fake one, and how a genuine Firefox build gets
|
||||
that for free.
|
||||
|
||||
## What the Battery Status API was, and why Firefox dropped it
|
||||
|
||||
The Battery Status API let a page call `navigator.getBattery()` and read the charge
|
||||
level, whether the device was plugged in, and the seconds until full or empty. It was
|
||||
meant for power-aware pages that could defer heavy work on a low battery.
|
||||
|
||||
The privacy problem showed up quickly. The charge level was reported with enough
|
||||
precision, and it changed slowly enough, that the combination of level plus
|
||||
charging state plus time-remaining behaved like a short-lived identifier: two page
|
||||
loads seconds apart saw the same unusual value, and that value could be used to correlate
|
||||
visitors even across contexts that were supposed to be isolated. Firefox responded by
|
||||
removing the API from web content entirely in the
|
||||
[52 series in 2017](https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/52),
|
||||
restricting it to chrome/privileged code only. Chromium kept a
|
||||
reduced version. That divergence is the whole point for fingerprinting: the presence or
|
||||
absence of `getBattery` is now a per-engine trait, not a per-device one.
|
||||
|
||||
## Why absence is the honest answer, and a fake battery is the tell
|
||||
|
||||
A fake battery reading is the riskier of the two outcomes, because an absence matches
|
||||
every real Firefox automatically while a fake value has to survive every angle a
|
||||
detector can check it from. There are two ways an automation stack can end up
|
||||
"consistent" with a Firefox user agent on this surface.
|
||||
|
||||
The first is to actually be a Firefox build, in which case `navigator.getBattery` is
|
||||
simply not there, because the engine never defined it. Nothing is spoofed. There is no
|
||||
value to keep plausible over time, no charging animation to fake, no drain rate to model.
|
||||
The gap in the API is real, so it survives every probe automatically.
|
||||
|
||||
The second is to run an engine that does expose the Battery API, usually a Chromium base,
|
||||
and then bolt on a JavaScript layer that tries to look like Firefox. Now the stealth
|
||||
layer has a decision to make. If it leaves `getBattery` in place, the page reads a battery
|
||||
object from a claimed-Firefox browser, which no real Firefox produces, and that is a
|
||||
direct contradiction.
|
||||
|
||||
If it deletes `getBattery` to hide the mismatch, it has to delete it
|
||||
convincingly: the property has to be gone from the prototype, absent from a
|
||||
`for..in` walk, missing from `Object.getOwnPropertyNames`, and it has to stay missing when
|
||||
a detector fetches a clean copy of `Navigator.prototype` from a fresh iframe and compares.
|
||||
A partial delete that patches the obvious access but leaves a trace elsewhere is worse than
|
||||
leaving the API alone, because now there is both a Firefox user agent and evidence of
|
||||
tampering. This is the pattern CreepJS is built to catch: it does not ask what you report,
|
||||
it asks whether the shape of your environment is internally consistent and whether anything
|
||||
looks deleted.
|
||||
|
||||
The general rule, which the Battery API illustrates cleanly, is that adding a fake signal
|
||||
is almost always more dangerous than a real absence. An absence is one bit that matches
|
||||
every other Firefox on earth. A fake is a value you now have to defend against every angle
|
||||
a detector can approach it from.
|
||||
|
||||
## How the patched build inherits the gap natively
|
||||
|
||||
invisible_playwright drives a Firefox that is patched at the C++ level, not a different
|
||||
engine wearing a Firefox user agent. Because the base is a real Firefox from the current
|
||||
release line, it inherits the same missing Battery API that every stock desktop Firefox
|
||||
has had since 2017. There is no shim reintroducing `getBattery` and no shim removing it,
|
||||
because there was never anything to remove. The surface is correct for the same reason a
|
||||
stock Firefox is correct: the engine simply does not implement that API for web content.
|
||||
|
||||
That is the recurring theme across the fingerprint surface. A field is most robust when it
|
||||
is genuinely produced by a real browser rather than reconstructed on top of one. The same
|
||||
logic covers the identity fields that a page reads far more often than the battery, such
|
||||
as [what `navigator.vendor` and `navigator.productSub` report on Firefox](navigator-vendor-productsub-firefox.md),
|
||||
which are wrong on a Chromium base pretending to be Firefox and correct on an actual
|
||||
Firefox build.
|
||||
|
||||
## Check it yourself in two lines
|
||||
|
||||
Switching from stock Playwright is a two-line change, and after that every standard
|
||||
Playwright method works unchanged. Here is the whole probe: launch, open a page, and ask
|
||||
the browser whether it has a Battery API.
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
|
||||
report = page.evaluate("""() => ({
|
||||
userAgent: navigator.userAgent,
|
||||
hasGetBattery: typeof navigator.getBattery,
|
||||
onPrototype: 'getBattery' in Navigator.prototype,
|
||||
})""")
|
||||
|
||||
print(report)
|
||||
```
|
||||
|
||||
On this build you get a Firefox user agent, `hasGetBattery` equal to `"undefined"`, and
|
||||
`onPrototype` equal to `False`. That is the correct, boring result: a Firefox with no
|
||||
Battery API, exactly like the one a person runs. The `seed=42` argument makes the whole
|
||||
identity reproducible, so if you are comparing this against a stock Firefox on the same
|
||||
machine you can rerun the exact same fingerprint rather than a fresh random one each time.
|
||||
|
||||
The comparison is the part worth doing by hand. Open the same probe in a stock desktop
|
||||
Firefox and you will see the identical three values. Open it in a plain Chromium and
|
||||
`hasGetBattery` comes back `"function"`. That contrast, run against a real reference
|
||||
browser rather than read as a verdict, is the method the
|
||||
[testing guide](how-to-test-bot-detection.md) argues for on every surface.
|
||||
|
||||
## What a passing battery check does not buy you
|
||||
|
||||
This is where honesty matters, because it is easy to overread a green result.
|
||||
|
||||
Having no Battery API, correctly, tells a detector that this browser looks like a genuine
|
||||
Firefox on this one narrow surface. It says nothing whatsoever about your network. The
|
||||
Battery API cannot see your IP address, your exit country, or how many requests you have
|
||||
made in the last minute. A browser can be a flawless Firefox on every fingerprint field
|
||||
and still be turned away because the exit IP is a known datacenter range, because the
|
||||
account behind the session hit a per-account quota, because the requests arrived faster
|
||||
than a human hands could produce them, or because the pointer never moved before the click.
|
||||
|
||||
invisible_playwright is designed to look like a real browser driven by a real person, and
|
||||
that is genuinely why it passes most fingerprint, TLS and driver-layer checks: the engine
|
||||
is a real Firefox, so the traits it reports are the traits Firefox actually has, this API
|
||||
absence among them. But it does not supply a clean IP, it does not pace your actions, and
|
||||
it does not manage per-account limits. Those are yours to bring: a reputable exit, human
|
||||
timing, and sane volume. The [configuration guide](configuration.md) covers the proxy and
|
||||
timezone side of that, and the [detected-on-one-site checklist](playwright-detected-as-bot.md)
|
||||
walks the causes in the order they are usually the real culprit, with the network exit near
|
||||
the bottom of the list rather than the top.
|
||||
|
||||
## Conclusion
|
||||
|
||||
The Battery Status API is a clean example of a detection signal that is best handled by not
|
||||
existing. Desktop Firefox removed it in 2017, so the honest state for anything claiming to
|
||||
be Firefox is to have no `getBattery` at all. A stealth layer that adds a fake battery
|
||||
object to a non-Firefox engine creates the exact contradiction it was trying to avoid, and
|
||||
one that tries to delete the API instead has to delete it perfectly or leave a tampering
|
||||
trace. A patched real-Firefox build sidesteps the whole dilemma by inheriting the gap
|
||||
natively. It is a small surface, it costs nothing to get right, and getting it right is
|
||||
worth exactly as much as it is: one consistent bit, and not one bit more about your IP or
|
||||
your behaviour.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Does Firefox have a Battery API?** Not on the desktop for web content. It was removed in
|
||||
the 52 series in 2017 for privacy reasons, so `navigator.getBattery` is `undefined`.
|
||||
|
||||
**Is a battery reading under a Firefox user agent a red flag?** Yes. A real desktop Firefox
|
||||
cannot return a battery object, so a page that gets one from a claimed-Firefox browser has
|
||||
caught a fake.
|
||||
|
||||
**Does Chrome still expose it?** Chromium kept a reduced Battery API, which is why the
|
||||
presence or absence of `getBattery` now works as a per-engine trait rather than a
|
||||
per-device one.
|
||||
|
||||
**Should a stealth tool fake a battery to look complete?** No. Adding a fake signal is more
|
||||
dangerous than a real absence, because the fake has to survive every angle a detector can
|
||||
probe from, while an absence matches every other Firefox automatically.
|
||||
|
||||
**Does invisible_playwright spoof the Battery API?** No. It drives a real patched Firefox,
|
||||
so the API is simply absent the same way it is absent in a stock Firefox. There is nothing
|
||||
to spoof.
|
||||
|
||||
**If my battery check passes, am I undetectable?** No. This surface says nothing about your
|
||||
IP reputation, per-account quotas, rate limits, or behaviour. A clean proxy and human pacing
|
||||
are still on you.
|
||||
|
||||
## Sources
|
||||
|
||||
- Mozilla's own [Firefox 52 release notes](https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/52),
|
||||
which record the Battery Status API becoming available only to chrome/privileged code
|
||||
in that release, 2017.
|
||||
- This project's own fingerprint parity checks, which read `navigator.getBattery` against a
|
||||
stock desktop Firefox and confirm both report the same absence.
|
||||
|
||||
**See also:** [what data websites collect about your browser](what-data-websites-collect-about-your-browser.md),
|
||||
[the navigator.vendor and productSub story on Firefox](navigator-vendor-productsub-firefox.md),
|
||||
and [how navigator.webdriver actually reads](navigator-webdriver-explained.md).
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The most robust fingerprint
|
||||
field is the one a real browser genuinely produces, and sometimes the one it genuinely does
|
||||
not.*
|
||||
@@ -0,0 +1,187 @@
|
||||
---
|
||||
title: "BFCache and pageshow.persisted under browser automation"
|
||||
description: "Automation disables the back/forward cache, so pageshow.persisted is always false and every Back is a full reload. Why sites notice, and what enabling it costs."
|
||||
parent: "Browser Identity"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 13
|
||||
---
|
||||
|
||||
|
||||
# BFCache and pageshow.persisted under browser automation
|
||||
|
||||
**Under browser automation, `pageshow.persisted` is almost always `false`, because the
|
||||
drivers switch the
|
||||
[back/forward cache](https://developer.mozilla.org/en-US/docs/Glossary/bfcache) off.**
|
||||
Every back navigation becomes a full reload
|
||||
instead of an instant restore, and a page that pays attention to the difference is
|
||||
looking at a browser that behaves unlike every consumer browser of the last decade.
|
||||
|
||||
Press Back in a real browser and the previous page usually comes back instantly,
|
||||
restored from memory with its JavaScript state intact. The page is told about it: a
|
||||
`pageshow` event fires with `persisted` set to `true`. Under automation that almost never
|
||||
happens.
|
||||
|
||||
This page covers what the cache does, what automation does to it, why the difference is
|
||||
visible, what turning it back on breaks in your own tests, and how to decide.
|
||||
|
||||
## What the back/forward cache actually does
|
||||
|
||||
When you navigate away, the browser can keep the whole page in memory rather than
|
||||
discarding it: the DOM, the JavaScript heap, the scroll position, the state of your
|
||||
variables. Navigate back and it is restored rather than rebuilt.
|
||||
|
||||
The page finds out through the
|
||||
[`pageshow`](https://developer.mozilla.org/en-US/docs/Web/API/Window/pageshow_event) event:
|
||||
|
||||
```js
|
||||
window.addEventListener('pageshow', (e) => {
|
||||
console.log('restored from bfcache:', e.persisted);
|
||||
});
|
||||
window.addEventListener('pagehide', (e) => {
|
||||
console.log('kept in bfcache:', e.persisted);
|
||||
});
|
||||
```
|
||||
|
||||
`persisted` is `true` on a restore and `false` on an ordinary load. It is a single
|
||||
boolean, available to any script, and it is normally used for legitimate purposes such as
|
||||
re-running analytics on a restored view.
|
||||
|
||||
## What automation does to it
|
||||
|
||||
Automation switches the cache off deliberately, in both major engines, so it never
|
||||
restores a page. Two different situations, both ending in the same place.
|
||||
|
||||
**Firefox under Playwright.** The driver that Playwright uses to control Firefox sets
|
||||
`disallowBFCache` on every docshell it manages. That is a deliberate choice on its part:
|
||||
a cached page makes automation less predictable, because state survives navigations that
|
||||
a test expects to reset.
|
||||
|
||||
**Chromium under automation.** The cache is generally not in play either, and there is a
|
||||
long-standing question on the Playwright tracker about how to enable it at all.
|
||||
|
||||
The result is the same in both: `event.persisted` is `false` on every navigation, always,
|
||||
in a browser where a real user would frequently see `true`.
|
||||
|
||||
## Why a page can notice
|
||||
|
||||
The difference is not subtle once you look for it, and none of it needs a fingerprinting
|
||||
library.
|
||||
|
||||
**The event itself.** A session that navigates back and forth several times and reports
|
||||
`persisted: false` every single time describes a browser with the cache disabled.
|
||||
Disabling it is not something ordinary users do.
|
||||
|
||||
**The timing.** A restore is immediate because nothing is rebuilt. A reload fetches,
|
||||
parses and executes. A page that measures how long its own initialisation took on a back
|
||||
navigation sees two very different numbers.
|
||||
|
||||
**The side effects of a reload.** Scripts run again, timers restart, counters reset,
|
||||
analytics fire a fresh page view. A page holding in-memory state watches it vanish on
|
||||
every back navigation, which is behaviour it can compare against what it expects.
|
||||
|
||||
None of this is a strong standalone signal. It belongs to the same family as
|
||||
[the pointer that teleports](human-mouse-movement.md): one more way in which the session
|
||||
does not behave like a person's browser, cheap to check and rarely thought about.
|
||||
|
||||
## How this project handles it, and what it costs you
|
||||
|
||||
The behaviour here is inverted relative to the stock driver: the cache is **left enabled
|
||||
by default**, so a back navigation restores the page and `persisted` comes back `true`,
|
||||
which is what a real Firefox does. The old behaviour is available behind a preference for
|
||||
anyone who needs it.
|
||||
|
||||
The cost is real and you should know it before you enable this anywhere:
|
||||
|
||||
**[`go_back()`](https://playwright.dev/python/docs/api/class-page#page-go-back) waiting
|
||||
for `load` can time out.** A bfcache restore does not fire `load`,
|
||||
because nothing loaded. Code that navigates back and waits for that event will sit there
|
||||
until the timeout expires.
|
||||
|
||||
```python
|
||||
# fragile once bfcache is enabled
|
||||
page.go_back() # may wait for a load that never comes
|
||||
|
||||
# robust either way
|
||||
page.go_back(wait_until="domcontentloaded")
|
||||
page.wait_for_selector("#something-on-the-previous-page")
|
||||
```
|
||||
|
||||
Waiting for something you can see is more robust than
|
||||
[waiting for a lifecycle event](how-to-wait-for-page-load-playwright.md) anyway, and it
|
||||
works whether or not the page was restored.
|
||||
|
||||
**State survives navigation.** That is the point of the cache, and it is also the thing
|
||||
that makes a test suite non-deterministic if the suite assumed a fresh page. If your
|
||||
tests depend on state being reset by going back, they were depending on the automation
|
||||
behaving unlike a browser.
|
||||
|
||||
## Deciding which behaviour you want
|
||||
|
||||
The two cases genuinely differ and it is worth being explicit rather than picking a
|
||||
default:
|
||||
|
||||
- **A test suite against your own application.** Predictability is worth more than
|
||||
realism, nothing is watching, and a cache that preserves state between steps causes
|
||||
flakiness. Disabling it is reasonable.
|
||||
- **A session that needs to look like a person's browsing.** Realism wins, and the cost
|
||||
is writing navigation waits that do not depend on `load`.
|
||||
|
||||
The mistake is not choosing either one. It is not knowing which you have, and then being
|
||||
surprised by a timeout or by a signal.
|
||||
|
||||
## Conclusion
|
||||
|
||||
The back/forward cache is a small thing that automation turns off for good engineering
|
||||
reasons, and turning it off produces a browser whose back button behaves differently from
|
||||
every consumer browser.
|
||||
|
||||
The fix is not complicated. Leave the cache on and stop waiting for `load` after a back
|
||||
navigation. The second half is what actually costs effort, and it is the reason the stock
|
||||
drivers made the other choice.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**What does `event.persisted` mean?** That the page was restored from the back/forward
|
||||
cache rather than loaded again.
|
||||
|
||||
**Why is `persisted` always false in Playwright?** Because the driver disables the cache,
|
||||
in Firefox explicitly and in Chromium effectively.
|
||||
|
||||
**Can a site detect that bfcache is disabled?** It can observe that back navigations
|
||||
never restore, which is not how consumer browsers behave. It is a weak signal on its own
|
||||
and it belongs to a family of weak behavioural signals.
|
||||
|
||||
**Why does `go_back()` hang after I enable bfcache?** Because a restore does not fire
|
||||
`load`. Wait for `domcontentloaded` or for an element instead.
|
||||
|
||||
**Should I enable it?** For realistic sessions yes, for deterministic test suites
|
||||
probably not.
|
||||
|
||||
**Does bfcache leak state between pages?** It preserves state within a page across
|
||||
navigation, which is its purpose. There is an open Playwright issue about globals
|
||||
appearing to leak between pages because of it, which is worth reading if you see
|
||||
something odd.
|
||||
|
||||
**See also:** [human-like mouse movement](human-mouse-movement.md), the same category of
|
||||
behavioural difference, and
|
||||
[the checklist for being detected on one site](playwright-detected-as-bot.md), where
|
||||
behaviour is step five, and [how websites detect bots](how-do-websites-detect-bots.md)
|
||||
for where behavioural signals sit in the wider picture.
|
||||
|
||||
## Sources
|
||||
|
||||
- [MDN: the back/forward cache (bfcache)](https://developer.mozilla.org/en-US/docs/Glossary/bfcache)
|
||||
and [MDN: the `pageshow` event](https://developer.mozilla.org/en-US/docs/Web/API/Window/pageshow_event),
|
||||
which documents `persisted`.
|
||||
- Playwright's documented [`go_back()`](https://playwright.dev/python/docs/api/class-page#page-go-back)
|
||||
and its `wait_until` values, including `domcontentloaded`.
|
||||
- The Playwright tracker's open items on bfcache behaviour and on enabling it under
|
||||
Chromium.
|
||||
- This project's driver, which reads a preference before disabling the cache and leaves
|
||||
it enabled by default, with the `go_back` caveat recorded alongside it.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level. The preference exists because the timeout described
|
||||
above is real, and a test suite that hits it deserves a way back to the old behaviour.*
|
||||
@@ -0,0 +1,261 @@
|
||||
---
|
||||
title: "WebDriver BiDi vs CDP: does the new protocol hide you"
|
||||
description: "WebDriver BiDi standardizes the automation control wire across browsers, but the leaks that expose automation live in the page, not on the protocol you speak."
|
||||
parent: "Comparisons"
|
||||
nav_order: 19
|
||||
---
|
||||
|
||||
|
||||
# WebDriver BiDi vs CDP: does the new protocol hide you
|
||||
|
||||
There is a hope, repeated often enough that it is worth answering directly, that
|
||||
WebDriver BiDi is the fix for automation detection. The reasoning goes: the old
|
||||
Chrome DevTools Protocol had a famous leak, everyone is moving to a standardized
|
||||
bidirectional protocol, so the standardized one must close it.
|
||||
|
||||
It does not, and the reason is the useful part. The leak people are trying to
|
||||
escape was never on the protocol wire. It is in the page. Changing which wire the
|
||||
driver speaks over leaves the page-level artifacts exactly where they were.
|
||||
|
||||
## The protocol is the control channel, not the fingerprint
|
||||
|
||||
The protocol is the wire a driver speaks over, not the fingerprint a page reads,
|
||||
so changing it moves nothing a detector looks at. CDP, BiDi and Firefox's own
|
||||
Juggler are all
|
||||
control channels: the out-of-process link a driver uses to say "open a page", "go
|
||||
to this URL", "evaluate this script", "give me the console messages". They are
|
||||
plumbing between your Python process and the browser process.
|
||||
|
||||
A detection script running inside the page cannot see that channel at all. It
|
||||
cannot see whether the command that opened the tab arrived as CDP JSON, as a BiDi
|
||||
message, or as a Juggler call. What it can see is whatever the browser does to the
|
||||
page as a side effect of being driven: a property that reads differently, a global
|
||||
that should not exist, a built-in prototype that was touched before the first
|
||||
script ran, a loop that runs measurably slower because the engine is in a
|
||||
different mode.
|
||||
|
||||
So the question "does BiDi hide me" is really two questions that get conflated. Is
|
||||
the control channel itself observable? Mostly no, for any of the three. Does
|
||||
switching the control channel change the in-page artifacts? Also no, because those
|
||||
artifacts are produced by a different mechanism entirely.
|
||||
|
||||
## What CDP's Runtime.enable leak actually was
|
||||
|
||||
The CDP `Runtime.enable` leak was a page-visible side effect of how Chromium
|
||||
automation manages JavaScript execution contexts, not a property of the CDP wire
|
||||
itself. It is narrower than the folklore around it, so it is worth stating
|
||||
exactly.
|
||||
|
||||
On Chromium, automation libraries call the CDP command `Runtime.enable` to manage
|
||||
the execution contexts they need for evaluating JavaScript. That call has an
|
||||
in-page side effect: it causes the browser to emit context-creation events, and a
|
||||
page can provoke and observe the timing of that machinery. Ordinary browsing never
|
||||
triggers it, so its footprint reads as automation. Two separate projects,
|
||||
[Patchright](vs-patchright.md) and
|
||||
[rebrowser-patches](vs-rebrowser-patches.md), independently converged on the same
|
||||
fix: stop calling `Runtime.enable` automatically and create the needed contexts by
|
||||
hand, with identifiers the page cannot correlate back to the session.
|
||||
|
||||
Notice what that fix is and is not. It is not "switch protocols". It is a change to
|
||||
how the driver uses the protocol so that the observable side effect stops
|
||||
happening in the page. The leak lived in the page; the fix lives at the driver.
|
||||
The protocol name never entered into it.
|
||||
|
||||
## Firefox automation here rides Juggler out of band
|
||||
|
||||
This project does not patch that leak because it never had it. The Firefox we ship
|
||||
is driven by stock Playwright over Juggler, an out-of-band control protocol that is
|
||||
not CDP and has no `Runtime.enable` command to call. There is no automatic
|
||||
context-enable step whose in-page timing a script can measure, because that step is
|
||||
a CDP-shaped thing and this is not CDP.
|
||||
|
||||
That is an architecture difference, not a cleverness difference. The
|
||||
`Runtime.enable` timing signal is specific to how CDP-driven Chromium manages
|
||||
execution contexts. A driver that manages contexts differently, over a different
|
||||
channel, does not emit that particular event and so cannot be caught by a probe
|
||||
looking for it. The class of Chromium hand-patches that exist to suppress it has no
|
||||
counterpart here for the same reason a Linux binary has no Windows registry to
|
||||
clean.
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
# A stock Playwright script. The control channel underneath is Juggler,
|
||||
# not CDP, so there is no Runtime.enable side effect for a page to time.
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
# standard Playwright: the returned object is a real Browser
|
||||
print(page.title())
|
||||
```
|
||||
|
||||
None of that code mentions the protocol, which is the point: the wire is an
|
||||
implementation detail of the driver, and the same script would work if it changed.
|
||||
|
||||
## What WebDriver BiDi standardizes, and what it leaves untouched
|
||||
|
||||
WebDriver BiDi is a genuinely good thing and worth being precise about. It is a
|
||||
[W3C effort](https://www.w3.org/TR/webdriver-bidi/) to give every browser one
|
||||
bidirectional automation protocol, so that a driver can subscribe to events and
|
||||
issue commands the same way across engines, instead of CDP on one family and
|
||||
something bespoke on another. Firefox, Chromium and others implement it.
|
||||
Playwright itself has been building BiDi support. If you have ever wanted "one
|
||||
protocol, every browser", this is that.
|
||||
|
||||
What it standardizes is the shape of the control channel: the commands, the
|
||||
events, the subscription model. What it does not do, because it is not what a
|
||||
control protocol is for, is change what the browser exposes to the page. BiDi has
|
||||
no clause that turns off [`navigator.webdriver`](does-playwright-set-navigator-webdriver.md), no clause about whether a helper
|
||||
runs in the page's realm before the page's own scripts, no clause about whether the
|
||||
JavaScript engine is in a mode that runs loops slower. Those are engine and driver
|
||||
behaviors. A standardized wire carries them just as faithfully as a proprietary one.
|
||||
|
||||
The mental model that trips people up is that CDP and BiDi are alternatives on the
|
||||
same axis as "detected" and "not detected". They are not. Protocol choice and
|
||||
detectability are orthogonal. You can be trivially detectable over BiDi and hard to
|
||||
detect over Juggler, or the reverse, and the protocol name predicts neither.
|
||||
|
||||
## The leaks that survive any protocol change
|
||||
|
||||
If the wire is not where the tells are, where are they? Two families, both in the
|
||||
page, both indifferent to which control channel drove the browser.
|
||||
|
||||
The first is execution-context timing. Attaching a driver to the JavaScript engine
|
||||
can put realms into a debug-adjacent mode where the optimizing JIT is off and slow
|
||||
paths run on every call, and that is measurable from the page as time, with no
|
||||
property to read. It is
|
||||
[why a fingerprinting service can report developer tools with none open](debugger-timing-detection.md).
|
||||
Whether the driver spoke CDP, BiDi or Juggler to attach makes no difference to the
|
||||
resulting distribution; what matters is whether the engine was left in that mode.
|
||||
This project's fix was to attach without entering debug mode at all, so the JIT
|
||||
stays on. That is an engine change, and it would be exactly as necessary under BiDi.
|
||||
|
||||
The second is injected globals and touched built-ins. If a driver runs a helper in
|
||||
the page's own realm before the page loads, and that helper touches `JSON`,
|
||||
`Date.prototype` or `Array.prototype`, then the page starts life with built-ins
|
||||
that something else handled first, and that is observable. In a controlled
|
||||
experiment that was the difference between a session being blocked and not. The fix
|
||||
is to never touch the page realm until the page's own first script has run. Again:
|
||||
a driver behavior, carried identically over any wire. A page reading a leftover
|
||||
global does not know or care how the global got injected.
|
||||
|
||||
There is also a separate, wire-adjacent failure mode worth naming so it is not
|
||||
confused with the above: the driver and browser can drift out of agreement about
|
||||
the protocol's own field set, which
|
||||
[breaks the client rather than exposing it to the page](playwright-protocol-drift.md).
|
||||
That is a maintenance surface every automation stack has, standardized protocol or
|
||||
not, and it is orthogonal to detection too.
|
||||
|
||||
## How to choose, and what to actually measure
|
||||
|
||||
The practical upshot is that "which protocol" is not a stealth decision. Pick the
|
||||
protocol for engineering reasons: BiDi for cross-browser uniformity and a stable
|
||||
standard, CDP where you need a Chromium-specific capability it exposes, Juggler if
|
||||
you are on this project's Firefox because that is what it speaks. The three differ
|
||||
on engineering properties, but not on the axis people ask about here:
|
||||
|
||||
| Protocol | Cross-browser standard | `Runtime.enable`-style context leak | Control wire visible to the page | Protocol choice changes detectability |
|
||||
|---|---|---|---|---|
|
||||
| CDP | No (Chromium family) | Yes, until hand-patched at the driver | No | No |
|
||||
| WebDriver BiDi | Yes (W3C, multi-engine) | No such standardized clause | No | No |
|
||||
| Juggler | No (Firefox, this project) | No `Runtime.enable` command exists | No | No |
|
||||
|
||||
Then measure the
|
||||
things that actually decide detection, none of which the protocol choice sets.
|
||||
|
||||
The measurement that separates the real question from the imagined one is timing
|
||||
and page state against a stock browser on the same machine, not a protocol audit:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
PROBE = """
|
||||
() => {
|
||||
// 1. any global that a normal browser would not have?
|
||||
const suspects = Object.getOwnPropertyNames(window)
|
||||
.filter(n => /puppet|driver|automation|cdc_|selenium/i.test(n));
|
||||
// 2. rough JIT-sanity number; compare the RATIO to a stock browser
|
||||
const t = performance.now();
|
||||
for (let i = 0; i < 5e6; i++) Math.sqrt(i);
|
||||
const loopMs = performance.now() - t;
|
||||
// 3. did anything claim a user gesture nobody made?
|
||||
const ua = navigator.userActivation || {};
|
||||
return { suspects, loopMs, isActive: ua.isActive, webdriver: navigator.webdriver };
|
||||
}
|
||||
"""
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
print(page.evaluate(PROBE))
|
||||
```
|
||||
|
||||
Run the same probe in a stock browser and diff the results. The absolute loop
|
||||
number means nothing on its own; the ratio between the two browsers is the JIT
|
||||
signal. A non-empty `suspects` list is an injected-global leak. `webdriver` should
|
||||
read as it does on a clean browser. Every one of those is a page-level property,
|
||||
and every one of them would report the same value whether the tab was opened over
|
||||
CDP, BiDi or Juggler.
|
||||
|
||||
## Conclusion
|
||||
|
||||
WebDriver BiDi is worth adopting for what it is: one standard control protocol
|
||||
across browsers, which is a real convenience and a real cleanup. It is not a
|
||||
stealth upgrade, because it operates on the wrong axis. The `Runtime.enable` leak
|
||||
that made CDP notorious was a page-visible side effect of how one protocol managed
|
||||
contexts, fixed at the driver, not by changing wires. The leaks that remain,
|
||||
execution-context timing and injected globals, live in the page and the engine, and
|
||||
a standardized wire carries them as faithfully as a proprietary one. This project's
|
||||
Firefox never had the CDP leak because it does not speak CDP, and it closes the
|
||||
in-page leaks in the engine and driver, which is the layer where they actually are.
|
||||
Choose the protocol for engineering reasons and measure detection where it lives.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Does switching from CDP to WebDriver BiDi make me undetectable?** No. The
|
||||
protocol is the control channel; the tells that flag automation are in the page and
|
||||
the engine, and they read the same over any wire.
|
||||
|
||||
**Was the CDP Runtime.enable leak a protocol problem?** It was a page-visible side
|
||||
effect of how CDP-driven Chromium managed execution contexts. The fix changes how
|
||||
the driver uses the protocol, not which protocol it is.
|
||||
|
||||
**Does this project have the Runtime.enable leak?** No. Its Firefox is driven over
|
||||
Juggler out of band, which has no `Runtime.enable` command, so the signal that
|
||||
several Chromium projects hand-patch never exists here to begin with.
|
||||
|
||||
**Is WebDriver BiDi bad, then?** Not at all. It is a solid cross-browser standard
|
||||
worth adopting for uniformity and stability. It just is not a detection fix,
|
||||
because detectability and protocol choice are orthogonal.
|
||||
|
||||
**What actually gives automation away if not the protocol?** Execution-context
|
||||
timing when the engine is left in a debug-adjacent mode, globals or touched
|
||||
built-in prototypes injected into the page realm, and behavior. All page-level or
|
||||
engine-level, none of them on the wire.
|
||||
|
||||
**How do I test my own setup?** Run a timing-and-globals probe in your automated
|
||||
browser and in a stock browser on the same machine, and diff them. The ratio, not
|
||||
the protocol name, is the signal.
|
||||
|
||||
## Sources
|
||||
|
||||
- This project's own debugger and execution-context fixes, described in
|
||||
[why an attached debugger makes automation detectable](debugger-timing-detection.md),
|
||||
for the in-page timing and injected-global leaks that survive a protocol change.
|
||||
- The [Patchright](vs-patchright.md) and [rebrowser-patches](vs-rebrowser-patches.md)
|
||||
comparisons on this site, read from each project's own repository, for what the
|
||||
CDP `Runtime.enable` fix is and is not.
|
||||
- The [WebDriver BiDi specification](https://www.w3.org/TR/webdriver-bidi/)'s own
|
||||
scope, for what a standardized control protocol standardizes and what it leaves
|
||||
to the engine.
|
||||
|
||||
**See also:** [why an attached debugger makes automation detectable](debugger-timing-detection.md)
|
||||
for the page-level leaks in detail, [invisible_playwright vs rebrowser-patches](vs-rebrowser-patches.md)
|
||||
for the CDP fix arrived at twice, and [how to test whether your browser is detected](how-to-test-bot-detection.md)
|
||||
for the compare-against-stock method this page leans on.
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The protocol under
|
||||
the driver is an implementation detail; the leaks were never on the wire.*
|
||||
@@ -0,0 +1,223 @@
|
||||
---
|
||||
title: "Block images to speed up scraping (and when not to)"
|
||||
description: "Blocking images, fonts and media with route.abort() cuts bandwidth and wall-clock time, but a no-image waterfall is itself a tell. When to use it and when not to."
|
||||
parent: "Scraping with Playwright"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 92
|
||||
---
|
||||
|
||||
|
||||
# Block images to speed up scraping (and when not to)
|
||||
|
||||
Aborting image, font and media requests is one of the biggest speed wins available to a
|
||||
Playwright scraper, and it is two lines of code. It is also, on the wrong page, a clean
|
||||
way to get yourself noticed. A browser that fetches HTML and JavaScript and never a
|
||||
single image produces a request pattern no human session shows.
|
||||
|
||||
So this is not a pure win, and that is the reason it gets its own page. Blocking
|
||||
resources is the right call for internal test runs and for bulk data pulls where transfer
|
||||
cost dominates. It is the wrong call on exactly the sessions you most want to look human.
|
||||
This page covers what it saves, the two lines that do it, the tell it creates, and where
|
||||
the line between the two cases falls.
|
||||
|
||||
## What blocking resources actually saves
|
||||
|
||||
On most pages the HTML and the JavaScript are a small fraction of the bytes. Images,
|
||||
web fonts and any autoplaying media are the rest, and on an image-heavy listing page
|
||||
they are the large majority of the transfer. If your scraper only reads text, prices or
|
||||
structured data out of the DOM, every one of those bytes is downloaded and thrown away.
|
||||
|
||||
Aborting them changes two things you can measure:
|
||||
|
||||
- **Bandwidth.** On an image-heavy page the transfer routinely drops from a few megabytes
|
||||
to a few hundred kilobytes. Over tens of thousands of pages that is the difference
|
||||
between a proxy bill you notice and one you do not.
|
||||
- **Wall-clock time.** The page reaches its "loaded" state sooner because it is no longer
|
||||
waiting on the slowest large assets, and `page.goto` returns earlier. The saving is
|
||||
largest on pages that block rendering on fonts or lazy-load a wall of images.
|
||||
|
||||
The mechanic is stock Playwright, and it works identically under invisible_playwright:
|
||||
the wrapper returns a real Playwright `Browser`, so [`page.route` and `route.abort`](https://playwright.dev/python/docs/network#abort-requests)
|
||||
behave exactly as documented upstream. There is no special API to learn.
|
||||
|
||||
## The two lines that do it
|
||||
|
||||
Register a route handler, abort the resource types you do not need, and continue
|
||||
everything else. The launch is the usual two-line switch from stock Playwright.
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
# resource types that are pure weight for a text/data scrape
|
||||
BLOCK = {"image", "media", "font"}
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
|
||||
page.route(
|
||||
"**/*",
|
||||
lambda route: route.abort()
|
||||
if route.request.resource_type in BLOCK
|
||||
else route.continue_(),
|
||||
)
|
||||
|
||||
page.goto("https://example.com")
|
||||
print(page.title())
|
||||
```
|
||||
|
||||
The async form is the same shape:
|
||||
|
||||
```python
|
||||
from invisible_playwright.async_api import InvisiblePlaywright
|
||||
|
||||
BLOCK = {"image", "media", "font"}
|
||||
|
||||
async with InvisiblePlaywright(seed=42) as browser:
|
||||
page = await browser.new_page()
|
||||
|
||||
async def router(route):
|
||||
if route.request.resource_type in BLOCK:
|
||||
await route.abort()
|
||||
else:
|
||||
await route.continue_()
|
||||
|
||||
await page.route("**/*", router)
|
||||
await page.goto("https://example.com")
|
||||
print(await page.title())
|
||||
```
|
||||
|
||||
Two notes that save time later. Register the route **before** `goto`, or the first
|
||||
navigation's assets are already in flight before the handler exists. And keep
|
||||
`stylesheet` out of the block set unless you have checked the page: some layouts compute
|
||||
element positions from CSS, and dropping it can move the very nodes your selectors point
|
||||
at. `image`, `media` and `font` are the safe core; add `stylesheet` only after you
|
||||
confirm the DOM you read still resolves.
|
||||
|
||||
## The tell: a request waterfall no human produces
|
||||
|
||||
A real person's browser loads images, fetches the fonts the page asks for, and pulls the
|
||||
tracking pixel and the hero media without being told twice - and a scraper that refuses
|
||||
all three produces a request waterfall no human session shows. That is the honest
|
||||
caveat, and it is the whole reason this page is not just "block everything, go faster".
|
||||
|
||||
The network waterfall of a genuine session has a characteristic shape: a burst of mixed
|
||||
resource types, images arriving late and out of order, fonts blocking early paint. A
|
||||
session that fetches the HTML document and a handful of scripts and then goes silent has
|
||||
none of that shape. It is a request pattern that belongs to a scraper and to almost
|
||||
nothing else.
|
||||
|
||||
This is not a fingerprint that the engine can spoof. invisible_playwright is built to
|
||||
look like a real browser driven by a real person, and that is why it passes most
|
||||
detection: the [fingerprint, the TLS handshake and the driver layer read as a genuine
|
||||
Firefox](does-playwright-support-firefox-stealth.md). But *which requests you choose to
|
||||
make* is your behaviour, not the browser's identity. If your code refuses every image on
|
||||
a page a human would load, you have hand-built a behavioural tell that no stealth layer
|
||||
touches, the same category as a pointer that teleports or a form filled in eighty
|
||||
milliseconds. The [checklist for being flagged on one site](playwright-detected-as-bot.md)
|
||||
puts behaviour above the proxy for exactly this reason.
|
||||
|
||||
So the block set is a decision about the session, not a global optimisation you turn on
|
||||
once and forget.
|
||||
|
||||
## Where to block, and where not to
|
||||
|
||||
Split your work into two buckets and treat them differently.
|
||||
|
||||
**Block resources freely when load does not need to look human:**
|
||||
|
||||
- **Internal test runs and CI.** You are checking your own selectors and your own
|
||||
extraction, not passing anyone's inspection. Speed is the only axis that matters.
|
||||
- **Bulk data pulls where transfer cost dominates** and the endpoint is not scoring you,
|
||||
for example a site you have permission to crawl, an API-backed page, a
|
||||
[sitemap walk](how-to-scrape-a-sitemap-playwright.md) over thousands of URLs where the
|
||||
proxy bill is the real constraint.
|
||||
|
||||
**Leave images loading when the session needs to look human:**
|
||||
|
||||
- **The first visit to a page that is clearly scoring the session**, or any flow that
|
||||
starts behind a challenge. The seconds you save are not worth the waterfall shape.
|
||||
- **Anything interactive that a human would look at.** If the run
|
||||
[scrolls, clicks and reads](human-mouse-movement.md), it should also be pulling the
|
||||
images a reader would see.
|
||||
|
||||
A middle path exists and is often the right one: block the heaviest single type only.
|
||||
Dropping `media` and web `font` requests while still loading `image` keeps most of the
|
||||
human waterfall shape and still cuts real weight, because autoplaying video and large
|
||||
font files are frequently the worst offenders. Measure your own pages before deciding the
|
||||
block set is worth the tell.
|
||||
|
||||
## What this does not fix
|
||||
|
||||
Blocking resources is a speed and cost lever. It is not a stealth lever, and on its own
|
||||
it changes none of the things that actually decide whether a session gets through.
|
||||
|
||||
- **IP reputation.** A [datacenter or already-flagged
|
||||
exit](can-websites-detect-a-datacenter-proxy-ip.md) is visible before the first byte of
|
||||
HTML, and no route rule touches it. Supply a clean proxy yourself.
|
||||
- **Per-account quotas and rate limits.** Fetching fewer bytes per page does not raise a
|
||||
cap. If anything, going faster lets you hit it sooner, so pair aggressive blocking with
|
||||
[deliberate pacing](how-to-rate-limit-your-scraper-playwright.md).
|
||||
- **Behaviour and timing.** The waterfall shape above is one behavioural signal; pointer
|
||||
motion, dwell time and request cadence are others, and they are your responsibility, not
|
||||
the engine's.
|
||||
|
||||
invisible_playwright makes the browser read as a real Firefox. The clean proxy and the
|
||||
human pacing are the parts you bring. Blocking images speeds up the run; it does not move
|
||||
any of these three.
|
||||
|
||||
## Conclusion
|
||||
|
||||
`route.abort()` on `image`, `media` and `font` is a large, cheap speed and bandwidth win,
|
||||
and it works identically under invisible_playwright because the wrapper hands you a real
|
||||
Playwright browser. The catch is that a no-image request waterfall is a behavioural tell,
|
||||
so scope it: block freely on test runs and bulk pulls where load is the constraint, and
|
||||
leave images loading on the sessions you most want to read as human. When in doubt, block
|
||||
the heaviest type only and measure, rather than switching everything off and hoping the
|
||||
shape goes unnoticed.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Does blocking images make Playwright faster?** Yes, often substantially, because images,
|
||||
fonts and media are usually the bulk of a page's bytes and a text scrape throws all of
|
||||
them away. Wall-clock time drops because the page stops waiting on the slowest assets.
|
||||
|
||||
**How do I block images in Playwright?** Register a `page.route("**/*", ...)` handler
|
||||
before `goto` and call `route.abort()` when `route.request.resource_type` is `image`,
|
||||
`media` or `font`, and `route.continue_()` otherwise.
|
||||
|
||||
**Does blocking images get me detected?** It can. A session that fetches HTML and scripts
|
||||
but never an image produces a request waterfall no human session shows. That is a
|
||||
behavioural tell, separate from your fingerprint, and no stealth layer hides it.
|
||||
|
||||
**Should I also block CSS and JavaScript?** Usually not. Many pages compute layout and
|
||||
render content from CSS and JavaScript, so blocking them can move or remove the nodes your
|
||||
selectors read. Start with `image`, `media` and `font` only.
|
||||
|
||||
**Will this make invisible_playwright undetectable?** No, and nothing does. It makes the
|
||||
browser read as a real Firefox, which is most of the battle, but IP reputation, account
|
||||
quotas, rate limits and timing are yours to handle with a clean proxy and human pacing.
|
||||
|
||||
**When should I not block images?** On the first visit to a page that is clearly scoring
|
||||
the session, and on any interactive flow a human would actually look at. There, looking
|
||||
human is worth more than the seconds you save.
|
||||
|
||||
## Sources
|
||||
|
||||
- Playwright's [request interception API](https://playwright.dev/python/docs/network#abort-requests)
|
||||
(`page.route`, `route.abort`, `route.continue_` and
|
||||
[`request.resource_type`](https://playwright.dev/python/docs/api/class-request#request-resource-type)),
|
||||
read from its own documentation rather than a rendered example.
|
||||
- This project's own measurements of per-page transfer on image-heavy pages, where images,
|
||||
fonts and media are consistently the majority of the bytes.
|
||||
- The behavioural-tell reasoning in this project's detection notes, where request shape is
|
||||
treated as behaviour rather than fingerprint.
|
||||
|
||||
**See also:** [pulling images down on purpose when you do want them](how-to-download-images-in-bulk-playwright.md),
|
||||
[the checklist for being detected on one site](playwright-detected-as-bot.md), and
|
||||
[testing bot detection without a false pass](how-to-test-bot-detection.md).
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The speed is stock
|
||||
Playwright; the tell is the part the speed guides leave out.*
|
||||
@@ -0,0 +1,147 @@
|
||||
---
|
||||
title: "What BotD actually detects, and what it does not"
|
||||
description: "What BotD's twenty detectors actually check, read from its own source: mostly whether a browser is telling the truth about which engine it is, not automation."
|
||||
parent: "Detectors, Explained"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 3
|
||||
---
|
||||
|
||||
|
||||
# What BotD actually detects, and what it does not
|
||||
|
||||
BotD is the open-source bot detector from the FingerprintJS team. It is small, it is
|
||||
readable, and reading it changes how you think about this problem, because most of
|
||||
its twenty detectors are not looking for automation at all.
|
||||
|
||||
They are checking whether your browser is telling the truth about **which browser it
|
||||
is**.
|
||||
|
||||
Read from source on 2026-07-27 (`fingerprintjs/BotD`, `src/detectors/`).
|
||||
|
||||
## The twenty detectors
|
||||
|
||||
```
|
||||
app_version distinctive_properties document_element_keys
|
||||
error_trace eval_length function_bind
|
||||
languages_inconsistency mime_types_consistence notification_permissions
|
||||
plugins_array plugins_inconsistency process
|
||||
product_sub rtt user_agent
|
||||
webdriver webgl window_external
|
||||
window_size
|
||||
```
|
||||
|
||||
Exactly one of those, [`webdriver`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/webdriver),
|
||||
is the check everybody knows. A handful look for
|
||||
specific named tools. The rest are engine identity and internal consistency.
|
||||
|
||||
| Detector group | The question it asks | Examples named here |
|
||||
|---|---|---|
|
||||
| The one everyone knows | Is the automation flag set? | `webdriver` |
|
||||
| Engine identity | Does the browser behave like the engine its user agent claims? | `eval_length`, `product_sub`, `error_trace`, `window_external` |
|
||||
| Internal consistency | Do two views of the same fact agree, and does a real machine and window exist? | `languages_inconsistency`, `mime_types_consistence`, `plugins_inconsistency`, `rtt`, `window_size` |
|
||||
|
||||
## The interesting group: what engine are you really?
|
||||
|
||||
Some values are decided by the JavaScript engine and cannot be changed from
|
||||
JavaScript without being obvious. BotD reads them, works out which engine you must
|
||||
be, and compares that against what your user agent claims.
|
||||
|
||||
**`eval_length`.** `eval.toString().length` is a fixed number per engine, the same
|
||||
category of leak as [any other native function's own source](tostring-native-code-detection.md).
|
||||
The check is literally: if the length is 37 and the engine kind is not WebKit or Gecko,
|
||||
that is a bot. A Chromium build claiming to be Firefox fails here on a value nobody thinks
|
||||
to spoof.
|
||||
|
||||
**`product_sub`.** If the browser claims to be Chrome, Safari, Opera or WeChat, then
|
||||
[`navigator.productSub`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/productSub)
|
||||
must be `20030107`. Firefox reports `20100101`. One
|
||||
comparison, no ambiguity ([why a real Firefox reports `20100101`](navigator-vendor-productsub-firefox.md)).
|
||||
|
||||
**`error_trace`.** Stack traces are formatted differently by different engines, and
|
||||
the detector matches the string for known tool signatures, PhantomJS among them.
|
||||
|
||||
**`function_bind`**, **`window_external`**, **`app_version`**: the same idea on other
|
||||
surfaces. `window_external` matches `window.external.toString()` against a known
|
||||
commercial crawler's signature.
|
||||
|
||||
None of these are secret. They are just values a spoofing layer does not think about,
|
||||
because they are not on the list of "things bots are known for".
|
||||
|
||||
## The second group: does your story hold together?
|
||||
|
||||
This group never asks whether a value is unusual. It asks whether two values that
|
||||
must agree actually do, and whether a real machine and window are behind them.
|
||||
|
||||
**`languages_inconsistency`**, **`mime_types_consistence`**,
|
||||
**`plugins_inconsistency`**: the same fact asked in two ways, with the answers
|
||||
compared. Not "is this value unusual" but "do these two agree".
|
||||
|
||||
**`rtt`**, **`window_size`**: values a real machine and a real window have, and a
|
||||
container often does not.
|
||||
|
||||
**`document_element_keys`** and **`distinctive_properties`**: attributes and globals
|
||||
that specific automation tools leave behind, which is the closest BotD gets to
|
||||
looking for bots directly.
|
||||
|
||||
## What this means if you are on the other side
|
||||
|
||||
Three things follow: spoofing a user agent alone tends to make a browser easier to
|
||||
detect rather than harder, being a genuine instance of the engine you claim passes
|
||||
this whole detector class for free, and the risk BotD does not touch moves to other
|
||||
signals entirely. They are the same three that turn up everywhere in this area.
|
||||
|
||||
**[Spoofing a user agent alone is worse than not spoofing it](is-changing-user-agent-enough.md).** Change the string and
|
||||
you have to change `productSub`, `eval.toString().length`, the stack-trace format,
|
||||
`window.external`, and the plugin and MIME arrays to match, or you have created the
|
||||
exact contradiction BotD is built to find. Most user-agent spoofing makes a browser
|
||||
easier to detect, not harder.
|
||||
|
||||
**Being a real instance of what you claim passes this whole class for free.** A real
|
||||
Firefox reporting Firefox has the right `productSub`, the right `eval` length, the
|
||||
right stack format and the right plugin array, because they are not claims, they are
|
||||
the engine. There is nothing to keep consistent because nothing was changed.
|
||||
|
||||
**The remaining risk moves elsewhere.** Passing every one of these twenty says
|
||||
nothing about whether [your GPU string is plausible](webgl-renderer-strings.md), your
|
||||
fonts match your platform, or [your timezone agrees with your IP](timezone-proxy-mismatch.md).
|
||||
Those are the ones that decide modern outcomes and BotD does not look at them.
|
||||
|
||||
## Checking your own
|
||||
|
||||
BotD is on npm and takes about four lines to run. Do it on the machine that will do
|
||||
the work instead of your laptop, and read which detectors fired rather than the
|
||||
verdict.
|
||||
|
||||
If any of the engine-identity group fires, stop and fix that first: it means the
|
||||
browser you are presenting is not the browser you are running, and no amount of work
|
||||
on the other surfaces compensates for that.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**What is BotD?** The open-source bot detector from the FingerprintJS team. It runs in
|
||||
the page and returns a verdict rather than a fingerprint.
|
||||
|
||||
**Is BotD the same as FingerprintJS?** No. FingerprintJS
|
||||
[identifies a visitor across sessions](fingerprintjs-visitor-id.md). BotD answers a
|
||||
different question: is this automation.
|
||||
|
||||
**Why does most of it not look like bot detection?** Because most detectors check which
|
||||
browser engine you really are, by testing behaviours that differ between engines. A
|
||||
browser claiming one engine and behaving like another is the finding.
|
||||
|
||||
**Can I pass it by setting `navigator.webdriver` to undefined?** No. That is
|
||||
[one detector out of roughly twenty](navigator-webdriver-explained.md).
|
||||
|
||||
**Does passing BotD mean I am undetected?** It means one open-source detector found
|
||||
nothing. Commercial systems combine far more, including things no in-page script can
|
||||
see.
|
||||
|
||||
**See also:** [what sannysoft checks](sannysoft-explained.md), which is the older
|
||||
list of the same kind, and [how CreepJS detects tampering](creepjs-explained.md),
|
||||
which takes the consistency idea considerably further.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright).
|
||||
We gate every release on BotD, so the detector names and the compared values above
|
||||
come out of its source and not out of memory.*
|
||||
@@ -0,0 +1,159 @@
|
||||
---
|
||||
title: "Browser extensions are a fingerprint surface"
|
||||
description: "An installed browser extension is a fingerprint surface a page can detect three ways. How sites find extensions, and why a stealth extension backfires."
|
||||
parent: "Browser Identity"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 12
|
||||
---
|
||||
|
||||
|
||||
# Browser extensions are a fingerprint surface
|
||||
|
||||
Yes, a website can detect an installed browser extension, and it can do so three
|
||||
separate ways: by probing the resources the extension exposes, by watching what it
|
||||
changes on the page, and by spotting the traces its API overrides leave behind. So an
|
||||
extension is not just a feature you add. It is another
|
||||
[fingerprint surface](what-is-a-browser-fingerprint.md), and the most common reason
|
||||
people add one is to hide a fingerprint, which is where this gets circular.
|
||||
|
||||
Adding an extension to an automated browser feels like adding a feature. It is also
|
||||
adding something a page can look for, and the sections below cover each of the three
|
||||
detection paths, when an extension is safe to run, and how to load one into a Firefox
|
||||
profile if you decide to.
|
||||
|
||||
## The three ways a page finds an extension
|
||||
|
||||
**[Web-accessible resources](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/web_accessible_resources).**
|
||||
An extension that exposes files to pages does so at a URL containing its own
|
||||
identifier. Fetch that URL and see whether it loads.
|
||||
|
||||
```js
|
||||
fetch('moz-extension://<id>/<file>') // resolves only if that extension is here
|
||||
```
|
||||
|
||||
The identifier differs per browser and, in Firefox, per profile, which limits the
|
||||
scan. It does not eliminate it, because extensions that need page access often need
|
||||
predictable resources.
|
||||
|
||||
**What it does to the page.** An ad blocker removes elements, so a page can insert a
|
||||
bait element with a name matching a common filter list and check whether it survived.
|
||||
A style-injecting extension changes computed values. Anything that modifies the DOM
|
||||
leaves the modification behind, and the modification is the detection.
|
||||
|
||||
**The behaviour it adds.** An extension that patches `navigator` or the canvas has to
|
||||
run before the page, and it leaves the same traces as any other page-level override:
|
||||
own properties where prototypes are expected, getters that are not native,
|
||||
[a `toString` that prints your source](tostring-native-code-detection.md).
|
||||
|
||||
## Why a stealth extension is usually the wrong shape
|
||||
|
||||
A stealth extension on top of a stealth engine usually makes you easier to detect, not
|
||||
harder, because two components deciding the same values contradict each other. This is
|
||||
worth stating plainly, because it is the most common reason someone asks how to load
|
||||
one.
|
||||
|
||||
A stealth extension operates at the page layer. It runs inside the document, it is
|
||||
made of JavaScript, and everything on
|
||||
[the three levels page](playwright-stealth-levels.md) about that layer applies to it. It
|
||||
also has to run before the page's own scripts, which is a race it does not always win.
|
||||
|
||||
And if the browser already sets those values in its engine, the extension is now a
|
||||
second opinion arguing with the first. Two components deciding what `navigator` says do
|
||||
not average out; they disagree, and the disagreement is easier to spot than either
|
||||
answer alone. That is the same argument as
|
||||
[turning off a crawler's own fingerprint generator](playwright-detected-as-bot.md).
|
||||
|
||||
So: extensions for functionality, yes. Extensions for stealth on top of a stealth
|
||||
engine, no.
|
||||
|
||||
## Extensions that are fine, and how to think about the rest
|
||||
|
||||
Ask what the extension does to the page:
|
||||
|
||||
- **Nothing visible to the page.** A tab manager, something that only touches its own
|
||||
UI. Effectively invisible.
|
||||
- **Changes what the page sees.** Blockers, style injectors, script managers. Findable,
|
||||
and worth knowing that ad blockers are extremely common on real browsers, so their
|
||||
presence is not by itself unusual. Their *absence* is more unusual than people
|
||||
assume.
|
||||
- **Rewrites browser APIs.** The fingerprinting-protection kind. These are the ones
|
||||
that create the arguing-with-the-engine problem.
|
||||
|
||||
The second point deserves emphasis, because it cuts against the instinct. A very large
|
||||
share of real browsers run an ad blocker. A profile that carries none is not
|
||||
suspicious on its own, but it is one more small way in which a fresh automated profile
|
||||
differs from a used personal one, alongside
|
||||
[having no cookies](recaptcha-v3-score.md).
|
||||
|
||||
## How to load one, if you decide to
|
||||
|
||||
There is no extension argument in this wrapper. What there is is a
|
||||
[persistent profile](persistent-profiles.md), and an extension installed into that
|
||||
profile stays there:
|
||||
|
||||
```python
|
||||
with InvisiblePlaywright(seed=42, profile_dir="/path/to/profile") as browser:
|
||||
...
|
||||
```
|
||||
|
||||
Launch once with that path, install the `.xpi` the normal way through the browser's own
|
||||
add-ons page, then reuse the directory. Without `profile_dir`, every session builds a
|
||||
fresh profile from the seed, which is exactly why an extension installed in one run is
|
||||
gone in the next.
|
||||
|
||||
Pair a stable profile with a [stable seed](reproducible-agent-browser-identity-seed.md).
|
||||
A profile that accumulates cookies and
|
||||
storage while the hardware it claims changes every launch is a session whose history
|
||||
and machine disagree about how long it has existed.
|
||||
|
||||
## Checking what yours is exposing
|
||||
|
||||
```js
|
||||
// does a known resource resolve?
|
||||
fetch('moz-extension://<id>/manifest.json').then(r => console.log('present', r.status))
|
||||
.catch(() => console.log('not found'));
|
||||
|
||||
// did something remove my bait element?
|
||||
const bait = document.createElement('div');
|
||||
bait.className = 'ad-banner ads adsbox';
|
||||
bait.style.height = '10px';
|
||||
document.body.appendChild(bait);
|
||||
setTimeout(() => console.log('blocked:', bait.offsetHeight === 0), 100);
|
||||
```
|
||||
|
||||
Then run the same checks with no extensions loaded and compare. Anything that differs
|
||||
is what the extension is telling the page about you.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Can websites detect browser extensions?** Yes, through web-accessible resources,
|
||||
through what the extension does to the page, and through the traces any API override
|
||||
leaves.
|
||||
|
||||
**Does using an ad blocker make me more detectable?** It makes you findable, not
|
||||
unusual. Ad blockers are very common on real browsers.
|
||||
|
||||
**Should I use a stealth extension with a stealth browser?** No. Two layers deciding
|
||||
the same values contradict each other, and the contradiction is a stronger signal than
|
||||
either.
|
||||
|
||||
**How do I add an extension in Playwright with Firefox?** Through a persistent profile:
|
||||
install it once into that profile, then reuse the directory.
|
||||
|
||||
**Why does my extension disappear between runs?** Because a fresh profile is generated
|
||||
each launch unless you pass a persistent one.
|
||||
|
||||
**Are extension IDs the same everywhere?** In Firefox they are typically per-profile,
|
||||
which limits blind scanning. Do not rely on that as protection; extensions that need
|
||||
page access tend to expose predictable resources anyway.
|
||||
|
||||
**See also:** [Function.prototype.toString and the native code check](tostring-native-code-detection.md),
|
||||
which is what a page-level extension runs into, and
|
||||
[three ways to make Playwright undetected](playwright-stealth-levels.md), for why the
|
||||
layer an extension lives at has a ceiling.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level. This page exists because someone asked in our
|
||||
discussions and got an answer about a different kind of extension entirely.*
|
||||
@@ -0,0 +1,262 @@
|
||||
---
|
||||
title: "Browser trust scores explained: what the number means"
|
||||
description: "CreepJS trust, FingerprintJS confidence and reCAPTCHA v3 score measure different things: what each trust score means and why one green does not imply the rest."
|
||||
parent: "Detectors, Explained"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 8
|
||||
---
|
||||
|
||||
|
||||
# Browser trust scores explained: what the number means
|
||||
|
||||
CreepJS trust, FingerprintJS confidence and a reCAPTCHA v3 score all look like the
|
||||
same kind of number, and they are not: one counts contradictions, one measures how
|
||||
sure a match is, and one estimates behavioural risk. A high number from one says
|
||||
almost nothing about what the next one will read, and treating them as interchangeable
|
||||
is the single most common misreading behind "I pass one test and fail the next".
|
||||
|
||||
This page separates the three numbers people conflate, says what each one is actually
|
||||
counting, and shows why passing one implies nothing about the others. Then it shows
|
||||
how to read all three from one reproducible session so you can stop guessing which
|
||||
number moved.
|
||||
|
||||
## Three numbers, three different questions
|
||||
|
||||
The three numbers answer three unrelated questions: CreepJS trust asks whether your
|
||||
values contradict each other, a FingerprintJS visitor ID asks whether you are the same
|
||||
visitor as last time, and a reCAPTCHA v3 score asks how risky your behaviour and history
|
||||
look. Line them up and the confusion evaporates:
|
||||
|
||||
- **CreepJS trust** is a consistency and lie count. It is high when nothing you report
|
||||
contradicts anything else you report and nothing looks tampered with. It is not a
|
||||
rarity score, and being unusual does not lower it.
|
||||
- **A FingerprintJS visitor ID** is a hash, and the thing next to it labelled
|
||||
**confidence** is a separate number that says how sure the library is that this ID
|
||||
belongs to the same visitor as before. It is about linkability, not about looking
|
||||
automated.
|
||||
- **A reCAPTCHA v3 score** is a risk estimate between 0.0 and 1.0, built mostly from
|
||||
behaviour and reputation rather than from what the DOM reports at all.
|
||||
|
||||
| Number | The question it answers | What it reads | What moves it |
|
||||
|---|---|---|---|
|
||||
| CreepJS trust | Do my reported values contradict each other? | Descriptors, prototypes, stack traces, canvas and font surfaces | A patched or blocked probe, or two fields that disagree |
|
||||
| FingerprintJS visitor ID (+ confidence) | Am I the same visitor as before? | A hash of the browser's components, in a fixed order | Any one component changing changes the whole ID |
|
||||
| reCAPTCHA v3 score | How risky do my behaviour and history look? | Interaction, cookies, storage and exit reputation, not the DOM | A warmed-up profile and realistic behaviour, not a cleaner fingerprint |
|
||||
|
||||
Different inputs, different outputs, different failure modes. The rest of this page is
|
||||
one section per number, then why they do not move together.
|
||||
|
||||
## CreepJS trust: a lie count, not a rarity score
|
||||
|
||||
[CreepJS records a blocked probe as a lie](creepjs-explained.md) and walks
|
||||
descriptors, prototypes and stack traces looking for values that were patched after
|
||||
the fact. Its trust figure goes up when the surfaces agree with each other and down
|
||||
when one of them looks edited or refuses to answer.
|
||||
|
||||
The part people get wrong: rarity does not enter into it. An identity that no other
|
||||
machine on earth shares can score perfectly, as long as every field is internally
|
||||
coherent. Conversely, the most common machine in the world scores badly the moment two
|
||||
of its fields disagree, because a lie is a contradiction and a contradiction is what
|
||||
this tool counts.
|
||||
|
||||
So the way to raise this number is not to look average. It is to be consistent: one
|
||||
platform reported everywhere, a canvas that hashes the same twice in a row, a font
|
||||
list that belongs to the operating system you claim. That is a property of how the
|
||||
identity is generated, not a value you can paste in.
|
||||
|
||||
## The FingerprintJS visitor ID and its separate confidence
|
||||
|
||||
[A FingerprintJS visitor ID is a hash of its components](fingerprintjs-visitor-id.md),
|
||||
around forty-one of them, serialised in a fixed order. There is no partial match:
|
||||
change one component and the whole ID changes as if everything had. That is why the
|
||||
same identity gives you the same ID and a different identity gives you a completely
|
||||
different one, with nothing in between.
|
||||
|
||||
The `confidence` sitting beside the ID is a different number entirely. It does not tell
|
||||
you whether you look automated. It tells you how reliable the library thinks this
|
||||
particular match is, based on how stable the components it collected tend to be. You
|
||||
can have a low-confidence ID on a perfectly clean browser and a high-confidence ID on a
|
||||
browser that is obviously a bot. The two numbers are answering "who is this" and "how
|
||||
sure am I", and neither is answering "is this a robot".
|
||||
|
||||
If your goal is to be recognised again, you want this ID stable. If your goal is to not
|
||||
be recognised, you want it to change. Either way, it is orthogonal to the trust number
|
||||
above.
|
||||
|
||||
## The reCAPTCHA v3 score: behaviour and history, not the DOM
|
||||
|
||||
reCAPTCHA v3 hands the site a number between 0.0 and 1.0, and
|
||||
[a fresh browser tends to score low on reCAPTCHA v3](recaptcha-v3-score.md) even when
|
||||
every fingerprint check it faces comes back clean. The reason is that this score is
|
||||
largely about history and behaviour, and a brand new profile has neither.
|
||||
|
||||
An empty profile is a browser that has never been anywhere: no cookies, no consent
|
||||
decisions, no storage, no prior interaction. There are far more automated sessions that
|
||||
look like that than human ones, and the score reflects that base rate rather than any
|
||||
DOM property you did or did not spoof. Perfecting your canvas hash does not move a
|
||||
number that was never reading your canvas.
|
||||
|
||||
This is the honest caveat the other two numbers do not carry: a stable, consistent,
|
||||
non-lying fingerprint is necessary and not sufficient here. It removes the reasons to
|
||||
distrust you; it does not manufacture the past you do not have. That part is warmed-up
|
||||
profiles, realistic behaviour and a reputable exit, none of which a fingerprint layer
|
||||
can supply.
|
||||
|
||||
## Why passing one says nothing about the others
|
||||
|
||||
The three numbers are independent, so a high score on one predicts nothing about the
|
||||
other two. Put them side by side and the independence is obvious:
|
||||
|
||||
- You can score high on CreepJS trust and low on reCAPTCHA v3, because a perfectly
|
||||
consistent browser with no history is exactly what a consistent bot also looks like.
|
||||
- You can have a stable, high-confidence FingerprintJS ID and still fail CreepJS,
|
||||
because a stable ID only means your components did not move, not that they are
|
||||
telling the truth.
|
||||
- You can pass reCAPTCHA v3 on a warmed profile and fail CreepJS, because behavioural
|
||||
reputation says nothing about whether a descriptor was patched.
|
||||
|
||||
They cross-cut. Each of the [four detector deep-dives in this set](how-to-test-bot-detection.md)
|
||||
measures a different axis, and a green on one axis is not a green on the others. The
|
||||
practical rule is to name which number you are looking at before you react to it,
|
||||
because the fix for a low CreepJS trust (consistency) is not the fix for a low
|
||||
reCAPTCHA v3 score (history), and applying one to the other wastes days.
|
||||
|
||||
## A blocked probe lowers the score, it does not hide from it
|
||||
|
||||
One instinct makes all three numbers worse at once: suppressing a signal. Blocking
|
||||
canvas, returning an empty font list, refusing WebRTC, randomising a value per call so
|
||||
nothing can pin it.
|
||||
|
||||
Every one of those is counted against you, not for you:
|
||||
|
||||
- CreepJS records a blocked probe as a lie by name, so blocking lowers trust directly.
|
||||
- A value that changes on every read is a tampering tell, and a per-call-changing
|
||||
canvas or audio hash reads as randomisation rather than a real device.
|
||||
- A missing signal is still a signal. An empty result where a real browser has data is
|
||||
itself the anomaly.
|
||||
|
||||
The consistency that raises a trust number is the opposite of hiding. This is why a
|
||||
seed-derived identity, where every surface is drawn from one seed and stays put, scores
|
||||
better than any suppression strategy: it answers every probe with a coherent value
|
||||
instead of a refusal.
|
||||
|
||||
## Measure all three from one seeded session
|
||||
|
||||
The way to stop guessing which number moved is to make the identity reproducible, so a
|
||||
change in a score is a change you made rather than a change in the draw. The wrapper is
|
||||
stock Playwright with a seeded fingerprint, so the `browser` you get back is a real
|
||||
Playwright `Browser` and every method is the one you already know:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
def read_canvas(page):
|
||||
return page.evaluate("""() => {
|
||||
const c = document.createElement('canvas');
|
||||
const ctx = c.getContext('2d');
|
||||
ctx.textBaseline = 'top';
|
||||
ctx.font = '14px Arial';
|
||||
ctx.fillText('trust-score-probe', 2, 2);
|
||||
return c.toDataURL();
|
||||
}""")
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
first = read_canvas(page)
|
||||
second = read_canvas(page)
|
||||
assert first == second # stable within a session, so not a per-call tell
|
||||
```
|
||||
|
||||
Reading the same value twice in one session is the cheapest consistency check there
|
||||
is: if `first` and `second` disagree, something is randomising per call, which is the
|
||||
exact tampering pattern that costs you CreepJS trust. Here they match, which is the
|
||||
behaviour you want.
|
||||
|
||||
Now confirm it is stable across sessions too, which is what keeps a FingerprintJS ID
|
||||
where you put it, and what a consistency check rewards:
|
||||
|
||||
```python
|
||||
def canvas_for_seed(seed):
|
||||
with InvisiblePlaywright(seed=seed) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
return read_canvas(page)
|
||||
|
||||
a = canvas_for_seed(42)
|
||||
b = canvas_for_seed(42) # same seed, relaunched
|
||||
c = canvas_for_seed(7) # a different identity
|
||||
|
||||
assert a == b # same seed reproduces the same machine
|
||||
assert a != c # a different seed is a different, still-consistent machine
|
||||
```
|
||||
|
||||
Measured this way, the same seed reproduces byte-identical canvas output run after run,
|
||||
and a different seed produces a different value that is itself internally consistent.
|
||||
That reproducibility is what lets you attribute a score change to the one thing you
|
||||
changed. If you have not passed a seed, log `sf.seed` from the instance first so a run
|
||||
that scored interestingly can be replayed exactly.
|
||||
|
||||
The honest boundary, again: this makes the CreepJS-style consistency axis and the
|
||||
FingerprintJS linkability axis controllable and repeatable. It does not warm up a
|
||||
profile, and the reCAPTCHA v3 number will still start low on a session with no past no
|
||||
matter how clean the fingerprint is.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Three numbers, three axes. CreepJS trust counts contradictions and lies, a
|
||||
FingerprintJS ID and its confidence measure whether you are the same visitor as before,
|
||||
and a reCAPTCHA v3 score estimates risk from behaviour and history. Passing one is not
|
||||
passing another, suppressing a signal lowers all three rather than hiding from any of
|
||||
them, and the only way to tell which number your last change actually moved is to hold
|
||||
the identity still with a seed and compare. Name the axis before you react to the
|
||||
number, and the contradictory results stop being contradictory.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Is a CreepJS trust score the same as a reCAPTCHA score?** No. CreepJS trust counts
|
||||
internal contradictions and tampering; a reCAPTCHA v3 score is a 0.0 to 1.0 risk
|
||||
estimate built mostly from behaviour and history. A high one does not predict the
|
||||
other.
|
||||
|
||||
**What does the FingerprintJS confidence number mean?** How sure the library is that
|
||||
this visitor ID matches the same visitor as before. It is about the reliability of the
|
||||
match, not about whether the browser looks automated.
|
||||
|
||||
**I pass CreepJS but still get a low reCAPTCHA score, why?** Because reCAPTCHA v3 is
|
||||
mostly reading history and behaviour, and a fresh profile has neither. A clean
|
||||
fingerprint removes reasons to distrust you; it does not supply a past.
|
||||
|
||||
**Does a rare fingerprint lower my trust score?** No. CreepJS trust is about
|
||||
consistency, not rarity. An unusual but coherent identity can score perfectly; a common
|
||||
but contradictory one scores badly.
|
||||
|
||||
**Does blocking canvas or fonts raise my score?** It lowers it. A blocked probe is
|
||||
recorded as a lie, and a value that changes per read is a tampering tell. Answering
|
||||
every probe with a coherent value scores better than refusing.
|
||||
|
||||
**Which score should I optimise for?** The one your target actually uses. Optimise
|
||||
consistency for a CreepJS-style check, a warmed profile and realistic behaviour for a
|
||||
reCAPTCHA-style score, and decide whether you want the FingerprintJS ID to stay put or
|
||||
change.
|
||||
|
||||
## Sources
|
||||
|
||||
- The three detectors named above, each with its own page in this set, read from their
|
||||
own source rather than from a rendered verdict: CreepJS on tampering, FingerprintJS on
|
||||
the hashed visitor ID and its confidence, and reCAPTCHA v3 on the behavioural score.
|
||||
- This project's own reproducibility measurements: identical seed reproduces
|
||||
byte-identical canvas output within and across sessions, which is the property a
|
||||
consistency check rewards.
|
||||
|
||||
**See also:** [how CreepJS decides you are lying](creepjs-explained.md) for the
|
||||
consistency axis, [why a fresh browser scores low on reCAPTCHA v3](recaptcha-v3-score.md)
|
||||
for the history axis, and [how to test whether your browser is detected](how-to-test-bot-detection.md)
|
||||
for the compare-against-a-stock-browser method that keeps these numbers honest.
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The three numbers on this
|
||||
page get conflated because they all look like a percentage; none of them are the same
|
||||
percentage.*
|
||||
@@ -0,0 +1,190 @@
|
||||
---
|
||||
title: "browser-use gets detected: what you can and cannot change"
|
||||
description: "browser-use drives Chrome over CDP. What BrowserProfile lets you change, what stays out of reach on a server, and the timing tell specific to AI agents."
|
||||
parent: "AI Agents and Frameworks"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 2
|
||||
---
|
||||
|
||||
|
||||
# browser-use gets detected: what you can and cannot change
|
||||
|
||||
If your browser-use agent works locally and gets challenge pages on a server, the
|
||||
problem is usually not the agent and not the prompt. It is the browser it drives and the
|
||||
machine it runs on, and only some of that is reachable from configuration.
|
||||
|
||||
This page is what `BrowserProfile` actually exposes, what those settings fix, what stays
|
||||
out of reach, the signal that is specific to agent-driven sessions, and the honest answer
|
||||
about swapping in a different engine.
|
||||
|
||||
## What browser-use gives you to change
|
||||
|
||||
browser-use's `BrowserProfile` lets you change six things: which browser binary
|
||||
launches, its channel, a persistent profile directory, proxy, headless mode, and extra
|
||||
command-line arguments. Everything else about the browser and the machine it runs on is
|
||||
out of its reach. These fields are read from `browser_use/browser/profile.py`, the
|
||||
configuration surface:
|
||||
|
||||
| Field | What it does |
|
||||
|---|---|
|
||||
| `executable_path` | which browser binary to launch |
|
||||
| `channel` | a Chromium channel |
|
||||
| `user_data_dir` | a persistent profile directory |
|
||||
| `proxy` | proxy settings for the session |
|
||||
| `headless` | headless or headed |
|
||||
| `args` | extra command-line arguments |
|
||||
|
||||
That is a real set of levers, and three of them matter more than people use them for.
|
||||
|
||||
### executable_path, and what it expects
|
||||
|
||||
`executable_path` exists, and it expects a **Chromium-family** browser. The surrounding
|
||||
code in `browser_use/browser/chrome.py` is entirely Chrome logic: finding a Chrome
|
||||
executable, deriving the Chrome user-data directory from it, enumerating Chrome profiles.
|
||||
The channel type is a Chromium channel.
|
||||
|
||||
The practical use of that field is pointing at your **real installed Chrome** rather
|
||||
than the bundled Chromium. [Those are not the same browser](chromium-is-not-chrome.md):
|
||||
the codec set differs, the branding differs, and a real Chrome install is a far more
|
||||
common thing to be than a bundled test build.
|
||||
|
||||
### user_data_dir, which is underused
|
||||
|
||||
Pointing this at a profile that has genuinely been used is the single highest-value
|
||||
change available in the configuration, because it is the only one that addresses history
|
||||
rather than hardware.
|
||||
|
||||
An agent session starting from an empty profile is a browser that has never been
|
||||
anywhere, which is
|
||||
[most of why a fresh browser scores badly](recaptcha-v3-score.md). The traps that come
|
||||
with persistent profiles are covered separately in
|
||||
[what a persistent profile fixes and breaks](persistent-profiles.md), and the pairing
|
||||
rule there applies here too.
|
||||
|
||||
## What configuration cannot reach
|
||||
|
||||
Everything about the machine. None of the fields above changes any of these, and on a
|
||||
server all of them are true at once:
|
||||
|
||||
- **No GPU**, so WebGL reports a software renderer.
|
||||
[What those strings mean](webgl-renderer-strings.md).
|
||||
- **A container font set** that does not match the claimed platform.
|
||||
[Why installing more is not the fix](headless-fonts-differ.md).
|
||||
- **No audio device**, so the audio values fall back to defaults.
|
||||
[The seven values](audiocontext-fingerprinting.md).
|
||||
- **A screen with no taskbar** and a default resolution.
|
||||
[The relationships that have to hold](screen-size-headless-tells.md).
|
||||
- **Codec support** that describes a slim build rather than a desktop install, including
|
||||
whether decoding is hardware accelerated.
|
||||
[Three surfaces in one API](codec-fingerprinting.md).
|
||||
- **A TLS handshake** decided before any of this by the network stack.
|
||||
[Which no page-level layer can touch](ja3-ja4-tls-fingerprint.md).
|
||||
|
||||
This is why "it works on my laptop and not in Docker" is the most common shape of the
|
||||
problem. The agent is identical; the machine is not.
|
||||
[The container version of this list](playwright-docker-detection.md) goes through it in
|
||||
order.
|
||||
|
||||
## The tell that is specific to agent-driven sessions
|
||||
|
||||
The tell specific to agent-driven sessions is timing, not fingerprint: an agent pauses to
|
||||
think between actions, and those pauses cluster around model latency in a shape that human
|
||||
reading never produces. This part does not apply to ordinary scraping and does apply to
|
||||
browser-use.
|
||||
|
||||
An agent thinks between actions. It reads the page, calls a model, waits for a response,
|
||||
then acts. That produces
|
||||
[an interaction rhythm with a very particular shape](ai-agent-timing-signal.md):
|
||||
|
||||
- **Long, similar pauses before each action**, clustered around model latency rather than
|
||||
around reading speed.
|
||||
- **No movement during the pause.** A person reading a page moves the pointer, scrolls
|
||||
slightly, drifts. An agent's pointer is perfectly still for two seconds and then
|
||||
arrives exactly on a button.
|
||||
- **Actions that land dead centre** on their targets, because coordinates come from the
|
||||
accessibility tree rather than from a hand.
|
||||
- **No wasted actions.** People scroll past things, hover over what they do not click,
|
||||
and change their minds.
|
||||
|
||||
None of that is fixed by a stealth setting, and it is worth knowing because it explains
|
||||
blocks that arrive **after** a few interactions rather than at the first page load. That
|
||||
timing is the diagnostic:
|
||||
[a block at first load points at the fingerprint or the address, a block after an
|
||||
interaction points at behaviour](playwright-detected-as-bot.md).
|
||||
|
||||
## Can I use a stealth-patched Firefox with browser-use?
|
||||
|
||||
No, and it is better to say so plainly than to publish a workaround that does not work.
|
||||
|
||||
browser-use drives its browser over the Chrome DevTools Protocol, with Chrome-specific
|
||||
arguments and Chrome profile handling. A Firefox binary in `executable_path` is not a
|
||||
drop-in: the driver would be speaking a protocol the browser does not implement.
|
||||
|
||||
If you specifically want an engine whose fingerprint is set in its own source, the route
|
||||
that works for agents is a different driver. Microsoft's
|
||||
[`playwright-mcp`](https://playwright.dev/docs/getting-started-mcp) accepts a browser
|
||||
and an executable path and speaks MCP, so an agent framework that talks MCP can drive a
|
||||
patched Firefox through it.
|
||||
[That integration is written up here](integrations/playwright-mcp.md).
|
||||
|
||||
That is a genuine trade: you give up browser-use's agent loop and get an engine-level
|
||||
fingerprint. Which one matters depends on whether your blocks are arriving because of the
|
||||
browser or because of the behaviour, and the timing test above tells you which.
|
||||
|
||||
## Conclusion
|
||||
|
||||
browser-use exposes enough configuration to fix the two things configuration can fix:
|
||||
which browser binary runs, and whether the profile has a past. Point it at a real Chrome
|
||||
and at a profile that has been used, and you have taken the available wins.
|
||||
|
||||
Everything else divides into two piles. The machine-level tells are shared with every
|
||||
other automation tool and are fixed by changing the machine or the engine, neither of
|
||||
which is a browser-use setting. The agent-rhythm tells are specific to this class of tool
|
||||
and are not fixed by any fingerprint work at all.
|
||||
|
||||
Knowing which pile you are in takes one experiment: note whether the block arrives at the
|
||||
first request or after a few actions.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Why does my browser-use agent get blocked on a server but not locally?** Because the
|
||||
server has no GPU, few fonts, no audio device and a default screen, and the agent is
|
||||
identical in both places.
|
||||
|
||||
**Can I set a custom browser in browser-use?** Yes, `executable_path` in
|
||||
`BrowserProfile`, and it expects a Chromium-family browser. Pointing it at your real
|
||||
Chrome rather than the bundled Chromium is worth doing.
|
||||
|
||||
**Can I use a stealth Firefox with browser-use?** No. It drives over CDP, which Firefox
|
||||
does not implement in the way the driver expects.
|
||||
|
||||
**Does a persistent profile help?** Yes, more than most settings, because it is the only
|
||||
one that addresses having no history. Read the traps first.
|
||||
|
||||
**Why do blocks arrive after a few actions rather than immediately?** That usually points
|
||||
at behaviour rather than fingerprint, and agent pacing has a recognisable shape.
|
||||
|
||||
**Does adding a proxy fix it?** It changes where you come from. If the browser is
|
||||
announcing a datacenter through its GPU and fonts, the address was not the problem.
|
||||
|
||||
**See also:** [the checklist for being detected on one site](playwright-detected-as-bot.md),
|
||||
which is the order to work in,
|
||||
[Playwright in Docker](playwright-docker-detection.md), for the server case, and
|
||||
[Playwright MCP](integrations/playwright-mcp.md), for the agent route that does accept a
|
||||
different engine.
|
||||
|
||||
## Sources
|
||||
|
||||
- `browser_use/browser/profile.py`, which defines the configuration fields listed above,
|
||||
and `browser_use/browser/chrome.py`, which is the Chrome executable and profile
|
||||
handling. Read 2026-07-27.
|
||||
- [Playwright's own MCP documentation](https://playwright.dev/docs/getting-started-mcp),
|
||||
which lists `firefox` among the supported `--browser` values, confirming that route
|
||||
(unlike browser-use) is not Chromium-only. Read 2026-08-06.
|
||||
- The machine-level surfaces are each documented on their own page, linked above.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level. This page says our engine does not fit browser-use,
|
||||
because it does not, and a guide claiming otherwise would waste your afternoon.*
|
||||
@@ -0,0 +1,244 @@
|
||||
---
|
||||
title: "BrowserLeaks canvas and WebGL hash, explained"
|
||||
description: "The BrowserLeaks canvas and WebGL signature is a hash of a pixel readback, not your GPU. What it measures, and why one seed gives a byte-identical hash."
|
||||
parent: "Detectors, Explained"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 6
|
||||
---
|
||||
|
||||
|
||||
# BrowserLeaks canvas and WebGL hash, explained
|
||||
|
||||
The BrowserLeaks canvas and WebGL signature is a hash of the pixels a readback call
|
||||
returns, not a fingerprint of your GPU. It sits at the very end of the render pipeline,
|
||||
which is why editing a reported renderer string never moves it, and why the only way to
|
||||
control it is to control the bytes handed back at the readback boundary. Get that boundary
|
||||
right and one seed produces a byte-identical hash on Windows and Linux alike.
|
||||
|
||||
BrowserLeaks shows you a canvas "signature" and a WebGL "signature" and treats each as a
|
||||
stable identifier for your machine (see [what each BrowserLeaks panel tests](browserleaks-explained.md)
|
||||
for the wider tour). People read those short hex strings as a fingerprint
|
||||
of the GPU, and then try to change the GPU to change them. That is the wrong layer. The
|
||||
signature is a hash of one specific thing, and once you know which thing, the whole
|
||||
surface reads differently.
|
||||
|
||||
This page is what the signature measures, where in the pipeline it is actually taken, what
|
||||
has to be true for two machines to produce the same one, and how to read both values
|
||||
yourself against a stock browser.
|
||||
|
||||
## What BrowserLeaks calls a signature
|
||||
|
||||
The canvas test draws text and shapes into an off-screen canvas, then asks the page to
|
||||
read the resulting pixels back out and hashes them. The WebGL test does the same with a
|
||||
rendered 3D scene. In both cases the "signature" you see is the hash of the pixel bytes,
|
||||
not of any property you can enumerate.
|
||||
|
||||
That distinction matters because the pixel bytes are the product of a long chain: the
|
||||
font rasterizer, the anti-aliasing, the GPU, the driver, the compositor. Two machines that
|
||||
report the same WebGL renderer string can still hash differently, because the string and
|
||||
the pixels are decided by different code. The signature is downstream of everything, which
|
||||
is exactly why detectors like it and exactly why it is hard to fake by editing properties.
|
||||
[The renderer string and the pixels it implies are two separate surfaces](renderer-string-vs-render.md),
|
||||
and a mismatch between them is its own tell.
|
||||
|
||||
## The readback is the only thing JavaScript can see
|
||||
|
||||
JavaScript never sees the render surface directly; the only bytes a page can obtain are the
|
||||
ones a readback call hands back. The GPU draws into memory the page has no handle on. The
|
||||
only way script gets any pixels at all is by calling a readback method -
|
||||
[`getImageData`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/getImageData),
|
||||
`toDataURL`, `toBlob` on the 2D side,
|
||||
[`readPixels`](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/readPixels)
|
||||
on the WebGL side - and those methods are
|
||||
the single point where the rendered pixels cross from the engine into script.
|
||||
|
||||
So the signature is not a measurement of your GPU. It is a measurement of whatever those
|
||||
readback calls return. If the bytes handed back at that boundary are a pure function of a
|
||||
seed, the signature is a pure function of the seed, and the GPU underneath stops mattering
|
||||
to the hash entirely.
|
||||
|
||||
That is the whole strategy in one sentence: the render can depend on the host all it likes,
|
||||
because the host contribution is overwritten before any script can observe it.
|
||||
|
||||
## What our substitution does at that point
|
||||
|
||||
At each readback boundary, the pixels the page receives are replaced with values derived
|
||||
from the seed and the position of the pixel, roughly `hash(seed, pixel_index)` per byte.
|
||||
The scene is still drawn, so timing and shape and side effects all behave like a real
|
||||
render, but the bytes that come back out are seed-determined rather than GPU-determined.
|
||||
|
||||
Two consequences follow directly:
|
||||
|
||||
- Read the canvas twice in one session and the hash is identical, because the same seed
|
||||
and the same pixel positions produce the same bytes. A hash that changes between two
|
||||
reads in one session is the cheapest tampering signal there is, and
|
||||
[per-call noise is exactly what a consistency probe is built to catch](canvas-fingerprint-noise.md).
|
||||
- Two different operating systems running the same seed return the same bytes, because
|
||||
nothing host-specific survives to the readback. That is the property the next section is
|
||||
about.
|
||||
|
||||
Because the substitution happens where the pixels are read rather than where they are
|
||||
drawn, it covers the indirect readback paths too - drawing the canvas into another canvas
|
||||
and reading that, capturing it as an image bitmap and reading that - since every one of
|
||||
them still ends at a readback call, and the readback is what gets replaced.
|
||||
|
||||
## Why a byte-identical hash across OSes is the real test
|
||||
|
||||
A stealth build that merely perturbs the canvas looks fine on one machine and falls apart
|
||||
across a fleet, because the perturbation rides on top of a host render that still differs
|
||||
between Windows and Linux. The honest test is not "did the hash change", it is "do two
|
||||
different hosts, same seed, produce the same hash to the byte".
|
||||
|
||||
Measured on this build, same seed on Windows and on Linux, read in the page the way
|
||||
BrowserLeaks reads it: the canvas signature is `df2a9319` on both, and the WebGL signature
|
||||
is `0df1d6f8` on both. Not close, identical.
|
||||
|
||||
| Signature | Windows | Linux | Match |
|
||||
|---|---|---|---|
|
||||
| Canvas | `df2a9319` | `df2a9319` | byte-identical |
|
||||
| WebGL | `0df1d6f8` | `0df1d6f8` | byte-identical |
|
||||
|
||||
Across a batch of sixteen distinct seeds run
|
||||
through a full fingerprinting suite, zero of sixteen failed the cross-host check on either
|
||||
operating system. That is the number that says the host contribution is actually gone
|
||||
rather than merely reduced, and it is the same guarantee the
|
||||
[canvas and WebGL cross-platform consistency page](canvas-webgl-cross-platform-consistency.md)
|
||||
describes from the engine side.
|
||||
|
||||
The reason this is worth insisting on: a server render and a laptop render disagreeing is
|
||||
one of the most common ways an otherwise-good identity gets linked across a fleet. If the
|
||||
hash is byte-identical by construction, that entire class of leak is closed rather than
|
||||
papered over.
|
||||
|
||||
## The low-entropy render left alone, and why
|
||||
|
||||
There is a trap in overwriting every readback unconditionally. Some pages do not draw a
|
||||
fingerprint scene at all - they draw a tiny reference block, a flat rectangle of one or two
|
||||
colours, precisely to check whether a browser is tampering with canvas output. A masking
|
||||
scanner expects that reference to come back byte-exact. If your substitution rewrites it,
|
||||
you have announced that you rewrite canvas reads, which is worse than any GPU string.
|
||||
|
||||
So the substitution has a threshold. A render with more than sixteen distinct colours is a
|
||||
real fingerprint scene and gets the full overwrite. A render at or below sixteen distinct
|
||||
colours is treated as a low-entropy reference and is left byte-exact, so its hash stays the
|
||||
global constant a masking scanner expects to see. The high-entropy scene is spoofed; the
|
||||
probe render is untouched. A detector looking for tampering on its reference block finds
|
||||
none, and a detector reading the fingerprint scene gets a clean, seed-stable, host-free
|
||||
hash.
|
||||
|
||||
This is the difference between hiding a signal and blocking it. Blocking canvas entirely,
|
||||
or scrambling every read, is itself a loud signal - the kind
|
||||
[a suppressed surface leaves behind](how-to-test-bot-detection.md). Leaving the reference
|
||||
render exact while making the fingerprint render seed-deterministic is what keeps the
|
||||
surface quiet.
|
||||
|
||||
## Reading the two hashes yourself
|
||||
|
||||
You do not need the detector's page to see this. Draw a canvas, read it back the way the
|
||||
signature is computed, and print the hash. Do it twice in one session to confirm stability,
|
||||
then relaunch with the same seed to confirm reproducibility.
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
READBACK = """
|
||||
() => {
|
||||
const c = document.createElement('canvas');
|
||||
c.width = 300; c.height = 60;
|
||||
const ctx = c.getContext('2d');
|
||||
ctx.textBaseline = 'alphabetic';
|
||||
ctx.font = '16px sans-serif';
|
||||
ctx.fillStyle = '#069';
|
||||
ctx.fillText('signature check', 4, 40);
|
||||
ctx.strokeStyle = 'rgba(120,0,90,0.7)';
|
||||
ctx.beginPath(); ctx.arc(240, 30, 20, 0, Math.PI * 2); ctx.stroke();
|
||||
// the readback: the one point JavaScript sees the render
|
||||
const bytes = ctx.getImageData(0, 0, c.width, c.height).data;
|
||||
let h = 0x811c9dc5;
|
||||
for (let i = 0; i < bytes.length; i++) {
|
||||
h ^= bytes[i];
|
||||
h = (h + ((h << 1) + (h << 4) + (h << 7) + (h << 8) + (h << 24))) >>> 0;
|
||||
}
|
||||
return h.toString(16).padStart(8, '0');
|
||||
}
|
||||
"""
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
first = page.evaluate(READBACK)
|
||||
second = page.evaluate(READBACK)
|
||||
print("read 1:", first)
|
||||
print("read 2:", second)
|
||||
assert first == second, "canvas hash changed within a session - per-call noise"
|
||||
```
|
||||
|
||||
Run the same script a second time with the same `seed=42` and the printed hash is the same
|
||||
again. Change the seed and it changes. Run it on a Windows host and on a Linux host with
|
||||
one fixed seed and the two hosts print the same string. To make the comparison against a
|
||||
stock browser concrete, run the identical readback under plain Playwright on the same
|
||||
machine and note that its hash tracks the host GPU instead:
|
||||
|
||||
```bash
|
||||
python read_hash.py # invisible_playwright: seed-stable, host-free
|
||||
python read_hash_stock.py # stock Playwright: hash follows this machine's GPU
|
||||
```
|
||||
|
||||
The stock browser is the reference. The point is not that the two disagree; it is that the
|
||||
seeded one gives the same answer on a second machine and the stock one does not.
|
||||
|
||||
## Conclusion
|
||||
|
||||
The BrowserLeaks canvas and WebGL signatures are hashes of a readback, and the readback is
|
||||
the only place a page can observe a render at all. That single fact is what makes the
|
||||
surface tractable: substitute the bytes at the readback boundary with a function of the
|
||||
seed, and the signature becomes seed-determined instead of GPU-determined, byte-identical
|
||||
across operating systems, and stable across reads within a session. Leave the low-entropy
|
||||
reference render exact and a tampering probe finds nothing to flag. The measurable outcome
|
||||
is a canvas signature of `df2a9319` and a WebGL signature of `0df1d6f8` reproduced to the
|
||||
byte on two different hosts, with zero cross-host failures across sixteen seeds.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**What does the BrowserLeaks canvas signature actually measure?** The hash of the pixels a
|
||||
readback call returns, not any property of your GPU. It is downstream of the entire render
|
||||
pipeline, which is why editing a renderer string does not move it.
|
||||
|
||||
**Why is my canvas hash different on my server than on my laptop?** Because a plain render
|
||||
depends on the host GPU, driver and rasterizer, and those differ. When the readback is
|
||||
replaced with a seed-derived function, the host drops out and the hash is the same on both.
|
||||
|
||||
**Should the canvas hash change on every page load?** No. A hash that changes between two
|
||||
reads in one session is per-call noise, which is itself detectable. It should be stable
|
||||
within a session and reproducible across sessions for a fixed seed.
|
||||
|
||||
**Is blocking canvas a good defence?** No. An empty or scrambled canvas is a loud signal.
|
||||
The quiet approach returns a plausible, stable hash and leaves a detector's low-entropy
|
||||
reference render byte-exact.
|
||||
|
||||
**Can I get the same signature on two machines on purpose?** Yes, that is the design. Same
|
||||
seed, same signature, to the byte, on Windows and Linux alike.
|
||||
|
||||
**Does this touch the WebGL renderer string too?** That is a separate surface with its own
|
||||
handling; see the note on [WebGL renderer strings](webgl-renderer-strings.md). The
|
||||
signature is the pixels, the renderer string is a reported value, and both have to agree.
|
||||
|
||||
## Sources
|
||||
|
||||
- BrowserLeaks canvas and WebGL pages, read for how the signature is computed: a hash over
|
||||
the bytes returned by a readback call
|
||||
([browserleaks.com/canvas](https://browserleaks.com/canvas),
|
||||
[browserleaks.com/webgl](https://browserleaks.com/webgl)).
|
||||
- This project's host-independence audit, which maps every path a host-dependent render
|
||||
value can reach JavaScript and confirms the seeded hashes (`df2a9319`, `0df1d6f8`)
|
||||
byte-identical on Windows and Linux, zero of sixteen seeds failing the cross-host check.
|
||||
|
||||
**See also:** [canvas and WebGL fingerprints identical across OSes](canvas-webgl-cross-platform-consistency.md),
|
||||
[the cheapest tampering check there is](canvas-fingerprint-noise.md), and
|
||||
[how to test whether your browser is detected](how-to-test-bot-detection.md).
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The two hashes above are
|
||||
real measurements, reproduced to the byte on two operating systems from one seed.*
|
||||
@@ -0,0 +1,239 @@
|
||||
---
|
||||
title: "What BrowserLeaks actually tests, surface by surface"
|
||||
description: "What BrowserLeaks tests, surface by surface: canvas hash, WebGL, WebRTC, fonts, ClientRects. Why a unique panel is not a fail, and the miss it never flags."
|
||||
parent: "Detectors, Explained"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 7
|
||||
---
|
||||
|
||||
|
||||
# What BrowserLeaks actually tests, surface by surface
|
||||
|
||||
BrowserLeaks is the tool people reach for when they want to see a number rather than
|
||||
read a verdict. It prints the raw value of each browser surface - the canvas hash, the
|
||||
WebGL parameter block, the WebRTC candidate addresses, the installed font list, the
|
||||
ClientRects geometry - each on its own page, roughly fifteen of them.
|
||||
|
||||
That design is its strength and the source of most of the panic it causes. It shows you
|
||||
everything and scores none of it. So the panel that lights up red and says "unique" is
|
||||
the one everybody worries about, while the thing that actually gets a session flagged -
|
||||
two panels that quietly contradict each other - is displayed in plain text and never
|
||||
called out, because BrowserLeaks does not compare its own pages to one another.
|
||||
|
||||
This page is what each surface measures, why "unique" is not the alarm it looks like,
|
||||
and how to read the tool for the failure it will not point at.
|
||||
|
||||
## A raw-value inspector, not a scorer
|
||||
|
||||
BrowserLeaks reads each browser surface and prints its raw value; it does not judge whether the values are coherent. It shows the canvas hash, the WebGL block, the font list and how rare each is in its sample, but it never cross-checks one surface against another and never hands you a trust score. That is the distinction that makes it useful, and the one people miss.
|
||||
|
||||
[CreepJS asks whether you are lying](creepjs-explained.md): it takes a clean copy of the
|
||||
built-ins, walks descriptors and prototypes, and cross-checks every surface against
|
||||
every other one, then hands you a single trust score. BrowserLeaks does none of that. It
|
||||
reads a value, hashes it if it is a bitmap, tells you how rare that exact value is in its
|
||||
own visitor sample, and moves on to the next page.
|
||||
|
||||
That means two things. First, a "unique" result on any single BrowserLeaks page is a
|
||||
statement about rarity in their sample, not about whether your browser is coherent. A
|
||||
perfectly real, perfectly consistent machine can be unique. Second, and this is the part
|
||||
that matters, BrowserLeaks will show you a Windows font list on one page and a WebGL
|
||||
renderer that no Windows machine ships on another, side by side, both green, and say
|
||||
nothing - because it has no page that reads both. The contradiction is on screen. The
|
||||
tool just is not looking for it.
|
||||
|
||||
## The fifteen pages, surface by surface
|
||||
|
||||
Each page answers one narrow question. Using them as if they were interchangeable is
|
||||
most of why people get confused.
|
||||
|
||||
- **Canvas.** Draws text and shapes to a `<canvas>`, reads the pixels back, and hashes
|
||||
them. The hash is a fingerprint of how your specific GPU, driver and font stack
|
||||
rasterize that exact drawing. It is not a property you can set; it is
|
||||
[a readback of what the machine actually painted](browserleaks-canvas-webgl-hash.md).
|
||||
- **WebGL.** Two things on one page: the
|
||||
[`UNMASKED_VENDOR_WEBGL` / `UNMASKED_RENDERER_WEBGL`](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_debug_renderer_info)
|
||||
strings, and a long block of numeric limits (max texture size, shader precision
|
||||
ranges, supported extensions). The strings are the famous part; the numeric block is
|
||||
the part that has to agree with them, and a disagreement is a contradiction a scoring
|
||||
detector catches even though BrowserLeaks prints both without comment.
|
||||
- **WebRTC.** Asks the browser to gather ICE candidates and prints the addresses it
|
||||
finds. This is where a proxied browser can leak the real local address next to the
|
||||
proxy exit, or [return nothing at all, which is its own tell](webrtc-leak-proxy.md).
|
||||
- **Fonts.** Measures the width of a probe string in a long list of font names and
|
||||
reports which ones are installed. Under a Windows user agent this list must look like
|
||||
Windows, not [the font set a bare Linux container ships](detect-installed-fonts-javascript.md).
|
||||
- **ClientRects.** Reads the sub-pixel bounding boxes of positioned elements with
|
||||
[`getClientRects()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/getClientRects).
|
||||
Like canvas, the exact fractional geometry varies with the
|
||||
rendering stack, so it is a fingerprint rather than a setting.
|
||||
|
||||
There are more pages - TLS, HTTP headers, geolocation, DNS - but these five are the ones
|
||||
people arrive worried about, and they are all raw-value readouts with no cross-check
|
||||
between them.
|
||||
|
||||
## The panel people fear: "unique" is not "wrong"
|
||||
|
||||
The canvas page is the one that sends people to search engines, and usually for the
|
||||
wrong reason.
|
||||
|
||||
It prints "unique" in red, a rarity percentage, and a signature hash, and the instinct
|
||||
is to make the number stop being unique. That instinct is backwards. A real browser on a
|
||||
real machine is very often unique on canvas, because the rasterization depends on a
|
||||
specific GPU and driver combination that few other visitors share. Uniqueness is the
|
||||
baseline for real hardware, not the anomaly.
|
||||
|
||||
The failure modes that actually matter on this panel are the opposite of "unique":
|
||||
|
||||
- **A hash that changes on every read.** If you refresh and the canvas signature is
|
||||
different each time, something is adding per-call noise, and per-call randomness is
|
||||
itself the tell - a real GPU is deterministic, so
|
||||
[a hash that will not repeat is the cheapest tampering signal there is](canvas-fingerprint-noise.md).
|
||||
- **A hash that matches thousands of other visitors exactly.** That is the signature of
|
||||
a software rasterizer, the same fallback renderer every headless container falls back
|
||||
to, which is a "this is a datacenter" flag wearing a "not unique" badge.
|
||||
|
||||
So the correct thing to want from the canvas panel is not a common value. It is a stable,
|
||||
plausible, hardware-shaped value that reads identically twice and is not the shared
|
||||
software-renderer hash. This product derives that value from the seed, so it is unique in
|
||||
the way real hardware is unique and byte-identical on a re-read, rather than either
|
||||
randomized per call or collapsed onto the software default.
|
||||
|
||||
## The risk it shows but never flags: two panels that disagree
|
||||
|
||||
Here is the thing BrowserLeaks displays and will never point at, and it is the thing a
|
||||
real scoring detector fails you on.
|
||||
|
||||
Every surface on the site carries an implicit claim about the same machine. The user
|
||||
agent says a platform. The WebGL renderer string implies a GPU vendor. The font list
|
||||
implies an operating system. The canvas and ClientRects hashes imply a specific
|
||||
rasterization stack. On a real browser these all describe one coherent computer. On a
|
||||
patched-together disguise they describe two or three different ones, and each individual
|
||||
page still looks fine on its own.
|
||||
|
||||
BrowserLeaks will happily show you:
|
||||
|
||||
- A user agent claiming Windows, and a font page missing the fonts every Windows install
|
||||
ships.
|
||||
- A WebGL renderer string naming a discrete GPU, and a canvas hash equal to the shared
|
||||
software-renderer value - the string says NVIDIA while the pixels were drawn by a
|
||||
software rasterizer.
|
||||
- A WebRTC page reporting a timezone-consistent exit, and a geolocation page a continent
|
||||
away.
|
||||
|
||||
None of those triggers a warning on BrowserLeaks, because no page reads another page.
|
||||
CreepJS would collapse your trust score on any one of them. This is exactly the gap the
|
||||
comparison method in [how to test whether your browser is detected](how-to-test-bot-detection.md)
|
||||
exists to close: the tool gives you the raw values, and it is on you to check that they
|
||||
agree, because it will not.
|
||||
|
||||
The practical consequence: do not read BrowserLeaks page by page and tick each one green.
|
||||
Read the values across pages as a set and ask whether one machine could produce all of
|
||||
them. That is the check the site skips.
|
||||
|
||||
## Reading BrowserLeaks with the product, twice and against a stock browser
|
||||
|
||||
The way to use BrowserLeaks well is to automate the cross-check it does not do: read the
|
||||
same surface twice for stability, and read the surfaces together for coherence.
|
||||
|
||||
Switching from plain Playwright is a two-line change, and the returned object is a real
|
||||
Playwright `Browser` with every standard method:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
# seed fixed, so every surface is reproducible and a failing run can be replayed
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
|
||||
# 1. Stability: read the canvas signature twice. A real GPU is deterministic,
|
||||
# so these two hashes must be identical. If they differ, something is
|
||||
# adding per-call noise, which is a tell in its own right.
|
||||
page.goto("https://browserleaks.com/canvas")
|
||||
first = page.locator("#crc").inner_text()
|
||||
page.reload()
|
||||
second = page.locator("#crc").inner_text()
|
||||
assert first == second, "canvas hash changed between reads - per-call noise"
|
||||
|
||||
# 2. Coherence: pull the WebGL renderer string and the font list, then check
|
||||
# they tell the same story about one machine.
|
||||
page.goto("https://browserleaks.com/webgl")
|
||||
renderer = page.locator("#webgl-unmasked-renderer").inner_text()
|
||||
print("WebGL renderer:", renderer)
|
||||
|
||||
page.goto("https://browserleaks.com/fonts")
|
||||
print("fonts detected:", page.locator("#font-count").inner_text())
|
||||
```
|
||||
|
||||
Two rules turn that from a screenshot into a test.
|
||||
|
||||
First, assert presence, not absence. A BrowserLeaks page that comes back empty, blocked
|
||||
or still spinning is a failure, not a clean pass - the WebRTC page returning no candidates
|
||||
at all reads as clean to a naive check and as suspicious to a real detector.
|
||||
|
||||
Second, and this is the one caveat worth being honest about: the raw canvas and WebGL
|
||||
hashes are stable and reproducible per seed, but they are still *unique*, because real
|
||||
hardware is unique. If your threat model needs many sessions that are individually
|
||||
plausible, change the seed per session rather than reusing one - a reproducible
|
||||
fingerprint is a debugging tool, not a crowd to hide in. Run the same read against a stock
|
||||
browser on the same machine and diff the two reports field by field; anything that differs
|
||||
other than the exit address is your candidate, whatever colour the panel is.
|
||||
|
||||
## Conclusion
|
||||
|
||||
BrowserLeaks is the right tool for reading a specific surface and the wrong tool for
|
||||
deciding whether you are safe. It prints raw values page by page and scores none of them,
|
||||
so the "unique" canvas panel that scares people is usually just real hardware behaving
|
||||
normally, while the failure that actually matters - two panels describing two different
|
||||
machines - is on screen in plain text with no warning attached.
|
||||
|
||||
Read it as a set, not a stack of independent verdicts. Check that each value is stable on
|
||||
a re-read, check that the values across pages could all come from one computer, and diff
|
||||
the whole thing against a stock browser. Do that and BrowserLeaks becomes a precise
|
||||
instrument. Read it panel by panel and it will scare you about the wrong number and stay
|
||||
silent about the right one.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**BrowserLeaks says my canvas is unique - am I detected?** Almost certainly not.
|
||||
Uniqueness is the baseline for real hardware, which rasterizes in a way few other
|
||||
visitors share. The tell is the opposite: a hash that changes every read, or one that
|
||||
matches thousands of others exactly.
|
||||
|
||||
**Does BrowserLeaks give a bot score?** No. It is a raw-value inspector. It prints each
|
||||
surface and how rare it is, but it never scores cross-surface consistency the way CreepJS
|
||||
does, so it cannot tell you whether your surfaces agree with each other.
|
||||
|
||||
**Why does BrowserLeaks look clean but I still get blocked?** Because it showed you values
|
||||
that individually look fine and never checked that they describe one machine. A Windows
|
||||
user agent with a Linux font list passes every BrowserLeaks page and fails a real
|
||||
detector.
|
||||
|
||||
**Which BrowserLeaks page matters most?** None alone. The value is reading them together:
|
||||
the canvas, WebGL, font and WebRTC pages have to tell the same story about one computer.
|
||||
|
||||
**How do I know if my canvas hash is randomized?** Load the canvas page twice. A real GPU
|
||||
gives the identical hash both times. If it differs, something is injecting per-call noise,
|
||||
which is itself a signal.
|
||||
|
||||
**Should I try to make my canvas hash common?** No. Common usually means the shared
|
||||
software-renderer value that every headless container falls back to, which reads as a
|
||||
datacenter. You want a stable, hardware-shaped, unique value, not a popular one.
|
||||
|
||||
## Sources
|
||||
|
||||
- The BrowserLeaks surfaces named above, each read from its own page rather than from a
|
||||
summary score.
|
||||
- This project's release gates, including the WebRTC gate whose absence-only assertions
|
||||
passed a feature that returned nothing, and the seed-derived canvas readback checked for
|
||||
stability across reads.
|
||||
- The companion detector pages in this set, read from each tool's own behaviour.
|
||||
|
||||
**See also:** [how CreepJS scores the cross-surface consistency BrowserLeaks skips](creepjs-explained.md),
|
||||
[what the canvas and WebGL hash actually measures](browserleaks-canvas-webgl-hash.md), and
|
||||
[the comparison method that catches contradictions no single panel flags](how-to-test-bot-detection.md).
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The seed makes every surface
|
||||
reproducible, so the two-read stability check above is a test rather than a guess.*
|
||||
@@ -0,0 +1,244 @@
|
||||
---
|
||||
title: "How to make Linux and macOS report real Windows fonts"
|
||||
description: "To make Linux and macOS report real Windows fonts, bundle the real font files and read only from them. Filtering a list leaves the host's rendering underneath."
|
||||
parent: "Canvas, WebGL, Fonts and Audio"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 6
|
||||
---
|
||||
|
||||
|
||||
# How to make Linux and macOS report real Windows fonts
|
||||
|
||||
To make Linux and macOS report real Windows fonts, ship the real Windows font files
|
||||
inside the browser and read only from that bundle on every platform. Filtering a host's
|
||||
font list is not enough: it changes what gets reported, not what gets rendered - the
|
||||
list says Windows, the pixels say something else. This page is what it took to make that
|
||||
bundle hold on three unrelated font backends, and where it still leaks.
|
||||
[Why headless browsers render different fonts](headless-fonts-differ.md) covers the
|
||||
detection side of the same problem, if you want that first.
|
||||
|
||||
## Why filtering the host was never going to be enough
|
||||
|
||||
The first instinct is to filter: hide the host's real fonts, report a Windows-shaped
|
||||
list instead. We tried a version of this and reverted it, because filtering only
|
||||
changes what gets reported, not what gets rendered. The host still draws the glyphs,
|
||||
still measures the widths, still rounds however its rasteriser rounds. A filtered font
|
||||
*name* sitting on top of Linux font *rendering* is a different, subtler version of the
|
||||
same contradiction: the list says Windows, the pixels say something else.
|
||||
|
||||
The fix that actually holds is upstream of the whole problem: ship the real font
|
||||
files inside the browser, and read only from that bundle, on every platform. This is
|
||||
the same direction Camoufox took first, and for the same reason - a real file produces
|
||||
real glyphs, real metrics, and a real hash, because nothing about it is simulated.
|
||||
|
||||
## One manifest, so three backends can't disagree with each other
|
||||
|
||||
Firefox already has a mechanism for carrying fonts inside the binary,
|
||||
`MOZ_BUNDLED_FONTS`, on by default on Windows and Linux and available on macOS with a
|
||||
build flag. The harder problem isn't shipping the files, it's making Windows'
|
||||
DirectWrite, Linux's fontconfig and macOS's CoreText - three font backends that know
|
||||
nothing about each other and enumerate host fonts in three different ways - report the
|
||||
*same* family list from the *same* files.
|
||||
|
||||
The fix is a single manifest, generated offline from the font files themselves and
|
||||
checked in as data, listing every family and which file and face index backs it. All
|
||||
three backends read the same manifest instead of asking their platform's normal font
|
||||
enumeration, so instead of three per-OS filters that can quietly drift apart, there is
|
||||
one source of truth for what a family is called and where its data lives.
|
||||
|
||||
Two details in that manifest turned out to matter more than the format itself:
|
||||
|
||||
**Naming has to follow the same precedence a real OS uses**, or the family names
|
||||
themselves become the tell. Font files carry more than one candidate name - a
|
||||
typographic name, a GDI-compatible name, sometimes a WWS name - and which one Windows
|
||||
actually shows depends on a precedence order. Getting that order wrong produces a
|
||||
family list that is real but *shaped* wrong: a font's marketing name where a real
|
||||
Windows machine would show its GDI name, which is exactly the kind of small
|
||||
inconsistency [consistency-based detection](playwright-detected-as-bot.md) is built to
|
||||
catch.
|
||||
|
||||
**Multi-face font files can't be indexed positionally across platforms.** A single
|
||||
`.ttc` file can carry several unrelated faces - regional CJK variants, for instance -
|
||||
and the safe way to pick the right one turned out to differ by backend: an index that
|
||||
is reliable on one platform is not guaranteed to point at the same face on another,
|
||||
because not every platform documents face order as stable. Matching by the face's own
|
||||
embedded name instead of its position avoids picking the wrong face silently.
|
||||
|
||||
## Making three backends refuse to fall back to the host
|
||||
|
||||
A manifest is only half the fix. Each backend still has its own default behaviour when
|
||||
something isn't in its bundle-only list, and each of those defaults quietly reaches for
|
||||
the host if you don't close it explicitly:
|
||||
|
||||
- One backend's safety fallback, when the bundle is unreadable, is to fail toward an
|
||||
empty list rather than the host - which breaks rendering visibly instead of leaking
|
||||
silently, the correct failure direction for a fingerprinting surface.
|
||||
- Another's default path, taken naively, falls straight through to a live host
|
||||
enumeration call the moment the bundle-only condition isn't satisfied.
|
||||
- The third had no bundle-only mode at all going in; it enumerates host and bundled
|
||||
fonts through the same single API call, so keeping the host out requires filtering
|
||||
every result rather than skipping a call.
|
||||
|
||||
Closing all three took a different patch per backend, because "don't enumerate the
|
||||
host" means something different to DirectWrite, to fontconfig, and to CoreText. There
|
||||
is no single flag that does this once for all platforms.
|
||||
|
||||
## The macOS gap: two layers, and only one was visible without a Mac
|
||||
|
||||
CoreText's version of this fix shipped later than Windows' and Linux's, and not
|
||||
because it was harder to write. It was harder to *know was wrong*, because nobody
|
||||
doing the work had a Mac to run it on.
|
||||
|
||||
**Layer one, found by reading the code rather than running it:** the block-at-birth
|
||||
hook that stops each backend from falling back to a live host enumeration had been
|
||||
wired into the Windows and Linux font backends, and simply never ported to CoreText.
|
||||
Reading the three backends side by side made that omission visible without running
|
||||
anything - a Mac host would enumerate its own system fonts right alongside the bundle,
|
||||
leaking the host OS on the one platform where nobody could see it happen locally.
|
||||
|
||||
**Layer two surfaced only when the first fix actually ran in CI.** Porting the hook
|
||||
and shipping it should have closed the gap. It didn't: the very next automated
|
||||
macOS run still showed most of the bundle missing and several real host fonts
|
||||
leaking through, on a build that had compiled cleanly and looked, from the source,
|
||||
like a complete fix. The actual cause was one level down - the build configuration
|
||||
that turns bundled fonts on at all was set to enable itself only on two of the three
|
||||
target platforms. The third silently defaulted off, which also compiled out the very
|
||||
hook layer one had just added, since that code only exists when bundled fonts are
|
||||
built in. A hook that is correct and a build that never includes it produce the same
|
||||
observed nothing.
|
||||
|
||||
Both layers are closed now, and CoreText enumerates the identical family set the
|
||||
other two backends do. The reason this is worth telling as one story rather than two
|
||||
separate fixes: the first fix looked complete by every check available without a
|
||||
real Mac, and was not. The only thing that caught the second layer was an automated
|
||||
run on the actual operating system, checking the actual output, after the fix that
|
||||
was supposed to be the whole answer. A gate that runs somewhere other than the real
|
||||
target platform is checking a different, easier question.
|
||||
|
||||
## What this validates, and what it costs
|
||||
|
||||
Validated cross-platform: Windows and Linux expose the identical family set from the
|
||||
bundle, zero host fonts leaking through on either,
|
||||
[generic CSS families](https://www.w3.org/TR/css-fonts-4/) (serif, sans,
|
||||
monospace, and the per-script CJK generics) resolving to the same bundled fonts rather
|
||||
than collapsing to whatever the host happens to have. The same check on macOS runs in
|
||||
CI rather than locally, for the ordinary reason that not every setup has a Mac to test
|
||||
on, and it has passed there too.
|
||||
|
||||
The cost is real and worth naming rather than glossing over. The binary is
|
||||
meaningfully larger, because it now carries real font files rather than relying on
|
||||
whatever the OS already had installed. And a fixed bundle also fixes the family list
|
||||
in time: unlike a live host, the browser cannot pick up a font a real Windows Update
|
||||
might add later. Both are the price of an answer that has no per-platform seams to find.
|
||||
|
||||
## Where it still leaks, named rather than hidden
|
||||
|
||||
Consistent with treating a suppressed signal as a fail rather than a pass, the honest
|
||||
gaps in this approach, found and not yet closed:
|
||||
|
||||
- One backend's [CSS `local()`](https://www.w3.org/TR/css-fonts-4/) font lookup path
|
||||
isn't wired to the bundle-only mode at all, so a page asking for a font by exact name
|
||||
through that specific CSS feature fails to resolve where a real installation would have. A resolved lookup versus a
|
||||
failed one is itself a detail a determined check could compare.
|
||||
- One backend's fallback for a character outside the bundle's family set reaches
|
||||
straight for the real host catalogue rather than staying inside the bundle, so an
|
||||
uncommon glyph can momentarily surface real host font data.
|
||||
- One backend's `system-ui` generic keeps a narrow live query against the host font
|
||||
service as an extra fallback candidate, a single generic family that didn't get
|
||||
folded into the same guard as the rest.
|
||||
- One platform's font-substitution mechanism reads a live OS-level alias table
|
||||
regardless of bundle-only mode, so the set of names that resolve through it still
|
||||
varies by the specific machine's own configuration.
|
||||
|
||||
None of these are enumeration leaks in the sense the validation above checks for -
|
||||
that check passed, repeatedly, on real measurement. They are narrower seams: specific
|
||||
code paths that keep a live dependency on the host font service instead of routing
|
||||
through the bundle like everything else. Each is a known, open item rather than
|
||||
something papered over, because a gap you haven't found yet is worse than one you have.
|
||||
|
||||
## A closed example of the same class: enumeration passing while rendering was wrong
|
||||
|
||||
Before the manifest fixed multi-face naming across platforms, a narrower version of the
|
||||
same problem shipped and was found and closed on Linux specifically. It is worth
|
||||
walking through because it is the clearest illustration of why enumeration alone is
|
||||
never enough of a check.
|
||||
|
||||
A `.ttc` file is a collection: several complete faces sharing one set of font tables,
|
||||
addressed through a `TTCHeader` that starts with the four-byte marker `ttcf` instead of
|
||||
the single-face `sfnt` header an ordinary font file has. Several bundled CJK families -
|
||||
regional Chinese, Japanese and a couple of serif/math variants - ship as `.ttc`
|
||||
collections for exactly that reason: related faces, one file.
|
||||
|
||||
The font-table code on Linux never checked for that marker. It read every font file as
|
||||
if it only had one face, at a fixed offset from the start of the file. For an ordinary
|
||||
font that offset is correct. For a `.ttc` collection it lands wherever the first face's
|
||||
data happens to be, regardless of which face was actually requested by name.
|
||||
|
||||
The result was a font that enumerated correctly - the family name resolved, the browser
|
||||
reported it was using the right font - while the glyphs actually rendered came from
|
||||
whichever face happened to sit at that fixed offset. Measured directly: metrics for
|
||||
several of these families were wrong on Linux and correct on Windows, same seed, same
|
||||
manifest, same claimed font name. Enumeration was clean. Rendering was not. That gap is
|
||||
exactly what a check that stops at "is the font in the list" cannot see.
|
||||
|
||||
The fix adds a lookup that reads the `TTCHeader` when the `ttcf` marker is present,
|
||||
finds the requested face's own offset from the collection's face-directory table, and
|
||||
reads from there instead of assuming offset zero. After the fix, the same measurement
|
||||
that had shown a mismatch showed matching metrics on both platforms, for every affected
|
||||
family.
|
||||
|
||||
The general lesson is the same one the four seams above are named for: a signal that
|
||||
looks closed because the obvious check passed is not the same as a signal that is
|
||||
closed. This one needed a metrics comparison, not a font list, to be caught at all -
|
||||
and it was a real, shipped gap for a period, not a hypothetical one.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Filtering a host's fonts leaves the host's rendering underneath, which is a
|
||||
contradiction with extra steps. Shipping the real files and reading only from them
|
||||
removes the contradiction at the source, at the cost of a larger binary, a fixed
|
||||
family list, and three separate backends that each needed convincing not to reach for
|
||||
the host on their own. What's left is a short, named list of narrower seams, not a
|
||||
general claim that the surface is closed.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Can I make a Linux machine report Windows fonts?** Reporting the name is not the
|
||||
hard part; matching the rendering is. Bundling the actual font files and reading only
|
||||
from them is what makes the two agree.
|
||||
|
||||
**Does installing Windows fonts on Linux fix fingerprinting?** It gets you the right
|
||||
names. It does not by itself stop the browser's normal font backend from also seeing
|
||||
whatever else is on the host, and licensing is a separate problem again.
|
||||
|
||||
**Why not just spoof the font list in JavaScript?** There's no enumeration API to
|
||||
intercept; [detection works by measuring rendered text](detect-installed-fonts-javascript.md),
|
||||
and a script cannot change what the OS actually draws.
|
||||
|
||||
**Does this fix cost anything?** A larger binary, and a font list that's frozen at
|
||||
build time rather than tracking whatever the real OS might add later.
|
||||
|
||||
**Is this the same thing Camoufox does?** The same direction - real files, not a
|
||||
filter - checked independently rather than assumed to work the same way underneath.
|
||||
|
||||
**See also:** [why headless browsers render different fonts](headless-fonts-differ.md),
|
||||
for the detection side this architecture answers; [invisible_playwright vs Camoufox](vs-camoufox.md),
|
||||
for where this approach sits relative to theirs; and
|
||||
[WebGL renderer strings](webgl-renderer-strings.md), for the same shape of problem on
|
||||
different hardware.
|
||||
|
||||
## Sources
|
||||
|
||||
- This project's own font-bundle architecture and its per-platform integration work,
|
||||
including the validated cross-platform measurement (Windows/Linux locally,
|
||||
macOS in CI) and the four open gaps listed above.
|
||||
- Firefox's own bundled-fonts build mechanism, which this architecture builds on
|
||||
rather than replaces.
|
||||
- [CSS Fonts Module Level 4](https://www.w3.org/TR/css-fonts-4/) (W3C), for the generic
|
||||
font family keywords and the `local()` src descriptor referenced above.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level, including three separate font backends convinced not
|
||||
to ask their host anything.*
|
||||
@@ -0,0 +1,224 @@
|
||||
---
|
||||
title: "Can a website detect a virtual machine?"
|
||||
description: "How a website infers a VM: software GPU renderers, odd core and memory counts, missing audio, generic metrics - what a browser fingerprint can and cannot hide."
|
||||
parent: "Detectors, Explained"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 15
|
||||
---
|
||||
|
||||
|
||||
# Can a website detect a virtual machine?
|
||||
|
||||
Short version: a website cannot see your hypervisor directly, but it can read a
|
||||
handful of browser-visible values that a virtual machine or a cloud instance tends to
|
||||
get wrong, and it can add them up into a VM-likelihood score. So the honest answer is
|
||||
"partly". It can guess from what the browser reports, and it usually cannot prove
|
||||
anything from inside the page. What it can prove lives outside the browser: the exit
|
||||
IP and the network handshake.
|
||||
|
||||
This page is what a detector actually looks at, why a default VM answers those
|
||||
questions in a way that stands out, how a real-hardware persona changes the answers,
|
||||
and the parts that a browser fingerprint does not and cannot touch.
|
||||
|
||||
## What a detector can see, and what it cannot
|
||||
|
||||
A page runs JavaScript. JavaScript can read the values the browser chooses to expose,
|
||||
and nothing below that line. It cannot read the CPUID leaf that says "hypervisor
|
||||
present", it cannot query the BIOS vendor string, it cannot see the virtual disk
|
||||
controller. Those are the classic VM tells, and they belong to native malware analysis,
|
||||
not to a web page.
|
||||
|
||||
What a page can do is infer. Every value below is individually plausible and, taken
|
||||
together, describes a machine. A physical desktop and a headless cloud instance answer
|
||||
these questions differently, and a detector that has scored a few million real browsers
|
||||
knows what the physical desktop looks like.
|
||||
|
||||
- The GPU vendor and renderer string.
|
||||
- The number of logical CPU cores.
|
||||
- The reported device memory.
|
||||
- Whether an audio output device exists, and what it sounds like.
|
||||
- The screen geometry and pixel ratio.
|
||||
|
||||
None of these is an automation flag. They are all "this is probably not someone's
|
||||
desktop" flags, which is a different and often more damaging thing.
|
||||
|
||||
## The signals that feed a VM score
|
||||
|
||||
Here is what each one looks like when it comes from a virtualized or headless
|
||||
environment, and why it stands out.
|
||||
|
||||
**A software or generic GPU renderer.** A machine with no graphics hardware falls back
|
||||
to a software rasterizer, and the [WebGL renderer
|
||||
string](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_debug_renderer_info)
|
||||
says so in plain text: a basic or generic renderer name, or the well-known software
|
||||
rasterizer strings. A real desktop reports a specific GPU model from a specific vendor.
|
||||
This is the single loudest VM tell
|
||||
in the browser, because it is a string you can read directly rather than a statistic
|
||||
you have to accumulate. Worse, the string and the pixels can disagree: a renderer that
|
||||
names real hardware while a software path actually draws the frame is
|
||||
[a mismatch you cannot paper over with a property override](renderer-string-vs-render.md).
|
||||
The full surface is in [WebGL renderer strings](webgl-renderer-strings.md).
|
||||
|
||||
**Odd core and memory counts.**
|
||||
[`navigator.hardwareConcurrency`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/hardwareConcurrency)
|
||||
and
|
||||
[`navigator.deviceMemory`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/deviceMemory)
|
||||
are coarse, but their distribution across real browsers is not uniform. A tiny core
|
||||
count paired with a claim of a modern desktop, or a memory
|
||||
value that never appears on consumer hardware, moves the score. These two also have to
|
||||
agree with each other and with the rest of the persona, which is
|
||||
[why pinning one without its neighbours backfires](hardware-concurrency-device-memory.md).
|
||||
|
||||
**Missing or default audio.** An
|
||||
[`AudioContext`](https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API)
|
||||
exposes a sample rate, an output latency and a channel count that come from a real
|
||||
audio device. A container with no sound hardware answers with defaults that say
|
||||
exactly that, and the rendered audio
|
||||
fingerprint carries the same information. See
|
||||
[AudioContext fingerprinting](audiocontext-fingerprinting.md) for what is actually
|
||||
being measured.
|
||||
|
||||
**Generic display metrics.** A resolution nobody ships, a device pixel ratio no real
|
||||
panel has, an available screen height equal to the full height (meaning no taskbar and
|
||||
no window chrome). Each of these is a small nudge; together they describe a virtual
|
||||
framebuffer rather than a monitor.
|
||||
|
||||
A detector does not need any single one of these to be damning. It needs several of
|
||||
them to point the same way at once, which is exactly what an unconfigured VM delivers.
|
||||
|
||||
## What invisible_playwright does about the browser-visible layer
|
||||
|
||||
invisible_playwright is a Firefox patched at the C++ level and driven by stock
|
||||
Playwright. Its whole design is to look like a real browser run by a real person, and
|
||||
that is why it passes most fingerprint, TLS and driver-layer checks: those layers read
|
||||
as a genuine Firefox because the browser genuinely is one, not a JavaScript costume
|
||||
over a headless engine.
|
||||
|
||||
For the VM signals specifically, the build derives one coherent real-hardware persona
|
||||
from a seed and overrides the browser-visible values to match it: the WebGL vendor and
|
||||
renderer name a real GPU (and the pixels are drawn to agree with the string, not just
|
||||
the string), `hardwareConcurrency` and device memory take values a real desktop
|
||||
reports, the `AudioContext` presents a real device's output characteristics, and the
|
||||
screen metrics describe a physical display. Every field is drawn from the same seed, so
|
||||
they agree with one another rather than being individually plausible and jointly
|
||||
contradictory, which is the failure mode a VM score is built to catch.
|
||||
|
||||
Switching from plain Playwright is two lines, and the operation this page is about -
|
||||
loading a page that scores your environment - is ordinary Playwright after that:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
# same seed -> same GPU, cores, memory, audio and screen every run
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
# read the values a VM detector would read
|
||||
report = page.evaluate("""() => {
|
||||
const gl = document.createElement('canvas').getContext('webgl');
|
||||
const dbg = gl && gl.getExtension('WEBGL_debug_renderer_info');
|
||||
return {
|
||||
renderer: dbg ? gl.getParameter(dbg.UNMASKED_RENDERER_WEBGL) : null,
|
||||
cores: navigator.hardwareConcurrency,
|
||||
memory: navigator.deviceMemory,
|
||||
sampleRate: new (window.AudioContext || window.webkitAudioContext)().sampleRate,
|
||||
screen: [screen.width, screen.height, window.devicePixelRatio],
|
||||
};
|
||||
}""")
|
||||
print(report)
|
||||
```
|
||||
|
||||
Run that inside the build and the renderer names a real GPU, the core and memory
|
||||
counts sit in the range real desktops report, the sample rate is a real device's, and
|
||||
the screen looks like a monitor. Run it in a stock headless browser on the same cloud
|
||||
instance and you will typically see a software renderer, a low core count and screen
|
||||
metrics that describe a framebuffer. That difference is the VM score, and it is the
|
||||
part a browser can control.
|
||||
|
||||
Because the persona is seed-derived, `seed=42` gives the same machine on every run,
|
||||
which is what makes a suspicious result reproducible instead of a one-off you cannot
|
||||
chase.
|
||||
|
||||
## The parts a browser fingerprint cannot fix
|
||||
|
||||
This is the honest caveat, and skipping it is how people get surprised.
|
||||
|
||||
Matching the browser-visible layer to a real desktop covers the browser-visible layer.
|
||||
It does nothing about:
|
||||
|
||||
- **The exit IP.** A datacenter address is a datacenter address, and a large share of
|
||||
VM detection in practice is just the IP's reputation and ASN. A perfect persona on a
|
||||
known cloud range still reads as a cloud instance. You supply the exit; the build
|
||||
only sets the browser to match it. See
|
||||
[why a container gets caught on the network and machine layers](playwright-docker-detection.md).
|
||||
- **Hypervisor timing side-channels.** Some detectors time operations whose cost
|
||||
differs under virtualization. That is a property of the CPU you are actually running
|
||||
on, not of any value the browser reports, and no fingerprint override changes it.
|
||||
- **Behaviour, rate and quota.** Human pacing, per-account limits and request velocity
|
||||
are yours to supply. A consistent browser hammering one endpoint from one address
|
||||
creates the exact signal it was trying to avoid.
|
||||
|
||||
So invisible_playwright helps with the browser-visible half of VM detection and does
|
||||
not, on its own, fix the IP, the timing floor or your behaviour. It is designed to be
|
||||
paired with a clean residential exit and human pacing, not to replace them. There is no
|
||||
setting that makes a browser undetectable, and any tool that claims one is selling the
|
||||
claim rather than the result.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Can a website detect a virtual machine? It can make a strong guess from the browser
|
||||
side - a software GPU renderer, odd core and memory counts, missing audio, generic
|
||||
display metrics - and it can prove very little from inside the page while proving quite
|
||||
a lot from your IP and handshake. invisible_playwright addresses the guessable,
|
||||
browser-visible half by presenting one coherent real-hardware persona instead of the
|
||||
default VM answers, and it is honest about the half it does not touch. Match the
|
||||
browser to a real desktop, put it behind a clean exit, pace it like a person, and the
|
||||
VM score stops being the thing that gives you away. Get any one of those three wrong and
|
||||
the other two will not save you.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Can JavaScript detect that I am in a VM?** Not directly. It cannot read CPUID, BIOS
|
||||
strings or the hypervisor. It infers from browser-visible values like the GPU renderer,
|
||||
core count, audio device and screen, and scores how VM-like they look together.
|
||||
|
||||
**What is the biggest browser-side VM tell?** A software or generic WebGL renderer
|
||||
string. It is a value you can read in plain text rather than a statistic you have to
|
||||
accumulate, so it stands out immediately.
|
||||
|
||||
**Does invisible_playwright hide that I am on a cloud server?** It fixes the
|
||||
browser-visible signals - GPU, cores, memory, audio, screen - to one coherent real
|
||||
desktop persona. It does not change your IP, which is often the actual reason a cloud
|
||||
session gets flagged.
|
||||
|
||||
**Can a website detect a VM through timing?** Some detectors time operations that cost
|
||||
more under virtualization. That is a property of the CPU you run on, not a browser
|
||||
value, so no fingerprint override affects it.
|
||||
|
||||
**Will a real-hardware persona alone get me through?** No. Pair it with a clean
|
||||
residential exit and human pacing. The persona covers the machine the browser reports,
|
||||
not the address it connects from or how fast you click.
|
||||
|
||||
**Is there a setting that makes the browser undetectable?** No, and be wary of anything
|
||||
that says otherwise. This lowers the browser-visible VM score to a real desktop's; the
|
||||
IP, timing floor and behaviour are still yours to get right.
|
||||
|
||||
## Sources
|
||||
|
||||
- The public fingerprint suites this project tests against, read for which environment
|
||||
values they collect and how they weight them - GPU renderer, hardwareConcurrency,
|
||||
deviceMemory, AudioContext output and screen metrics.
|
||||
- This project's release gates, which compare each of those fields against a stock
|
||||
Firefox on the same machine rather than reading a verdict.
|
||||
|
||||
**See also:** [WebGL renderer strings](webgl-renderer-strings.md) and
|
||||
[hardwareConcurrency and deviceMemory](hardware-concurrency-device-memory.md) for two
|
||||
of the signals above, and [how to test whether your browser is detected](how-to-test-bot-detection.md)
|
||||
for the compare-against-stock method that catches a VM tell a verdict hides.
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. It presents one coherent
|
||||
real-hardware persona to the browser-visible layer; the IP, the timing floor and the
|
||||
pacing are still yours to supply.*
|
||||
@@ -0,0 +1,221 @@
|
||||
---
|
||||
title: "Can a website detect Clipboard API access?"
|
||||
description: "A page can see navigator.clipboard and query clipboard-read permission state, but the async Clipboard API is a gesture gate, not a value fingerprint you leak."
|
||||
parent: "Detectors, Explained"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 21
|
||||
---
|
||||
|
||||
|
||||
# Can a website detect Clipboard API access?
|
||||
|
||||
Short version: a page can see that `navigator.clipboard` exists and it can ask the
|
||||
Permissions API what state `clipboard-read` is in, so yes, it can observe your
|
||||
relationship with the clipboard. What it mostly cannot do is turn that into a stable
|
||||
fingerprint of your machine. The Clipboard API is interesting to a detector for a
|
||||
different reason than canvas or WebGL are: it is not a value you leak, it is a gate that
|
||||
only opens for a real user gesture, and its permission state has to agree with a second
|
||||
API that reports the same thing.
|
||||
|
||||
This page is what the async Clipboard API actually exposes, why it behaves as a gate
|
||||
rather than a fingerprint, the cross-check a detector runs against it, how to drive it
|
||||
with a real trusted click, and the honest limit of what a patched browser does here.
|
||||
|
||||
## What the async Clipboard API actually exposes
|
||||
|
||||
The modern surface is the [Clipboard API](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API)'s
|
||||
`navigator.clipboard`, with two methods that matter for detection:
|
||||
`writeText()` and `readText()` (plus their richer `write()`/`read()` cousins). Both return
|
||||
promises, and both are guarded before they ever touch the system clipboard.
|
||||
|
||||
A page can read three things without any special access:
|
||||
|
||||
- **Whether `navigator.clipboard` is present at all.** A secure context (HTTPS) in a
|
||||
modern browser has it; its absence under a modern user agent is itself a mismatch.
|
||||
- **The permission state for `clipboard-read`**, by asking the
|
||||
[Permissions API](https://developer.mozilla.org/en-US/docs/Web/API/Permissions_API)'s
|
||||
`navigator.permissions.query({name: 'clipboard-read'})`. That returns `granted`,
|
||||
`denied` or `prompt` without prompting anyone.
|
||||
- **What happens when it calls a method.** A rejected promise, and the shape of the
|
||||
rejection, tells the page which guard tripped.
|
||||
|
||||
None of those three is a serial number. They describe policy, not hardware, and that is
|
||||
the whole point of this surface.
|
||||
|
||||
## Why clipboard is a gate, not a value fingerprint
|
||||
|
||||
Canvas gives back a hash. WebGL gives back a renderer string. The clipboard gives back
|
||||
almost nothing that varies from one honest machine to the next, because access is gated
|
||||
on two conditions the specification requires:
|
||||
|
||||
1. **A user gesture.** `readText()` and `writeText()` are only allowed while the document
|
||||
has [transient activation](https://developer.mozilla.org/en-US/docs/Web/Security/Defenses/User_activation),
|
||||
meaning a real interaction (a click, a key press) happened
|
||||
recently. Call either one from a script with no gesture behind it and the promise
|
||||
rejects.
|
||||
2. **A permission.** Reading additionally requires the `clipboard-read` permission;
|
||||
writing is allowed under a gesture in most configurations but can also be governed by
|
||||
`clipboard-write`.
|
||||
|
||||
For an automation setup this is exactly the kind of check that separates a real browser
|
||||
from a spoofed one, and it separates them on *behaviour*, not on a leaked value. A script
|
||||
that dispatches its own synthetic `click` event to satisfy the gesture requirement fails,
|
||||
because a page-built event carries `isTrusted=false` and does not count as activation.
|
||||
This is the same boolean that decides
|
||||
[whether an automated click reads as real input](playwright-clicks-istrusted.md): the
|
||||
clipboard gate sits directly on top of it.
|
||||
|
||||
So the detector question is not "what is your clipboard value". It is "does the clipboard
|
||||
open for you the way it opens for a person", and the answer depends on whether your
|
||||
clicks are trusted.
|
||||
|
||||
## The cross-check: permission state must agree with the Permissions API
|
||||
|
||||
The sharper check does not call the clipboard at all. It reads two answers to the same
|
||||
question and looks at whether they line up.
|
||||
|
||||
`navigator.clipboard` being present implies a certain permission model. The Permissions
|
||||
API is then asked directly: `query({name: 'clipboard-read'})`. On a coherent, real
|
||||
browser those two facts describe one consistent policy. On an over-patched setup, where
|
||||
someone bolted on `navigator.clipboard` or forced a permission state from JavaScript
|
||||
without moving the other half, the two disagree, and the disagreement is the tell.
|
||||
|
||||
It is the same shape as
|
||||
[the notifications permission mismatch](permissions-api-consistency.md), where
|
||||
`Notification.permission` and `navigator.permissions.query({name: 'notifications'})` are
|
||||
expected to give one coherent answer and a headless browser gives two. Clipboard adds a
|
||||
third instance of the pattern, alongside
|
||||
[the notification-state cross-check detectors already run](notification-permission-detection.md).
|
||||
Nobody has to recognise automation directly; they just ask the same thing twice through
|
||||
different code and compare.
|
||||
|
||||
A patched-at-the-engine build does well here for an unglamorous reason: it is a real
|
||||
Firefox. The permission plumbing is the browser's own, so the Permissions API answer and
|
||||
the clipboard's actual behaviour come from one source and cannot contradict each other the
|
||||
way a page-level shim does. There is nothing to keep in sync because nothing was bolted
|
||||
on.
|
||||
|
||||
## Reading the clipboard with invisible_playwright
|
||||
|
||||
Because Playwright's clicks go through the native input path, they arrive as trusted
|
||||
gestures, so the clipboard gate opens exactly as it would for a hand on the mouse. The
|
||||
launch is the usual two lines, and after that everything is stock Playwright:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
|
||||
# A page button whose handler calls navigator.clipboard.writeText(...).
|
||||
# The Playwright click is a trusted gesture, so the write is permitted.
|
||||
page.click("#copy-button")
|
||||
|
||||
# Inspect the surface the way a detector would: presence plus the
|
||||
# permission state that has to agree with it.
|
||||
report = page.evaluate("""async () => {
|
||||
const present = 'clipboard' in navigator;
|
||||
let readState = 'unavailable';
|
||||
try {
|
||||
const s = await navigator.permissions.query({ name: 'clipboard-read' });
|
||||
readState = s.state; // 'granted' | 'denied' | 'prompt'
|
||||
} catch (e) {
|
||||
readState = 'query-failed';
|
||||
}
|
||||
return { present, readState };
|
||||
}""")
|
||||
|
||||
print(report) # e.g. {'present': True, 'readState': 'prompt'}
|
||||
```
|
||||
|
||||
The values you get back are the ones a genuine Firefox returns: `navigator.clipboard`
|
||||
present in the secure context, and a `clipboard-read` state that matches the browser's
|
||||
real policy rather than a hand-forced constant. If you need to grant clipboard permissions
|
||||
explicitly for a `readText()` flow, use Playwright's own
|
||||
`context.grant_permissions([...])` on the browser context, exactly as you would with
|
||||
upstream Playwright; there is no separate API to learn here.
|
||||
|
||||
The measurable point is the one from the section above: the presence flag and the
|
||||
permission state agree, and a click-gated `writeText()` succeeds because the gesture was
|
||||
trusted. That agreement is what the cross-check is looking for, and it is a property of
|
||||
being a real browser rather than of any value we inject.
|
||||
|
||||
## What this does not fix
|
||||
|
||||
Passing the clipboard cross-check is a fingerprint-and-driver-layer win, and it is worth
|
||||
being blunt about where that win stops.
|
||||
|
||||
- **IP reputation.** The clipboard gate has nothing to do with your exit address. A
|
||||
coherent clipboard on a datacenter IP is still on a datacenter IP. Supply a clean exit;
|
||||
see [Configuration](configuration.md) for the proxy setup.
|
||||
- **Per-account quotas and rate limits.** Looking like a real browser does not raise a
|
||||
limit that is counted per account or per address. Those are policy on the other side,
|
||||
not a browser property.
|
||||
- **Behaviour and timing.** The gate cares that a gesture is trusted, not that your pacing
|
||||
is human. A trusted click fired in a machine-perfect rhythm is still a rhythm a watcher
|
||||
can measure.
|
||||
- **Clipboard prompts by design.** Some `readText()` flows are meant to prompt a human.
|
||||
Automating your way around a deliberate consent step is a different problem from looking
|
||||
real, and this page is only about the second.
|
||||
|
||||
invisible_playwright is built to look like a real browser driven by a real person, which
|
||||
is why the fingerprint, the TLS handshake and the driver layer read as a genuine Firefox
|
||||
and why checks like this one pass. It does not launder a bad IP or manufacture pacing.
|
||||
Those you supply: a clean proxy and human-shaped behaviour.
|
||||
|
||||
## Conclusion
|
||||
|
||||
A website can absolutely detect that you are touching the Clipboard API, and it can read
|
||||
your `clipboard-read` permission state without prompting. But the async Clipboard API is a
|
||||
gate, not a value fingerprint: access opens only for a real trusted gesture, and the
|
||||
permission it reports has to agree with the Permissions API's answer for the same thing.
|
||||
A patched-at-the-engine Firefox driven by stock Playwright clears both because the gesture
|
||||
is genuinely trusted and the permission plumbing is the browser's own. That handles the
|
||||
browser side. The exit and the pacing are still yours to get right.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Can a website tell if I read the clipboard?** It can see that `navigator.clipboard`
|
||||
exists and query the `clipboard-read` permission state. A silently rejected read also
|
||||
tells it which guard tripped. It cannot turn any of that into a stable machine
|
||||
fingerprint.
|
||||
|
||||
**Is the Clipboard API a fingerprinting surface?** Barely, in the value sense. It is a
|
||||
permission-and-gesture gate, so its interest to a detector is consistency and access
|
||||
behaviour, not a hash that varies between machines.
|
||||
|
||||
**Why does `readText()` reject in my automation?** Most often because there was no trusted
|
||||
user gesture, or the `clipboard-read` permission was not granted. A script-dispatched
|
||||
click does not count as a gesture.
|
||||
|
||||
**Do Playwright clicks satisfy the gesture requirement?** Yes. They go through the native
|
||||
input path and arrive as trusted events, so the clipboard gate opens as it would for a
|
||||
real user.
|
||||
|
||||
**What is the clipboard cross-check?** A detector compares `navigator.clipboard` presence
|
||||
against the Permissions API state for `clipboard-read`. On a real browser they describe
|
||||
one policy; a page-level shim that forces one without the other makes them disagree.
|
||||
|
||||
**Does a coherent clipboard mean I will not get blocked?** No. It is one browser-side
|
||||
signal. IP reputation, per-account quotas and behaviour are separate and are yours to
|
||||
handle.
|
||||
|
||||
## Sources
|
||||
|
||||
- The WHATWG and W3C definitions of the async Clipboard API and the Permissions API,
|
||||
including the user-activation and `clipboard-read`/`clipboard-write` requirements, read
|
||||
from the specifications rather than from a blog summary.
|
||||
- This project's own permission and gesture gates, which check that a click-gated
|
||||
operation succeeds under a trusted event and that the permission state a page can query
|
||||
agrees with the browser's real policy.
|
||||
|
||||
**See also:** [the trusted-click boolean the clipboard gate sits on](playwright-clicks-istrusted.md),
|
||||
[the permission answers that must agree](permissions-api-consistency.md), and
|
||||
[the notification cross-check detectors already run](notification-permission-detection.md).
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The clipboard opens for it
|
||||
because the gesture is genuinely trusted, not because a value was faked.*
|
||||
@@ -0,0 +1,205 @@
|
||||
---
|
||||
title: "Can a website tell you are running on a server?"
|
||||
description: "Websites spot a datacenter or headless host via software WebGL, missing audio, headless metrics, datacenter ASN - and what a real fingerprint can fix and cannot."
|
||||
parent: "Browser Identity"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 25
|
||||
---
|
||||
|
||||
|
||||
# Can a website tell you are running on a server?
|
||||
|
||||
Often, yes. Not because the code is automated, but because the host is a server:
|
||||
no GPU, no sound card, no monitor, and an address that belongs to a datacenter. A
|
||||
browser running there answers a handful of ordinary questions in a way that only a
|
||||
server answers them, and a detector does not need anything clever to notice.
|
||||
|
||||
The honest split is worth stating up front. Most of these tells are JavaScript-visible
|
||||
properties of the machine, and a browser that presents a real desktop persona answers
|
||||
them the way a desktop does, whether the host underneath is a laptop, a Linux VM or a
|
||||
Docker container. One of them is not a browser property at all: the exit IP is read at
|
||||
the network layer, before any script runs, and no browser can disguise it. That one is
|
||||
yours to solve with a clean proxy.
|
||||
|
||||
## What a server actually leaks
|
||||
|
||||
The failures that get a headless-host session blocked are almost never automation
|
||||
flags like [`navigator.webdriver`](navigator-webdriver-explained.md). Those are solved
|
||||
by every serious tool on day one. The ones that survive are hardware questions the
|
||||
machine cannot answer honestly:
|
||||
|
||||
- **The GPU**, read through the [`WEBGL_debug_renderer_info`](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_debug_renderer_info)
|
||||
extension, which on a server is drawn by software.
|
||||
- **The audio device**, read through [`AudioContext`](https://developer.mozilla.org/en-US/docs/Web/API/AudioContext), which on a server does not exist.
|
||||
- **The screen**, whose resolution, available height and device pixel ratio describe
|
||||
a display that no real desktop has.
|
||||
- **The exit address**, whose ASN says datacenter.
|
||||
|
||||
None of these are in JavaScript's gift to change from a page-level script, which is
|
||||
why a stealth plugin bolted onto a stock headless browser does not touch them. They
|
||||
are decided by the box the browser runs on. The rest of this page walks the first three
|
||||
(which a real-browser build answers on the browser side) and then the fourth (which it
|
||||
cannot).
|
||||
|
||||
## The software renderer tell
|
||||
|
||||
Ask a browser on a normal desktop what draws its graphics and it names a real GPU
|
||||
vendor and model. Ask a browser on a server and, if it renders WebGL at all, it names
|
||||
a software rasterizer: strings like `llvmpipe` or `SwiftShader`, or a generic "software"
|
||||
renderer. That string is a plain statement that there is no graphics hardware present,
|
||||
and a detector reads it as exactly that.
|
||||
|
||||
There is a subtler version of the same tell, and it is the one that catches half-fixes:
|
||||
the renderer string can be edited to say a real GPU while the pixels are still drawn by
|
||||
software. A page that draws a scene and reads back the result gets output that does not
|
||||
match the name, which is [a mismatch you cannot patch from a string override](renderer-string-vs-render.md).
|
||||
The name and the pixels have to agree.
|
||||
|
||||
invisible_playwright presents a real GPU persona, and the readback matches it, because
|
||||
the presented persona is what actually answers both the string query and the render.
|
||||
The [WebGL renderer strings page](webgl-renderer-strings.md) covers what a consistent
|
||||
vendor/renderer pair looks like and why the two halves have to line up.
|
||||
|
||||
## The missing audio device and the headless screen
|
||||
|
||||
Sound is the same story as graphics. An AudioContext reports a sample rate, an output
|
||||
latency and a channel count, and on a real machine those come from a real sound card.
|
||||
A container has none, so it answers with the defaults that a headless host produces,
|
||||
and the defaults are a signature. An empty or default audio profile under a desktop user
|
||||
agent is a server saying it is a desktop. The mechanism is in
|
||||
[AudioContext fingerprinting](audiocontext-fingerprinting.md).
|
||||
|
||||
The screen is the third. Headless hosts report resolutions nobody runs, a device pixel
|
||||
ratio no physical display has, and an available height equal to the full height, which
|
||||
means there is no taskbar because there is no desktop. Each value on its own is weak;
|
||||
together they describe a monitor that does not exist. The full set of these is in
|
||||
[screen size and other headless tells](screen-size-headless-tells.md).
|
||||
|
||||
A real-browser build answers all three as a Windows desktop would: a real GPU persona,
|
||||
a real AudioContext output, and Windows screen metrics with a plausible available height
|
||||
and device pixel ratio. Those answers are the same whether the host is your laptop or a
|
||||
Linux container, because they are presented by the browser rather than read from the box.
|
||||
|
||||
## What invisible_playwright presents instead
|
||||
|
||||
The launch is two lines, and the browser you get back is a real Playwright `Browser`,
|
||||
so every method is the one you already know. Here is the launch plus reading back the
|
||||
three signals this page is about:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
|
||||
report = page.evaluate("""() => {
|
||||
const gl = document.createElement('canvas').getContext('webgl');
|
||||
const dbg = gl.getExtension('WEBGL_debug_renderer_info');
|
||||
const ac = new (window.AudioContext || window.webkitAudioContext)();
|
||||
return {
|
||||
renderer: gl.getParameter(dbg.UNMASKED_RENDERER_WEBGL),
|
||||
vendor: gl.getParameter(dbg.UNMASKED_VENDOR_WEBGL),
|
||||
sampleRate: ac.sampleRate,
|
||||
screen: [screen.width, screen.height, screen.availHeight],
|
||||
dpr: window.devicePixelRatio,
|
||||
platform: navigator.platform,
|
||||
};
|
||||
}""")
|
||||
print(report)
|
||||
```
|
||||
|
||||
Run that on a Linux server or inside a container and the renderer names a real GPU, the
|
||||
vendor matches it, the AudioContext reports a desktop sample rate, the screen metrics
|
||||
describe a Windows display with a taskbar, and `navigator.platform` reads `Win32`. The
|
||||
same `seed=42` produces the same persona every run, so a value you saw once is a value
|
||||
you can reproduce and diff, rather than a fresh random draw each launch.
|
||||
|
||||
Because the browser is a genuinely patched Firefox driven by stock Playwright, the layers
|
||||
underneath the JavaScript match too: the TLS handshake and the driver surface read as a
|
||||
real Firefox rather than as an automated one. That consistency is the reason it passes
|
||||
most detection checks, and the way to confirm it is by comparison against a stock browser
|
||||
on the same machine rather than by trusting a single verdict.
|
||||
|
||||
## The boundary: the datacenter IP is still visible
|
||||
|
||||
Here is the caveat, stated plainly because a page that only lists what it fixes is not
|
||||
honest. Everything above happens inside the browser, at the JavaScript layer. The exit
|
||||
IP does not. The server reads your address at the network layer before a single line of
|
||||
script runs, and if that address sits in a datacenter ASN, a perfect browser fingerprint
|
||||
does not hide it. The browser cannot disguise the IP, by design, because the IP is not
|
||||
a browser property.
|
||||
|
||||
So a headless host with a flawless desktop persona and a datacenter exit has fixed the
|
||||
JavaScript tells and left the network tell standing. The fix is a residential or mobile
|
||||
proxy that presents a clean address, passed on launch:
|
||||
|
||||
```python
|
||||
proxy = {
|
||||
"server": "socks5://gate.example.com:1080",
|
||||
"username": "user",
|
||||
"password": "pass",
|
||||
}
|
||||
with InvisiblePlaywright(seed=42, proxy=proxy) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
```
|
||||
|
||||
And the address is only the first of the things the browser does not fix. IP reputation,
|
||||
per-account quotas, rate limits, and behaviour and timing are all supplied by you: a
|
||||
clean exit, human pacing, and sane request volume. The [configuration page](configuration.md)
|
||||
covers proxy schemes and how the browser timezone is auto-derived from the exit so the
|
||||
two do not tell different stories, and the [Docker and container detection walkthrough](playwright-docker-detection.md)
|
||||
covers the host-side tells in the order they usually bite.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Can a website tell you are on a server? From the browser alone, it usually can, through
|
||||
software WebGL, a missing audio device and headless screen metrics. A real-browser build
|
||||
answers those as a desktop, on the browser side, regardless of the Linux or container host
|
||||
underneath, which is why the JavaScript-visible surface stops giving the server away. What
|
||||
it does not and cannot fix is the datacenter IP, which is read at the network layer and
|
||||
needs a clean proxy, along with the account limits and pacing that no fingerprint touches.
|
||||
Fix the machine tells with the browser, fix the address with the proxy, and pace the
|
||||
behaviour yourself.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Can a website detect a headless or server browser?** Often, from the machine rather
|
||||
than the automation: a software WebGL renderer, no audio device, headless screen metrics,
|
||||
and a datacenter IP.
|
||||
|
||||
**Does invisible_playwright hide that I am on a server?** It presents a real GPU, real
|
||||
audio and Windows screen metrics on the browser side, so the JavaScript-visible tells look
|
||||
like a desktop. It does not hide the exit IP, which is a network-layer signal.
|
||||
|
||||
**Is the datacenter IP a browser problem?** No. The address is read before any script runs,
|
||||
so no browser can change it. That one needs a residential or mobile proxy.
|
||||
|
||||
**Why does a software renderer give me away?** Because a real desktop names a real GPU, and
|
||||
`llvmpipe` or `SwiftShader` is a plain statement that there is no graphics hardware present.
|
||||
|
||||
**Do I still need a proxy if my fingerprint is perfect?** Yes, if the host is in a
|
||||
datacenter. A flawless browser on a datacenter ASN is still on a datacenter ASN.
|
||||
|
||||
**Does this work the same in Docker as on a real machine?** The browser-side answers are
|
||||
the same because the persona is presented by the browser, not read from the host. The IP
|
||||
and the pacing still depend on where and how you run it.
|
||||
|
||||
## Sources
|
||||
|
||||
- This project's release gates, which read WebGL renderer, AudioContext output and screen
|
||||
metrics through the shipped binary on a Linux host and compare them against a stock
|
||||
desktop browser.
|
||||
- The per-surface pages linked throughout, each read from its own detector's source rather
|
||||
than from a rendered verdict.
|
||||
|
||||
**See also:** [Docker and container detection](playwright-docker-detection.md),
|
||||
[WebGL renderer strings](webgl-renderer-strings.md), and
|
||||
[screen size and other headless tells](screen-size-headless-tells.md).
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. It fixes the machine tells a
|
||||
server leaks in JavaScript; the datacenter IP and the pacing are still yours to supply.*
|
||||
@@ -0,0 +1,202 @@
|
||||
---
|
||||
title: "Can I Use My Real Browser Profile With Playwright?"
|
||||
description: "Playwright can point at a persistent profile, but reusing your daily browser leaks cookies and your machine fingerprint. Use a dedicated seed-fixed profile instead."
|
||||
parent: "The Automation Layer"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 24
|
||||
---
|
||||
|
||||
|
||||
# Can I Use My Real Browser Profile With Playwright?
|
||||
|
||||
Yes, technically. Playwright can launch against a [persistent user data
|
||||
directory](https://playwright.dev/python/docs/api/class-browsertype#browser-type-launch-persistent-context),
|
||||
and you can point it at the exact folder your everyday browser uses. The question is not
|
||||
whether it works. It is whether you want the two things that come with it: your personal
|
||||
cookies and history riding along in automated traffic, and whatever inconsistent
|
||||
fingerprint your daily machine happens to have.
|
||||
|
||||
Both are avoidable, and the fix is not "no profile". It is "a different profile". This
|
||||
page separates the good idea (a persistent profile) from the risky one (your personal
|
||||
one), and shows a seed-fixed persistent context that keeps login state across runs
|
||||
without carrying the host machine into every request.
|
||||
|
||||
## What people actually mean by "my real browser profile"
|
||||
|
||||
Two different wishes hide under the same sentence, and they have different answers.
|
||||
|
||||
The first is "I do not want to log in on every run." That is a reasonable and common
|
||||
need, and a persistent profile is the right tool for it: cookies, local storage and
|
||||
login state survive between sessions instead of starting empty each time.
|
||||
|
||||
The second is "I want to reuse the profile I browse with personally, because it is
|
||||
already logged in and already looks real." That is where it goes wrong. Your daily
|
||||
profile is full of your own cookies, your own history and consent decisions tied to
|
||||
your own identity, and none of that belongs in an automated session. It also inherits
|
||||
the fingerprint of the machine it launches on, which is a separate problem covered
|
||||
below.
|
||||
|
||||
You want the first wish granted and the second one declined.
|
||||
|
||||
## Why your personal profile is the wrong choice
|
||||
|
||||
Two independent reasons, and either one is enough on its own.
|
||||
|
||||
**It mixes your identity into automated traffic.** Every cookie, every stored session,
|
||||
every site that recognises you is now attached to whatever the automation does. If the
|
||||
automated session is flagged, throttled or challenged, it is your account that carries
|
||||
the record, not a disposable one. Linkability runs both directions: the profile links
|
||||
your automation to you, and links you to your automation.
|
||||
|
||||
**A stock profile carries whatever fingerprint the launching machine has.** This is the
|
||||
part most people miss. A plain profile does not standardise the machine underneath it.
|
||||
It reports the real GPU, the real fonts, the real screen and audio devices of wherever
|
||||
it runs. On your laptop that is your laptop. On a server it is a server with no GPU, no
|
||||
fonts and a screen size nobody has, which is [what actually gets a datacenter session
|
||||
detected](playwright-detected-as-bot.md), independent of any automation flag. Reusing
|
||||
your personal profile does not fix that. It just picks one specific inconsistent machine
|
||||
to leak.
|
||||
|
||||
The durable pattern is a dedicated profile whose identity you control, not the one you
|
||||
read your email with.
|
||||
|
||||
## The pattern that works: a dedicated, seed-fixed profile
|
||||
|
||||
invisible_playwright takes a persistent profile directory the same way plain Playwright
|
||||
does, through `profile_dir`. The difference is what fills in the machine. Instead of the
|
||||
host's real hardware, the fingerprint is derived from a seed, so the same seed produces
|
||||
the same coherent Windows browser every run: same GPU, same fonts, same screen, same
|
||||
audio context. Cookies and login state accumulate in the directory across runs; the
|
||||
machine stays a stable, real-looking Windows instance regardless of what the host
|
||||
actually is.
|
||||
|
||||
The launch is two lines over plain Playwright, and everything after it is stock
|
||||
Playwright:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
# one directory, one seed, paired for good
|
||||
with InvisiblePlaywright(seed=42, profile_dir="/profiles/identity-42") as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com/account")
|
||||
# first run: log in here. the directory keeps the session.
|
||||
# later runs on the same seed + directory: already logged in.
|
||||
```
|
||||
|
||||
The `browser` object is a real Playwright `Browser`, so `new_page`, `goto`, `click`,
|
||||
`fill` and every other documented method work exactly as upstream. There is no wrapped
|
||||
subset to learn. Add a proxy and a timezone the same way [Configuration](configuration.md)
|
||||
describes, and the identity is complete: a logged-in session, on a consistent machine,
|
||||
behind the exit you chose.
|
||||
|
||||
The pairing is the rule to hold onto: one directory belongs to one seed, permanently. A
|
||||
stable directory with a changing seed describes a browser whose history spans weeks and
|
||||
whose graphics card changed overnight, which is exactly the contradiction [a persistent
|
||||
profile can create if you let the seed drift](persistent-profiles.md).
|
||||
|
||||
## Reproduce a run, and pin what has to stay fixed
|
||||
|
||||
The reason a fixed seed matters for a login profile is not only realism. It is
|
||||
debuggability. If every run drew a fresh machine, a failing run would tell you nothing:
|
||||
you could not separate the site changing from the fingerprint changing. Log the seed
|
||||
once and a failure becomes reproducible.
|
||||
|
||||
```python
|
||||
sf = InvisiblePlaywright(profile_dir="/profiles/identity-99")
|
||||
with sf as browser:
|
||||
print("seed =", sf.seed) # write this down next to the directory
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
```
|
||||
|
||||
Record the seed beside the directory name, because the folder outlives your memory of
|
||||
which number produced it. If one specific field has to hold constant across identities
|
||||
for reasons of your own, [pin that field](pinning.md) and leave the rest seed-derived
|
||||
rather than reusing a whole personal profile to get it.
|
||||
|
||||
## The honest caveat: what a profile does and does not buy you
|
||||
|
||||
A dedicated seed-fixed profile preserves session trust. It does not launder anything
|
||||
else, and it is worth being precise about the boundary.
|
||||
|
||||
What it fixes: the "no history" problem. The session looks like it has been used, stays
|
||||
logged in, and does not reset to a blank browser every run. What it does not touch:
|
||||
|
||||
- **IP reputation.** The profile says nothing about your exit. A perfect logged-in
|
||||
identity on a known datacenter address is still on a known datacenter address. Supply a
|
||||
clean proxy; the profile does not.
|
||||
- **Per-account limits and quotas.** A site that caps actions per account still caps
|
||||
them. A reused session does not raise the ceiling, and hammering it from one session is
|
||||
the surest way to spend the account.
|
||||
- **Rate limits and timing.** Behaviour and pacing are yours to supply. The engine makes
|
||||
the browser look real; it does not make a burst of requests look human. That is a
|
||||
[session-reuse-versus-relogin tradeoff](automating-login-vs-session-reuse.md) and a
|
||||
pacing decision, not a fingerprint one.
|
||||
|
||||
invisible_playwright is built to look like a real browser driven by a real person, which
|
||||
is why the fingerprint, TLS and driver layers read as a genuine Firefox and pass most
|
||||
in-page detection. That is a real and useful thing. It is not the same as evading every
|
||||
control, and a profile does not change where that line sits. The reader still brings the
|
||||
clean exit and the human pacing.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Can you use your real browser profile with Playwright? You can, and you should not. The
|
||||
part you want, staying logged in, comes from any persistent profile. The part you do not
|
||||
want, your personal cookies and one specific leaky machine in every request, is exactly
|
||||
what reusing your daily profile adds.
|
||||
|
||||
Point automation at a dedicated directory, pair it permanently with one seed so the
|
||||
machine underneath stays a coherent Windows browser instead of the host, and log the
|
||||
seed so a bad run is reproducible. Then remember what the profile is not: it keeps the
|
||||
session, and it leaves the IP, the quotas and the pacing to you.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Can Playwright use an existing browser profile?** Yes, through a persistent user data
|
||||
directory. The mechanism is fine. Reusing the profile you personally browse with is the
|
||||
part to avoid.
|
||||
|
||||
**Why not just point it at my normal Chrome or Firefox profile?** Because it drags your
|
||||
personal cookies and history into automated traffic and inherits the launching machine's
|
||||
fingerprint, including a server's missing GPU and fonts.
|
||||
|
||||
**Does a persistent profile keep me logged in between runs?** Yes. Cookies and login
|
||||
state live in the directory and survive across sessions, as long as one directory maps
|
||||
to one seed and is never shared between concurrent runs.
|
||||
|
||||
**Does reusing a profile make me undetectable?** No. It fixes having no history and
|
||||
nothing else. The machine, the exit IP, the account quotas and your timing are all
|
||||
separate, and a profile touches none of them.
|
||||
|
||||
**Do I need a new seed for each profile?** Yes, a distinct seed per profile, and the
|
||||
same seed every time for a given profile. The seed is the machine; the directory is the
|
||||
history.
|
||||
|
||||
**Will a dedicated profile fix a blocked datacenter IP?** No. Session trust and IP
|
||||
reputation are unrelated. A logged-in identity on a flagged address is still on a flagged
|
||||
address; that needs a clean exit, not a profile.
|
||||
|
||||
## Sources
|
||||
|
||||
- Playwright's own [`launch_persistent_context`
|
||||
documentation](https://playwright.dev/python/docs/api/class-browsertype#browser-type-launch-persistent-context),
|
||||
which defines the user data directory mechanism this page builds on.
|
||||
- This project's persistent-context handling and the seed-to-fingerprint derivation
|
||||
described across these docs, including the seed and `profile_dir` pairing.
|
||||
- The detection ordering in the companion checklist, where machine tells outrank
|
||||
automation tells and the exit IP is a separate axis from the browser.
|
||||
|
||||
**See also:** [what a persistent profile fixes and breaks](persistent-profiles.md) for
|
||||
the traps that come with the directory, [automating the login versus reusing a
|
||||
session](automating-login-vs-session-reuse.md) for the tradeoff behind staying logged
|
||||
in, and [scraping behind a login with Playwright](how-to-scrape-behind-login-playwright.md)
|
||||
for the end-to-end version of this.
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The seed-and-directory
|
||||
pairing rule is one I wrote down after debugging a profile whose machine changed
|
||||
overnight.*
|
||||
@@ -0,0 +1,195 @@
|
||||
---
|
||||
title: "Can two devices share a browser fingerprint?"
|
||||
description: "Yes - that's the goal: a shared browser fingerprint hides you among real users, while a unique one is trackable. How anonymity sets work and how to land in one."
|
||||
parent: "Browser Identity"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 26
|
||||
---
|
||||
|
||||
|
||||
# Can two devices share a browser fingerprint?
|
||||
|
||||
Yes, two devices can present the same browser fingerprint, and if your goal is not to
|
||||
be followed around, that is the outcome you want rather than the one to avoid.
|
||||
|
||||
The intuition most people bring to this is backwards. It feels like a fingerprint should
|
||||
be unique, like a real one, and that a collision is a failure. For tracking it is the
|
||||
opposite: a fingerprint that only you have is a fingerprint that follows only you. A
|
||||
fingerprint that thousands of real people also have tells a tracker almost nothing about
|
||||
which of them you are.
|
||||
|
||||
This page is about that trade, why a common configuration beats a clever one, and how to
|
||||
land on a shared-looking identity on purpose instead of by luck.
|
||||
|
||||
## The anonymity set is the whole game
|
||||
|
||||
A browser fingerprint is not one value. It is a hash of many components read from
|
||||
JavaScript: the GPU string, the canvas and audio outputs, the installed fonts, the
|
||||
screen geometry, the platform, the language list, and dozens more. [FingerprintJS calls
|
||||
the resulting hash a visitor ID](fingerprintjs-visitor-id.md), and its job is to
|
||||
recognise you again on the next visit.
|
||||
|
||||
The number that decides whether it can is the size of the group that shares your value.
|
||||
This group is the anonymity set. If ten thousand other browsers produce exactly your
|
||||
hash, the visitor ID identifies a crowd, not you, and the tracker has to fall back on
|
||||
other signals to tell you apart. If your hash is unique, the visitor ID identifies you
|
||||
and only you, and it will do so every session until one of those components changes.
|
||||
|
||||
So the useful question is not "is my fingerprint unique". Uniqueness is the failure mode.
|
||||
The useful question is "how many real people look exactly like this", and you want that
|
||||
number large.
|
||||
|
||||
A one-of-a-kind fingerprint loses this even when every individual value is plausible. A
|
||||
GPU nobody else reports, a screen size nobody else has, a font set assembled by no real
|
||||
installer: each looks fine alone and, taken together, marks one browser out of everyone.
|
||||
That is why [pinning fields by hand is risky](pinning.md) unless you know the
|
||||
combination is one real machines actually ship.
|
||||
|
||||
## Why a common configuration beats a clever one
|
||||
|
||||
The instinct to look special is exactly the wrong instinct here.
|
||||
|
||||
Trackers do not need to prove you are automated to follow you. They only need your
|
||||
combination of values to be rare. Rarity is the signal, and it does not care whether the
|
||||
values are suspicious. A perfectly innocent, perfectly consistent, perfectly unique
|
||||
browser is perfectly trackable.
|
||||
|
||||
So the design target is the boring middle of the distribution: a Windows version many
|
||||
people run, a GPU many people have, a screen size that sits on a common laptop panel, a
|
||||
language list a large population shares. Land there and you disappear into a group. Land
|
||||
on the tails, even with clean values, and you stand out by being precise.
|
||||
|
||||
This is also why "resist fingerprinting" and "blend into a crowd" are two different
|
||||
strategies that can conflict. The browser's own
|
||||
[resistFingerprinting mode](resist-fingerprinting.md) makes many browsers report the same
|
||||
flattened values, which is one way to build an anonymity set, but the set it puts you in
|
||||
is the set of people who turned that mode on, and that set has its own recognisable shape.
|
||||
Blending in with the general population is a different bet: look like the common case, not
|
||||
like the privacy case.
|
||||
|
||||
## How a seed lands you in a crowd
|
||||
|
||||
invisible_playwright generates each identity to look like a common, real-world Windows
|
||||
machine rather than a rare or unusual one, because a configuration many genuine users
|
||||
also present blends in, while a one-of-a-kind combination stands out and is trackable.
|
||||
The GPU string, the renderer, and the capability limits it reports are chosen together
|
||||
and cross-checked, so
|
||||
[the WebGL parameters agree with each other](webgl-parameters-are-identical.md) the way a
|
||||
real driver's do rather than being mixed from different machines.
|
||||
|
||||
Switching from stock Playwright is two lines, and the identity is generated for you:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright() as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
```
|
||||
|
||||
Pass a seed and every field it implies comes back identical, run after run, so you can
|
||||
inspect the exact identity a seed produces and reuse it:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
# same GPU, same canvas hash, same fonts, same screen, every run
|
||||
```
|
||||
|
||||
The `browser` returned is a real Playwright `Browser`. Every method works exactly as
|
||||
documented upstream; there is no reduced API to learn.
|
||||
|
||||
Two different seeds give two different plausible identities, and because each is
|
||||
generated to be a common real-world configuration, both can land in a well-populated
|
||||
part of the space.
|
||||
That is the sense in which two of your own devices can "share" a look: not that they hash
|
||||
to the same value by accident, but that each is a common configuration, and common
|
||||
configurations are shared by construction with the real population.
|
||||
|
||||
## The caveat: fingerprint is not the only thing matched
|
||||
|
||||
Blending in on fingerprint does not blend in everything, and this is the honest limit of
|
||||
what any fingerprint layer can do.
|
||||
|
||||
A browser identity that looks like a common real machine is why invisible_playwright
|
||||
passes most in-page detection: the fingerprint, the TLS handshake and the driver layer
|
||||
read as a genuine Firefox rather than an automated one. That is a real and load-bearing
|
||||
result. It is also only one of the axes a serious system matches on, and the others are
|
||||
matched separately:
|
||||
|
||||
- **Your IP address.** A crowd-blending fingerprint on a datacenter address, or on a
|
||||
proxy IP that is already known and shared by a thousand scrapers this minute, is
|
||||
singled out by the address alone. Fingerprint collisions do not help you here; supply a
|
||||
clean exit yourself.
|
||||
- **Your request pattern.** Rate, timing, the order you touch pages, per-account quotas.
|
||||
A hundred sessions that each look like a different real person, all arriving in the same
|
||||
ten seconds from the same place, are a pattern no fingerprint hides. Human pacing is
|
||||
yours to supply.
|
||||
- **The story your surfaces tell together.** A common browser fingerprint with a timezone
|
||||
or language that contradicts the exit IP is not blended in, it is inconsistent, and
|
||||
[a timezone that does not match the proxy](timezone-proxy-mismatch.md) is one of the
|
||||
most common self-inflicted versions of this.
|
||||
|
||||
So the accurate claim is narrow and worth stating plainly: a shared, common fingerprint
|
||||
helps you avoid being tracked and identified by fingerprint. It does nothing for IP
|
||||
reputation, quotas, rate limits, or behaviour. Those are matched on their own, they can
|
||||
single you out on their own, and the reader supplies the clean proxy and the human pacing
|
||||
that address them. Anyone promising that one browser makes a session undetectable is
|
||||
selling the part that does not exist.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Two devices sharing a browser fingerprint is not a bug, it is the objective. Uniqueness
|
||||
is what makes a browser trackable across sessions; membership in a large group of
|
||||
look-alike real users is what makes it hard to follow. Sampling common, cross-checked
|
||||
real-world configurations lands you in that group on purpose. Then pair it with an
|
||||
address and a rhythm that fit the same story, because fingerprint blending buys you the
|
||||
fingerprint axis and only that one.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Can two devices have the same browser fingerprint?** Yes. Many components are shared by
|
||||
large populations, so identical hashes across devices are normal, and for anti-tracking
|
||||
they are what you want.
|
||||
|
||||
**Is a unique fingerprint good or bad?** Bad, if you do not want to be followed. Unique
|
||||
means recognisable on every future visit. Common means lost in a crowd.
|
||||
|
||||
**Does sharing a fingerprint make me anonymous?** On the fingerprint axis it hides you in
|
||||
a group. It does nothing about your IP address or your request pattern, which are matched
|
||||
separately and can identify you on their own.
|
||||
|
||||
**Why does invisible_playwright aim for a common configuration instead of a rare one?**
|
||||
Because rarity is the tracking signal. A configuration many real users also present puts
|
||||
you in a large anonymity set instead of marking you out.
|
||||
|
||||
**If I pass the same seed on two machines, do they look identical?** Yes. The same seed
|
||||
produces the same GPU, canvas, audio, fonts and screen, which is deliberate: it makes a
|
||||
run reproducible and lets two devices present the same known-good identity.
|
||||
|
||||
**Will a good fingerprint alone stop me from being blocked?** No. It handles the
|
||||
fingerprint, TLS and driver layers. A datacenter IP or a robotic request pattern is still
|
||||
a datacenter IP or a robotic pattern, and you supply the clean exit and the human pacing.
|
||||
|
||||
## Sources
|
||||
|
||||
- The FingerprintJS open-source library's visitor ID model, read from its own source, for
|
||||
how many components combine into one recognisable hash.
|
||||
- This project's approach of generating common, real-world Windows and GPU
|
||||
configurations rather than unique ones, and its cross-checking of GPU string, renderer
|
||||
and capability limits against each other.
|
||||
- This project's release gates, which separate fingerprint realness from IP and request
|
||||
signals precisely because a clean fingerprint does not clear the other two.
|
||||
|
||||
**See also:** [what a FingerprintJS visitor ID actually measures](fingerprintjs-visitor-id.md),
|
||||
[why the WebGL parameters have to agree with each other](webgl-parameters-are-identical.md),
|
||||
and [when the timezone does not match the proxy](timezone-proxy-mismatch.md).
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The anonymity-set framing
|
||||
is the one that keeps me from "fixing" a shared fingerprint that was doing its job.*
|
||||
@@ -0,0 +1,192 @@
|
||||
---
|
||||
title: "Can websites detect a datacenter or proxy IP?"
|
||||
description: "Yes, directly at the network layer. No fingerprint can hide the IP the connection arrives on. Why fingerprint and IP layers are independent and both must be right."
|
||||
parent: "Detectors, Explained"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 16
|
||||
---
|
||||
|
||||
|
||||
# Can websites detect a datacenter or proxy IP?
|
||||
|
||||
Yes, directly. The server sees the address your connection arrives on before a
|
||||
single line of your JavaScript runs, and it can look that address up: which
|
||||
network owns it, whether it belongs to a hosting provider or a home broadband
|
||||
line, and whether it has been abused recently. No browser fingerprint changes
|
||||
that lookup, because the address is a property of the connection, not of the
|
||||
page.
|
||||
|
||||
This is the honest boundary of any browser-side stealth. A tool like
|
||||
invisible_playwright makes the browser look like a real person's, and that is
|
||||
most of what public detection checks read. It does not, and cannot, change the
|
||||
reputation of the IP you route through. Those are two independent layers, and
|
||||
both have to be right.
|
||||
|
||||
## What the server reads before your page loads
|
||||
|
||||
Every request carries a source IP. From that one number the receiving server
|
||||
derives, with no cooperation from you:
|
||||
|
||||
- **The ASN**, the [autonomous system number](https://datatracker.ietf.org/doc/html/rfc1930),
|
||||
which identifies the network that owns the address block. Hosting and cloud
|
||||
providers have their own ASNs, and they are trivially separable from
|
||||
consumer broadband and mobile carriers.
|
||||
- **The address type**, datacenter versus residential versus mobile, which
|
||||
public and commercial datasets label directly.
|
||||
- **Reputation**, meaning whether this address or its neighbours have recently
|
||||
sent traffic that looked automated or abusive. Shared and heavily recycled
|
||||
exits accumulate this quickly.
|
||||
|
||||
None of that is a browser property. It is decided at the network layer, the same
|
||||
layer that carries the [TLS handshake no in-page test can see](how-to-test-bot-detection.md).
|
||||
A perfect fingerprint sitting on an address the server already distrusts is a
|
||||
consistent browser on a flagged IP, and the flag wins.
|
||||
|
||||
## Why the fingerprint cannot reach it
|
||||
|
||||
The fingerprint cannot reach the IP because the two are different kinds of
|
||||
value: the fingerprint is data the browser volunteers to the page, and the IP
|
||||
is decided by the network carrying the connection, which the page never
|
||||
touches.
|
||||
|
||||
A fingerprint is everything the page can measure about the client from inside
|
||||
the sandbox: the user agent, the GPU string, the canvas and audio hashes, the
|
||||
font list, the screen, the language settings. All of it is data the browser
|
||||
volunteers in response to JavaScript. That is exactly why it is spoofable, and
|
||||
why matching it to a real Windows machine is worth doing.
|
||||
|
||||
The IP is the opposite kind of value. It is not something the browser reports;
|
||||
it is where the packets came from. The browser cannot lie about it because the
|
||||
browser is not the one telling the server. The network is. You can change which
|
||||
IP you arrive on by routing through a different proxy, but you cannot make a
|
||||
given IP read as something it is not, and no amount of in-page patching touches
|
||||
it. This is the single most common misunderstanding about stealth: people expect
|
||||
a good fingerprint to cover the address, and the two never meet.
|
||||
|
||||
## Both layers, independently, with the real API
|
||||
|
||||
Because the layers are independent, you supply the IP and the tool supplies the
|
||||
browser. The proxy is passed at launch, and everything downstream is stock
|
||||
Playwright:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
proxy = {
|
||||
"server": "socks5://gate.example.com:1080",
|
||||
"username": "user",
|
||||
"password": "pass",
|
||||
}
|
||||
|
||||
with InvisiblePlaywright(seed=42, proxy=proxy) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com/")
|
||||
print(page.title())
|
||||
```
|
||||
|
||||
Two things are happening here, and they are separate. `seed=42` fixes the
|
||||
browser half: the same GPU, canvas hash, audio context, fonts and screen every
|
||||
run, so a failure is reproducible. `proxy=...` fixes the IP half: every request,
|
||||
including DNS, leaves through that exit. The `browser` object is a real
|
||||
Playwright [`Browser`](https://playwright.dev/python/docs/api/class-browser), so
|
||||
`new_page`, `goto`, `click` and the rest behave exactly as documented upstream.
|
||||
|
||||
By default, with no `timezone=` argument, the browser timezone is derived from
|
||||
the exit IP so the two stories agree. If you want to confirm the exit is what you
|
||||
think it is, read it from inside the browser rather than assuming, and check that
|
||||
[WebRTC is not reporting a second address next to the proxy's](how-to-check-proxy-ip-leak.md).
|
||||
|
||||
## Choosing the IP half so it does not undo the browser half
|
||||
|
||||
The fingerprint work is wasted if the address is one a server distrusts on sight.
|
||||
Two rules follow directly from what the server reads:
|
||||
|
||||
- **Type matters more than count.** A residential or mobile exit shares an ASN
|
||||
and an address type with ordinary human traffic; a datacenter exit does not,
|
||||
no matter how many of them you rotate through. Rotation does not change the
|
||||
type.
|
||||
- **Freshness matters as much as type.** A large share of cheaply available
|
||||
proxies are already public, which means their addresses are already on the
|
||||
lists servers consult, and they were flagged before you ever used them. The
|
||||
distinction between a clean exit and a burned one is not price, it is whether
|
||||
the address is already known. The tradeoffs between exit protocols are covered
|
||||
in [SOCKS5 versus HTTP proxies for a browser](socks5-vs-http-proxy-browser.md),
|
||||
and the reputation problem itself in
|
||||
[why scraping gets blocked even through a proxy](web-scraping-getting-blocked-proxies.md).
|
||||
|
||||
Get both halves right and the server sees a genuine Firefox arriving from an
|
||||
address that looks like a person's. Get the browser right and the IP wrong, and
|
||||
you have built a careful disguise and then signed it at the door.
|
||||
|
||||
## What this does and does not fix
|
||||
|
||||
To be explicit, because overclaiming here is both false and a real risk:
|
||||
|
||||
invisible_playwright is designed to look like a real browser driven by a real
|
||||
person, and that is why it passes most fingerprint, TLS and driver-layer checks:
|
||||
those layers read as a genuine Firefox. On its own it does not fix IP reputation,
|
||||
per-account quotas, rate limits, or behaviour and timing. Those are yours to
|
||||
supply: a clean exit for the address, human pacing for the behaviour, sane limits
|
||||
for the account. There is no setting that makes an IP undetectable, because the
|
||||
IP is not something the browser gets to describe.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Can websites detect a datacenter or proxy IP? Yes, directly and early, at a layer
|
||||
no fingerprint reaches. The browser fingerprint and the IP are independent
|
||||
signals, read by different parts of the stack, and a detector that sees a perfect
|
||||
browser on a flagged address believes the address. So match the browser, which is
|
||||
what this tool does, and pair it with an exit whose type and reputation hold up,
|
||||
which is what you bring. Neither half alone is a session; both right is.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Can a browser fingerprint hide my IP?** No. The IP is where the connection
|
||||
comes from, not something the browser reports, so no in-page value or spoof
|
||||
changes it.
|
||||
|
||||
**Will a residential proxy alone get me through?** It fixes the address half. If
|
||||
the browser still looks automated, a clean IP does not save it. Both layers have
|
||||
to be right.
|
||||
|
||||
**How does a site know my IP is a datacenter?** From the ASN and address-type
|
||||
datasets tied to the IP. Hosting networks have their own autonomous system
|
||||
numbers and are labelled as such in public data.
|
||||
|
||||
**Does rotating IPs help?** It helps with rate limits and per-address velocity.
|
||||
It does not change the type: rotating datacenter exits are still datacenter
|
||||
exits.
|
||||
|
||||
**Can invisible_playwright change my ASN or reputation?** No, and nothing on the
|
||||
browser side can. It handles the fingerprint, TLS and driver layers; you supply
|
||||
the exit.
|
||||
|
||||
**Why do I pass every fingerprint test and still get blocked?** Because the
|
||||
suites do not see your address, and a consistent browser on a distrusted IP is
|
||||
still on a distrusted IP.
|
||||
|
||||
## Sources
|
||||
|
||||
- [RFC 1930](https://datatracker.ietf.org/doc/html/rfc1930), the IETF guidelines
|
||||
that define an Autonomous System as a routing policy unit and specify the ASN
|
||||
that identifies it.
|
||||
- [Playwright's `Browser` class reference](https://playwright.dev/python/docs/api/class-browser),
|
||||
for what the `browser` object in the example above exposes once the proxy is
|
||||
wired in.
|
||||
- This project's default behaviour: the proxy dict passed at launch routes every
|
||||
request and its DNS through the exit, and the browser timezone is derived from
|
||||
that exit unless an explicit zone is set.
|
||||
- The [configuration notes](configuration.md) on proxy schemes and on why roughly
|
||||
nine in ten cheap proxies are already known before first use.
|
||||
- The [testing method page](how-to-test-bot-detection.md), which lists IP
|
||||
reputation among the things no in-page suite covers.
|
||||
|
||||
**See also:** [the checklist for being detected on one site](playwright-detected-as-bot.md),
|
||||
[how to check for a proxy IP leak](how-to-check-proxy-ip-leak.md), and
|
||||
[when the timezone does not match the proxy](timezone-proxy-mismatch.md).
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The browser half is
|
||||
what the patch does; the IP half is the one honest thing it cannot do for you.*
|
||||
@@ -0,0 +1,206 @@
|
||||
---
|
||||
title: "Can websites detect Playwright? What is actually visible"
|
||||
description: "Stock Playwright exposes a webdriver flag, protocol artifacts and mismatched OS fingerprint. Which signals catch your run, and what a patched Firefox fixes."
|
||||
parent: "The Automation Layer"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 20
|
||||
---
|
||||
|
||||
|
||||
# Can websites detect Playwright? What is actually visible
|
||||
|
||||
Yes, in principle. Stock Playwright leaves signals in the page that a script can read,
|
||||
and any one of them is enough to tell "this is automated" from "this is a person". But
|
||||
"in principle" is doing real work in that sentence. Whether a given site catches your
|
||||
specific run depends entirely on which of those signals it bothers to check, and there
|
||||
are only a handful of them.
|
||||
|
||||
This page enumerates the concrete tells a page can read, maps each to what a real-looking
|
||||
browser does about it, and shows the two-line launch that removes the browser-level ones.
|
||||
It also states plainly what that launch does not touch, because a page that promised you
|
||||
undetectability would be lying to you.
|
||||
|
||||
## The three signals a page can actually read
|
||||
|
||||
Strip away the folklore and stock Playwright exposes three families of tell to in-page
|
||||
JavaScript:
|
||||
|
||||
- **A driver flag.** `navigator.webdriver` is defined by the
|
||||
[WebDriver automation standard](https://www.w3.org/TR/webdriver2/), and a page reads it
|
||||
with one property access.
|
||||
- **Protocol and automation artifacts.** Globals left in scope by a stealth layer, a
|
||||
built-in whose `toString()` no longer says `[native code]`, an event that arrives
|
||||
without the trusted bit a real click carries.
|
||||
- **A fingerprint that contradicts itself.** The user agent claims one operating system
|
||||
while the GPU string, the font list, the audio device or the screen geometry describe a
|
||||
headless machine somewhere else.
|
||||
|
||||
Everything a page-level bot check does falls into one of those three. The rest of this
|
||||
article takes them one at a time.
|
||||
|
||||
## Signal one: the webdriver flag
|
||||
|
||||
The cheapest check there is. Under standard automation, `navigator.webdriver` returns
|
||||
`true`, and a single line of page script reads it.
|
||||
|
||||
The naive fix makes things worse. Setting the property to `false` from a script is itself
|
||||
a tell, because a genuine browser that was never automated reports `undefined`, not
|
||||
`false`. A value where there should be an absence is a signature of its own. The correct
|
||||
behaviour is the one an untouched browser produces, and getting there from JavaScript
|
||||
patching is [harder than it looks](navigator-webdriver-explained.md).
|
||||
|
||||
invisible_playwright drives a Firefox patched at the C++ level, so the flag reports the
|
||||
real-browser value without a script ever assigning it. There is no override to catch,
|
||||
because nothing overrode anything.
|
||||
|
||||
## Signal two: automation globals and protocol artifacts
|
||||
|
||||
Automation globals and protocol artifacts are what the act of driving the browser leaves
|
||||
lying around, and they exist whether or not the driver flag above was ever touched.
|
||||
|
||||
JavaScript stealth plugins reach into built-ins to hide the first signal, and in doing so
|
||||
they create the second: a redefined function whose `toString()` stops returning
|
||||
`[native code]`, a property descriptor that a real engine never has, a global that only a
|
||||
particular tooling stack defines. A tampering-oriented suite such as CreepJS does not ask
|
||||
what you report, it asks whether anything you report contradicts anything else, and a
|
||||
built-in that has been rewritten is exactly that kind of contradiction. This is
|
||||
[the native-code check](tostring-native-code-detection.md), and it is the reason stacking
|
||||
two disguises reads worse than one.
|
||||
|
||||
Because the browser is patched in the engine rather than in the page, there are no
|
||||
injected globals to enumerate and no rewritten built-ins to catch with `toString()`. The
|
||||
functions a page inspects are the genuine ones.
|
||||
|
||||
## Signal three: a fingerprint that does not match the claimed OS
|
||||
|
||||
A fingerprint that contradicts the claimed operating system is the family that catches most
|
||||
server-side automation, and it has nothing to do with the driver at all.
|
||||
|
||||
A page reads the user agent, then reads the GPU renderer string, the installed fonts, the
|
||||
audio device parameters and the screen geometry, and checks that they tell the same story.
|
||||
A headless machine in a datacenter usually fails that check without any automation flag
|
||||
being set: a software renderer under a claim of desktop hardware, a font set that belongs
|
||||
to a different operating system, an audio stack answering with defaults, a screen
|
||||
resolution no real display has. None of those are automation tells. They are
|
||||
"this is a datacenter" tells, and they survive every page-level patch because they are not
|
||||
in JavaScript's gift to change.
|
||||
|
||||
invisible_playwright derives a complete, internally consistent fingerprint from a seed:
|
||||
GPU, canvas, audio, fonts and screen, roughly 400 fields, generated to agree with each
|
||||
other and to describe a real Windows desktop rather than the host the code runs on. Same
|
||||
seed, same machine, every run, which is what makes a failure reproducible enough to bisect.
|
||||
This is the family that a real-browser fingerprint fixes and a property patch cannot, and
|
||||
it is why the launch below passes most JS detection: the driver layer, the fingerprint and
|
||||
the TLS handshake all read as a genuine Firefox.
|
||||
|
||||
## The launch that removes the browser-level tells
|
||||
|
||||
Switching from stock Playwright is two lines, and the object you get back is a real
|
||||
Playwright `Browser`, so every method you already use works unchanged.
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
# seed=42 makes the identity reproducible; drop it for a fresh one each run
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
# navigator.webdriver reads as a real browser; the fingerprint is consistent
|
||||
print(page.evaluate("navigator.webdriver"))
|
||||
```
|
||||
|
||||
Add a proxy when you deploy, since the browser-level tells are only half the picture:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
proxy = {"server": "socks5://gate.example.com:1080", "username": "u", "password": "p"}
|
||||
with InvisiblePlaywright(seed=42, proxy=proxy) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
```
|
||||
|
||||
The async API is identical, `from invisible_playwright.async_api import InvisiblePlaywright`
|
||||
with `await` in front of the page calls. Nothing else about your Playwright code changes.
|
||||
|
||||
## What this does not fix, and why saying so matters
|
||||
|
||||
Here is the honest boundary, because a tool that removed only some of the signals and let
|
||||
you believe it removed all of them would get you blocked with more confidence, not less.
|
||||
|
||||
The launch above addresses the three browser-level families: the driver flag, the
|
||||
automation artifacts and the fingerprint, plus the TLS handshake, because the request is
|
||||
made by a real Firefox rather than something impersonating one. What it does not touch:
|
||||
|
||||
- **IP reputation.** A consistent browser on a known datacenter address is still on a
|
||||
known datacenter address. You supply a clean exit.
|
||||
- **Per-account quotas and rate limits.** A perfect fingerprint does not raise a limit the
|
||||
account already hit.
|
||||
- **Behaviour and timing.** A burst of identical requests, a form filled in eighty
|
||||
milliseconds, a session with no pointer motion. Some sites do not fingerprint at all,
|
||||
they watch, and pacing is on you.
|
||||
|
||||
So the accurate claim is narrow and true: invisible_playwright makes the browser read as a
|
||||
real one, which is why it passes most in-page detection. It does not make the session
|
||||
invulnerable, and no software can, because half the signals are about the network and the
|
||||
account rather than the browser. When a run still fails with all three browser families
|
||||
clean, the [checklist for being detected on one site](playwright-detected-as-bot.md) works
|
||||
the remaining suspects in the cheap-first order, and the network layer has
|
||||
[its own page on the handshake](ja3-ja4-tls-fingerprint.md).
|
||||
|
||||
## Conclusion
|
||||
|
||||
Can websites detect Playwright? They can detect stock Playwright whenever they check for
|
||||
one of three things: the webdriver flag, automation artifacts, or a fingerprint that
|
||||
disagrees with the claimed OS. A patched Firefox driven by stock Playwright removes all
|
||||
three at the engine level, which is why it clears most JavaScript detection. It does
|
||||
nothing for your IP, your quotas or your pacing, so the honest answer to the title is that
|
||||
it fixes the browser and leaves the rest to you. Verify it the way you would verify
|
||||
anything here: [compare against a stock browser and run it more than once](how-to-test-bot-detection.md).
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Can a website tell I am using Playwright?** If it checks the webdriver flag, automation
|
||||
artifacts or fingerprint consistency, yes for stock Playwright. A patched-engine browser
|
||||
removes those browser-level tells.
|
||||
|
||||
**Does invisible_playwright make me undetectable?** No, and nothing does. It makes the
|
||||
browser read as a real Firefox, which passes most in-page checks. Your IP, account limits
|
||||
and behaviour are separate and still yours to handle.
|
||||
|
||||
**Is navigator.webdriver enough to catch me?** It is the cheapest check and stock
|
||||
automation fails it. Setting it to `false` in a script is its own tell; a real browser
|
||||
reports `undefined`.
|
||||
|
||||
**Why do I pass fingerprint tests and still get blocked?** Because those tests do not see
|
||||
your address, your request rate or your timing, and a consistent browser on a datacenter
|
||||
IP is still on a datacenter IP.
|
||||
|
||||
**Do stealth plugins help?** They fix the first signal and often create the second: a
|
||||
rewritten built-in that a tampering check flags. Running one on top of a patched engine is
|
||||
two disguises contradicting each other.
|
||||
|
||||
**How do I check what a site actually reads?** Open a detection suite in your automated
|
||||
browser and a stock browser on the same machine, and diff the reports field by field
|
||||
rather than reading the score.
|
||||
|
||||
## Sources
|
||||
|
||||
- The [W3C WebDriver specification](https://www.w3.org/TR/webdriver2/), which defines the
|
||||
`navigator.webdriver` property and the automation flag behind it.
|
||||
- This project's real API surface, `InvisiblePlaywright(seed=...)` and the returned
|
||||
Playwright `Browser`, as documented in the quickstart and configuration pages.
|
||||
- The public detection suites CreepJS, BotD, FingerprintJS, sannysoft and BrowserLeaks,
|
||||
each of which reads one or more of the three signal families described above.
|
||||
- This project's release gates, which assert the presence of a real-browser signal rather
|
||||
than the absence of a wrong one, and separate browser tells from IP and behaviour.
|
||||
|
||||
**See also:** [the webdriver flag in detail](navigator-webdriver-explained.md),
|
||||
[the checklist for a single blocking site](playwright-detected-as-bot.md), and
|
||||
[how to test whether your browser is detected](how-to-test-bot-detection.md).
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The honest boundary in the
|
||||
last section is the one I most wish more of these pages drew.*
|
||||
@@ -0,0 +1,208 @@
|
||||
---
|
||||
title: "Can you be fingerprinted in incognito mode?"
|
||||
description: "Yes: incognito mode clears cookies and site storage but leaves canvas, WebGL, fonts, user agent, timezone and the TLS handshake fully readable and re-linkable."
|
||||
parent: "Browser Identity"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 23
|
||||
---
|
||||
|
||||
|
||||
# Can you be fingerprinted in incognito mode?
|
||||
|
||||
Yes. This is the single most common misunderstanding about private browsing, and it is
|
||||
worth stating plainly before the details: incognito mode clears **state**, not
|
||||
**identity**. It empties cookies and site storage at the end of a session. It does not
|
||||
change what your browser looks like while the session is running, and that is exactly
|
||||
the part fingerprinting reads.
|
||||
|
||||
This page is what private mode actually does, why stateless fingerprinting is untouched
|
||||
by it, how a service re-links you across incognito windows anyway, and what changing the
|
||||
fingerprint values themselves looks like in practice.
|
||||
|
||||
## What private mode actually clears
|
||||
|
||||
Open a private window and the browser makes one promise: when you close it, the cookies,
|
||||
`localStorage`, `sessionStorage`, IndexedDB and cache from that session go away. History
|
||||
is not written to disk. That is the whole feature, and for its intended purpose (a shared
|
||||
family computer, not leaving a booking half-finished in your history) it does that job.
|
||||
|
||||
Notice what is on that list: all of it is **state the site wrote to your machine**. A
|
||||
cookie is a value the server set and asked you to hand back. Private mode's guarantee is
|
||||
that you stop handing those back once the window closes.
|
||||
|
||||
Nothing on that list is a property of the browser itself. And identification does not
|
||||
need you to hand anything back.
|
||||
|
||||
## Why stateless fingerprinting does not care
|
||||
|
||||
A cookie is something you were **given**. A fingerprint is something you **are**. Private
|
||||
mode only deletes the first kind.
|
||||
|
||||
When a page measures your browser, it reads values the browser exposes on request, no
|
||||
storage involved:
|
||||
|
||||
- **Canvas.** The page draws text and shapes to an offscreen canvas and
|
||||
[reads the pixels back](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL)
|
||||
as an encoded image. The exact bytes depend on your GPU, drivers and font rasterizer, and
|
||||
they are identical in a private window because it is the same GPU. See
|
||||
[why canvas output can change every run](canvas-fingerprint-changes-every-run.md) for
|
||||
what a real defense against this looks like.
|
||||
- **WebGL.** The
|
||||
[renderer and vendor string](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_debug_renderer_info)
|
||||
and the numeric limits of your graphics stack. Same machine, same values, private or not.
|
||||
- **Fonts.** The list of installed fonts, measured by rendering and comparing widths. A
|
||||
private window renders with the same fonts.
|
||||
- **User agent, platform, language, timezone.** All reported the same way in incognito.
|
||||
- **The [TLS handshake](https://datatracker.ietf.org/doc/html/rfc8446).** Decided by the
|
||||
network stack before a single line of page JavaScript runs, so no browsing mode touches
|
||||
it. [No in-page test can even see it](ja3-ja4-tls-fingerprint.md), and neither can
|
||||
incognito.
|
||||
|
||||
Read that list again against the previous section. There is no overlap. Private mode
|
||||
clears cookies and storage; fingerprinting reads GPU, fonts, TLS and the rest. The two
|
||||
sets do not intersect, which is why a fingerprint survives the mode that was supposed to
|
||||
protect it.
|
||||
|
||||
## How you get re-linked across incognito windows
|
||||
|
||||
Here is the part that surprises people. Because the fingerprint is stable and does not
|
||||
depend on stored state, a service can compute the same identifier in a normal window, in
|
||||
a private window, and in a second private window you opened an hour later to "start
|
||||
fresh". [FingerprintJS builds exactly this kind of visitor ID](fingerprintjs-visitor-id.md)
|
||||
by hashing many of those stateless components together.
|
||||
|
||||
So the common workflow of "open an incognito window to look like a new visitor" does not
|
||||
produce a new visitor. It produces the same visitor with an empty cookie jar. The site
|
||||
sets a fresh cookie, ties it to the fingerprint it just computed, and the link is
|
||||
restored on the first request. Clearing the cookie deleted the label on the folder, not
|
||||
the folder.
|
||||
|
||||
This is not a bug in private mode. Private mode never promised a new identity. It
|
||||
promised no leftover state, and it delivers that.
|
||||
|
||||
## Changing the values themselves, not clearing storage
|
||||
|
||||
If the problem is that the fingerprint values are stable and readable, the fix is to
|
||||
change the values, which is the specific thing private mode does not do. That is what
|
||||
invisible_playwright does: a Firefox patched at the C++ level so that canvas, WebGL,
|
||||
fonts, screen and the rest report seed-derived values, driven by stock Playwright.
|
||||
|
||||
Two lines to launch, and the browser you get back is a real Playwright
|
||||
[`Browser`](https://playwright.dev/python/docs/api/class-browser) with every standard
|
||||
method:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
# canvas, WebGL, fonts, screen all report seed-42 values,
|
||||
# not this machine's values
|
||||
```
|
||||
|
||||
The seed is the whole point. The same seed produces the same coherent identity every
|
||||
run, and a different seed produces a different one. So where private mode gives you the
|
||||
same machine with its storage wiped, a new seed gives you a genuinely different machine
|
||||
that happens to be internally consistent:
|
||||
|
||||
```python
|
||||
# a different, self-consistent identity - a different GPU, fonts, canvas hash
|
||||
with InvisiblePlaywright(seed=7) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
```
|
||||
|
||||
You can prove the difference to yourself. Open a public fingerprinting suite with
|
||||
`seed=42`, note the visitor ID or the canvas hash, close it, reopen with `seed=42`, and
|
||||
it matches. Change to `seed=7` and it moves. That is the value changing, which is the
|
||||
axis incognito leaves fixed. For the Firefox `about:config` route to the neighbouring
|
||||
problem, [`privacy.resistFingerprinting` and what it trades away](resist-fingerprinting.md)
|
||||
is worth reading before you reach for it.
|
||||
|
||||
## The honest caveat: it does not change your IP
|
||||
|
||||
There is one thing this shares with private mode: neither touches your IP address.
|
||||
Incognito does nothing for your address, and neither does changing the fingerprint. Your
|
||||
exit IP, its reputation, and the ASN it sits in are all still exactly what they were.
|
||||
|
||||
This matters because a perfect, distinct, self-consistent browser on a datacenter IP that
|
||||
a thousand other automated sessions are using this minute is still on that IP. The
|
||||
fingerprint and the driver layer reading as a genuine Firefox is why most detection
|
||||
checks pass; it is not why a session passes. The reader supplies the rest:
|
||||
|
||||
- **A clean exit.** The fingerprint work is wasted behind an address already on a
|
||||
blocklist. See [Configuration](configuration.md) for proxy setup.
|
||||
- **Human pacing and behaviour.** Timing, pointer motion and typing rhythm are a separate
|
||||
surface that no fingerprint change addresses.
|
||||
- **Per-account quotas and rate limits.** A new fingerprint is not a new account, and it
|
||||
does not reset a counter the service keeps on its own side.
|
||||
|
||||
Changing the fingerprint fixes the fingerprint. It does not fix the network or the
|
||||
behaviour, and claiming otherwise would be false.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Can you be fingerprinted in incognito mode? Yes, identically to a normal window, because
|
||||
private mode clears the cookies and storage a site wrote to your machine and leaves every
|
||||
readable property of the browser (canvas, WebGL, fonts, user agent, timezone, TLS)
|
||||
exactly where it was. Stateless fingerprinting reads those properties, so it works the
|
||||
same in either mode, and a service can re-link you across incognito windows on the
|
||||
fingerprint alone.
|
||||
|
||||
Changing the values themselves is a different operation from clearing state, and it is
|
||||
the one incognito does not perform. invisible_playwright performs it per seed, so the
|
||||
same input gives the same consistent identity and a new input gives a new one. Pair that
|
||||
with a clean exit and human pacing, because the fingerprint is only one of the surfaces a
|
||||
session is judged on.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Does incognito mode stop fingerprinting?** No. It clears cookies and site storage at
|
||||
the end of the session and changes nothing about canvas, WebGL, fonts, user agent,
|
||||
timezone or TLS, which are what fingerprinting reads.
|
||||
|
||||
**Can a site tell it is the same person across two incognito windows?** Yes. The
|
||||
fingerprint is stable and does not depend on stored state, so the same identifier is
|
||||
computed in each window and the empty cookie jar is refilled and re-linked on the first
|
||||
request.
|
||||
|
||||
**What does private mode actually protect me from?** Leaving state behind on the machine:
|
||||
history, cookies and cache from that session. That is a real feature, just not an
|
||||
anti-fingerprinting one.
|
||||
|
||||
**Does incognito change my IP address?** No, and neither does changing the fingerprint.
|
||||
The exit IP and its reputation are a separate surface you have to handle yourself.
|
||||
|
||||
**How do I actually get a different fingerprint?** Change the values the browser reports
|
||||
rather than clearing what a site stored. invisible_playwright does this per seed, so a
|
||||
new seed is a new coherent identity.
|
||||
|
||||
**Is a new seed the same as a new incognito window?** No. An incognito window is the same
|
||||
machine with its storage wiped. A new seed is a different machine, self-consistent across
|
||||
its fields.
|
||||
|
||||
## Sources
|
||||
|
||||
- Firefox's own documentation of what private browsing clears (cookies, storage, history)
|
||||
and, by omission, what it does not.
|
||||
- The specs behind each stateless signal above:
|
||||
[`HTMLCanvasElement.toDataURL()`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL)
|
||||
for the canvas read-back, [`WEBGL_debug_renderer_info`](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_debug_renderer_info)
|
||||
for the GPU renderer/vendor string, and [RFC 8446](https://datatracker.ietf.org/doc/html/rfc8446)
|
||||
for where the TLS handshake sits relative to page JavaScript.
|
||||
- The public detection suites named in this set, read for how each computes an identifier
|
||||
from stateless components, each with its own page here.
|
||||
- This project's seed-to-fingerprint pipeline and release gates, which measure the same
|
||||
seed producing the same identity across runs.
|
||||
|
||||
**See also:** [how a stable visitor ID is built](fingerprintjs-visitor-id.md),
|
||||
[what canvas fingerprinting reads and how to change it](canvas-fingerprint-changes-every-run.md),
|
||||
and [the TLS handshake no browsing mode can hide](ja3-ja4-tls-fingerprint.md).
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. Private mode clears what a
|
||||
site stored on you; this project changes what the browser is, which is the axis private
|
||||
mode leaves alone.*
|
||||
@@ -0,0 +1,212 @@
|
||||
---
|
||||
title: "Can you run invisible_playwright serverless?"
|
||||
description: "Why invisible_playwright mostly does not fit serverless: size of patched-Firefox is the blocker. Containers and long-lived workers are the actual home."
|
||||
parent: "Scraping with Playwright"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 84
|
||||
---
|
||||
|
||||
|
||||
# Can you run invisible_playwright serverless?
|
||||
|
||||
Mostly no, and for a structural reason rather than a setting you have not found yet.
|
||||
The blocker is not a config flag. It is that this tool launches a full, real browser,
|
||||
and a serverless function is sized for code that does not.
|
||||
|
||||
This page is the mechanism behind that answer, the one place it does fit, and the
|
||||
container or long-lived worker that is the honest recommendation instead.
|
||||
|
||||
## The short answer, and why it is structural
|
||||
|
||||
invisible_playwright is not a JavaScript shim that patches an existing browser. It ships
|
||||
a patched Firefox, built at the C++ level, and drives it with stock Playwright. On first
|
||||
use it downloads that binary (about 238 MB compressed, roughly 544 MB once unpacked, as
|
||||
listed on the [installation](installation.md) page), verifies a sha256, and caches it.
|
||||
A real launch then needs that unpacked tree on disk plus working memory for the browser
|
||||
process itself.
|
||||
|
||||
A typical function-as-a-service runtime caps three things at once: deployment package
|
||||
size, memory, and wall-clock execution time. All three fight a cold-start browser
|
||||
launch. The download alone can exceed a package limit; the unpacked tree plus a running
|
||||
Firefox can exceed the memory limit; and downloading and starting a browser per
|
||||
invocation can exceed the time limit before your first `goto` returns.
|
||||
|
||||
So the answer is not "add a bigger timeout". The weight of a real browser is the thing
|
||||
that does not fit, and no configuration removes it.
|
||||
|
||||
## What a function actually has to do to launch this
|
||||
|
||||
Walk through a cold invocation of a function that has never run before:
|
||||
|
||||
1. Fetch the engine. If it is not baked into the image, that is a ~238 MB download on
|
||||
the critical path, before any of your code runs.
|
||||
2. Unpack and place it. Roughly 544 MB has to land somewhere writable and readable.
|
||||
3. Verify it. A sha256 pass over the cached engine.
|
||||
4. Launch Firefox and connect Playwright over its protocol.
|
||||
5. Only now open a page and do the work you came for.
|
||||
|
||||
Steps 1 through 4 are pure overhead, and on a serverless platform they can repeat on
|
||||
every cold start because the local disk and memory a function sees do not persist between
|
||||
invocations by design. You are paying browser-startup cost per request instead of once.
|
||||
|
||||
## Where the weight goes: download, unpack, and resident memory
|
||||
|
||||
Three separate limits, three separate ways this fails:
|
||||
|
||||
- **Package or layer size.** Many function platforms cap the deployed artifact well
|
||||
under the unpacked engine size. Baking Firefox into the deployment can blow past the
|
||||
limit outright.
|
||||
- **Ephemeral disk.** The engine has to be unpacked somewhere. A read-only or tiny
|
||||
scratch filesystem cannot hold it.
|
||||
- **Memory.** A real Firefox rendering a real page has a real resident-set size. Add the
|
||||
unpacked binary in page cache and a modest function memory tier is gone.
|
||||
|
||||
The download can be moved off the critical path with a cache directory, and the wrapper
|
||||
supports exactly that: `INVISIBLE_PLAYWRIGHT_CACHE_DIR` points the engine at a path your
|
||||
platform already caches between runs, and `INVPW_BINARY_PATH` skips the download entirely
|
||||
when a compatible binary is already on disk (see [Configuration](configuration.md)). That
|
||||
helps a persistent worker a great deal. It helps a stateless function much less, because
|
||||
the thing a function does not keep is exactly the local disk those variables point at.
|
||||
|
||||
## The recommendation: a container image or a long-lived worker
|
||||
|
||||
The honest home for this tool is somewhere the browser is unpacked once and reused across
|
||||
many jobs:
|
||||
|
||||
- **A container image** with the engine already inside it, run on a service that keeps
|
||||
the container warm. The unpack happens at build time, not per request. This is common
|
||||
enough to have its own walkthrough in
|
||||
[how to use invisible_playwright in Docker](how-to-use-invisible-playwright-in-docker.md),
|
||||
and the fingerprint pitfalls specific to containers are in
|
||||
[running Playwright in Docker undetected](how-to-run-playwright-docker-undetected.md).
|
||||
- **A long-lived worker or VM** that launches the browser once at startup and pulls jobs
|
||||
from a queue, reusing the same process across many pages.
|
||||
|
||||
Both share one property that a stateless function cannot: the ~238 MB download and the
|
||||
~544 MB unpack are paid once, at startup or build, and every job after that reuses a warm
|
||||
browser. That is the difference between browser cost per deployment and browser cost per
|
||||
request.
|
||||
|
||||
Here is a minimal worker that launches once and reuses the browser across a list of jobs.
|
||||
The `browser` returned is a real Playwright
|
||||
[`Browser`](https://playwright.dev/python/docs/api/class-browser), so every method is the
|
||||
stock API:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
JOBS = [
|
||||
"https://example.com/a",
|
||||
"https://example.com/b",
|
||||
"https://example.com/c",
|
||||
]
|
||||
|
||||
# seed=42 makes the identity reproducible, so a failing job replays exactly.
|
||||
with InvisiblePlaywright(seed=42) as browser: # binary unpacked once, reused below
|
||||
for url in JOBS:
|
||||
page = browser.new_page()
|
||||
page.goto(url)
|
||||
print(url, page.title())
|
||||
page.close()
|
||||
```
|
||||
|
||||
In a real worker the `for` loop is a queue consumer, and the `with` block stays open for
|
||||
the life of the process. The launch cost is amortized across every job the worker ever
|
||||
handles, which is the whole point of not being serverless.
|
||||
|
||||
If you must fetch the engine ahead of time in an image build, do it as an explicit build
|
||||
step so the download never lands on a request path:
|
||||
|
||||
```dockerfile
|
||||
FROM python:3.12-slim
|
||||
RUN pip install invisible-playwright
|
||||
# Unpack the engine at BUILD time, not per request.
|
||||
RUN python -m invisible_playwright fetch
|
||||
# ... your worker entrypoint ...
|
||||
```
|
||||
|
||||
## What the stealth actually does for you here, and what it does not
|
||||
|
||||
invisible_playwright is designed to look like a real browser driven by a real person, and
|
||||
that is why it passes most detection checks: the fingerprint, the TLS handshake and the
|
||||
driver layer read as a genuine Firefox rather than as automation. That property is the
|
||||
same whether the browser runs in a function, a container, or a VM - where it runs does not
|
||||
change what it looks like, which matters here because "serverless" and "undetected" get
|
||||
searched together and are different problems.
|
||||
|
||||
What it does not do, on its own and in any environment:
|
||||
|
||||
- **IP reputation.** A genuine-looking browser on a known datacenter address is still on a
|
||||
known datacenter address. You supply a clean exit.
|
||||
- **Per-account quotas and rate limits.** These are counted server-side against your
|
||||
account or key, not read off the browser.
|
||||
- **Behaviour and timing.** Pacing, pointer motion and the rhythm of a session are yours
|
||||
to shape. An automated cadence is visible no matter how real the fingerprint is.
|
||||
|
||||
Serverless makes the last one worse in a specific way: fan-out. A hundred functions firing
|
||||
at once, from a small pool of platform egress addresses, in a burst no human pace explains,
|
||||
is a velocity signal you created by the deployment shape rather than by the browser. A warm
|
||||
worker pulling jobs at a human interval is easier to keep honest. None of that is a claim of
|
||||
evasion; it is the list of things you still have to get right yourself.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Can you run invisible_playwright serverless? Technically sometimes, on a generous
|
||||
container-backed function tier with the engine baked into the image and kept warm.
|
||||
Practically, a plain stateless function that downloads and launches a full Firefox per
|
||||
invocation will be slow and fragile even where it fits, because the browser weight is
|
||||
structural and no setting removes it.
|
||||
|
||||
The tool's job is to make the browser look real, and it does that anywhere it runs. The
|
||||
deployment's job is to give that browser a warm home, a clean exit and a human pace. Put
|
||||
the browser in a container image or a long-lived worker, pay the unpack once, and reuse it.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Can I deploy invisible_playwright to a serverless function?** Usually not on a plain
|
||||
stateless function. The patched Firefox is about 238 MB to download and roughly 544 MB
|
||||
unpacked, which fights typical size, memory and time limits. A container image or a warm
|
||||
worker is the real home.
|
||||
|
||||
**Why is the browser so heavy?** Because it is a real, full Firefox patched at the C++
|
||||
level, not a JavaScript patch over an existing browser. That weight is why the fingerprint
|
||||
and TLS read as genuine, and it is also why it does not fit a tiny function.
|
||||
|
||||
**Can I just make the function timeout longer?** No. Size and memory limits fail
|
||||
independently of time, and a per-request download and launch is overhead you pay on every
|
||||
cold start regardless of the timeout.
|
||||
|
||||
**Does running it in a container make it undetectable?** No tool is undetectable. A
|
||||
container is the right place to unpack the browser once and keep it warm, but it does not
|
||||
fix your IP reputation, your account quotas, or your timing. You supply those.
|
||||
|
||||
**How do I avoid downloading Firefox on every invocation?** Bake it into the image at
|
||||
build time, or point `INVPW_BINARY_PATH` at a binary already on disk. On a stateless
|
||||
function neither fully helps, because the local disk does not persist between calls.
|
||||
|
||||
**What is the smallest thing that works?** A single long-lived worker: launch once inside
|
||||
a `with InvisiblePlaywright(...) as browser:` block, then consume a job queue inside that
|
||||
block so the browser is reused for the life of the process.
|
||||
|
||||
## Sources
|
||||
|
||||
- This project's [installation](installation.md) and [configuration](configuration.md)
|
||||
pages, for the measured engine download and unpacked sizes and the cache and binary-path
|
||||
environment variables.
|
||||
- The container walkthroughs in this set, linked above, for the build-time unpack pattern.
|
||||
- Playwright's own [`Browser` class reference](https://playwright.dev/python/docs/api/class-browser),
|
||||
for the stock API this wrapper hands back unchanged.
|
||||
- General serverless platform limits on package size, memory and execution time, which are
|
||||
documented per platform and are what the browser weight runs into.
|
||||
|
||||
**See also:** [how to use invisible_playwright in Docker](how-to-use-invisible-playwright-in-docker.md)
|
||||
for the container build, [running Playwright in Docker undetected](how-to-run-playwright-docker-undetected.md)
|
||||
for the fingerprint tells a headless container adds, and
|
||||
[what a datacenter container gives away](playwright-docker-detection.md) for the machine
|
||||
signals no stealth layer touches.
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The weight that keeps it out
|
||||
of a small function is the same weight that makes it look real.*
|
||||
@@ -0,0 +1,211 @@
|
||||
---
|
||||
title: "Can You Run Playwright Without Being Detected?"
|
||||
description: "An honest answer for Playwright automation: what removing browser-level tells clears, why it looks like a real browser, and the three signals it does not fix."
|
||||
parent: "Testing and Troubleshooting"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 11
|
||||
---
|
||||
|
||||
|
||||
# Can You Run Playwright Without Being Detected?
|
||||
|
||||
Not in an absolute sense, and any tool that promises otherwise is lying to you.
|
||||
|
||||
What is achievable is narrower and more useful: you can remove the browser-level
|
||||
tells so the fingerprint and the automation flags read like a real person's browser,
|
||||
and that alone clears most JavaScript-based detection. The rest of what gets a session
|
||||
flagged is not a browser problem at all, and no amount of browser work touches it.
|
||||
|
||||
This page draws that line precisely. It shows what "undetected" can honestly mean,
|
||||
what a real-browser fingerprint clears, and the three signal classes that are detected
|
||||
independently of the browser and that you, not the tool, have to supply an answer for.
|
||||
|
||||
## The honest answer: "looks like a real browser", not "invisible"
|
||||
|
||||
The useful reframing is to stop asking "can I be undetected" and start asking "does
|
||||
this look like a real browser driven by a real person". That is a question you can
|
||||
actually answer yes to, and it is the one that most detection is really asking.
|
||||
|
||||
A detector almost never has a single "is this a bot" bit. It has a pile of signals and
|
||||
a score. Some of those signals live in the page, in JavaScript: the fingerprint, the
|
||||
automation flags, whether any built-in has been tampered with. Some live below the
|
||||
page: the network handshake, the exit address. Some live in what the session does over
|
||||
time: pacing, motion, request velocity.
|
||||
|
||||
A tool that drives a genuine, unmodified-looking browser can make the first pile read
|
||||
clean. It cannot make the other two piles read clean, because they are not properties
|
||||
of the browser. Being honest about that split is the whole point of this page, and it
|
||||
is why [passing every public suite still does not mean the session passes](how-to-test-bot-detection.md).
|
||||
|
||||
## What "detected" actually means: three layers of signal
|
||||
|
||||
Before touching code, it helps to name the three layers, because a fix for one does
|
||||
nothing for the others.
|
||||
|
||||
1. **The browser layer.** The fingerprint (GPU, canvas, audio, fonts, screen), the
|
||||
automation flags ([`navigator.webdriver`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/webdriver)
|
||||
and friends), and internal consistency
|
||||
(does the platform you claim agree with the fonts you have). This is in JavaScript's
|
||||
reach, and it is the layer a stealth engine addresses.
|
||||
2. **The network layer.** The TLS handshake, the HTTP/2 settings frame, header order,
|
||||
and the reputation of the exit address. Decided before a line of page script runs,
|
||||
and [invisible to every in-page test](ja3-ja4-tls-fingerprint.md).
|
||||
3. **The behaviour layer.** Pointer motion, typing rhythm, how fast a form is filled,
|
||||
how many requests per minute from one account, and the timing shape of an
|
||||
automated agent.
|
||||
|
||||
invisible_playwright is built to solve layer 1 well, and it drives a real Firefox
|
||||
binary, which means layer 1's network handshake is a genuine Firefox handshake rather
|
||||
than an impersonation. What it deliberately does not do is manufacture a clean IP, a
|
||||
per-account quota, or human pacing. Those are yours to bring.
|
||||
|
||||
## What invisible_playwright removes: the browser layer
|
||||
|
||||
The product is a Firefox patched at the C++ level, driven by stock Playwright, with a
|
||||
fingerprint derived from a seed so it is real-browser-shaped and reproducible. Every
|
||||
session gets a coherent identity (roughly 400 fields that agree with each other)
|
||||
instead of the default automation profile that detectors are trained on.
|
||||
|
||||
Switching from plain Playwright is a two-line change, and the object you get back is a
|
||||
real Playwright `Browser`, so every method works exactly as documented upstream:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
# seed=42 makes the identity reproducible; drop it for a fresh one each run
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
# navigator.webdriver reads undefined, the fingerprint is internally
|
||||
# consistent, and the TLS handshake is a real Firefox handshake
|
||||
print(page.evaluate("navigator.webdriver")) # -> None
|
||||
```
|
||||
|
||||
Add a proxy and let the browser timezone follow the exit automatically, which is how
|
||||
you keep the browser and the network from telling two different stories:
|
||||
|
||||
```python
|
||||
proxy = {"server": "socks5://gate.example.com:1080", "username": "u", "password": "p"}
|
||||
|
||||
with InvisiblePlaywright(seed=42, proxy=proxy) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com/login")
|
||||
page.fill("#user", "someone")
|
||||
page.click("#submit") # the pointer arcs to the button on a curve
|
||||
```
|
||||
|
||||
The measurable result of layer 1 being clean: open the same fingerprinting page in
|
||||
this browser and in a stock Firefox on the same machine, diff the reports field by
|
||||
field, and the difference collapses to per-session noise (the IP and the random canvas
|
||||
jitter a real browser also has). The JavaScript detectors read it as a genuine Firefox
|
||||
because, at the layer they can see, it is one. That is why it passes most of them. It
|
||||
is also the ceiling of what the browser layer can do.
|
||||
|
||||
## The three signal classes it deliberately does not touch
|
||||
|
||||
This is the part most "undetectable" claims skip. These three are detected
|
||||
independently of the browser, the tool does not address them by design, and a clean
|
||||
fingerprint on top of any one of them still loses.
|
||||
|
||||
- **IP reputation.** A perfect browser on a datacenter range, or on a residential exit
|
||||
a thousand other people are sharing this minute, is still on a flagged address, and
|
||||
that is decided before your script runs. Around 90 percent of cheap proxies are
|
||||
public and already known. The fix is a clean exit, which is your input, not the
|
||||
browser's output. [WebRTC through a proxy](webrtc-leak-proxy.md) is the related
|
||||
browser-visible surface, but the reputation itself is not a browser property.
|
||||
- **Per-account rate limits and quotas.** If one account does in an hour what a person
|
||||
does in a week, no fingerprint hides it, because the signal is the account's own
|
||||
history, not the browser's identity. Spreading work across accounts and staying under
|
||||
human volume is an application-design decision the tool cannot make for you.
|
||||
- **Behaviour and timing.** Uniform keystroke intervals, a form filled in eighty
|
||||
milliseconds, a pointer that teleports, a request cadence with no human jitter, or
|
||||
[the pause shaped exactly like model latency in an agent loop](ai-browser-agents-stealth.md).
|
||||
The engine gives you curved mouse motion for clicks, but the overall rhythm of the
|
||||
session is driven by your code.
|
||||
|
||||
None of these is a gap or a bug. They are outside the browser, so they are outside what
|
||||
a browser-fingerprint tool can honestly claim. Pairing a real-browser fingerprint with
|
||||
a clean exit and human pacing is the actual recipe; the tool is one of those three
|
||||
parts.
|
||||
|
||||
## How to check what is left over
|
||||
|
||||
Because the browser layer is handled, your testing effort should go to the two layers
|
||||
that are not. The method that catches the most:
|
||||
|
||||
- **Prove it is the browser before blaming it.** Open the target by hand from the same
|
||||
machine and network. If the manual visit also gets the wrong page, this is the IP or
|
||||
the account, and no browser change helps. This ordering is the whole point of the
|
||||
[detected-on-one-site checklist](playwright-detected-as-bot.md).
|
||||
- **Compare against a stock browser, do not read a score.** Diff the fingerprint fields
|
||||
against a real Firefox on the same machine. Anything that matches is not your problem
|
||||
whatever the verdict says; anything that differs, other than the address, is a
|
||||
candidate.
|
||||
- **Assert presence, not absence.** A blocked or empty signal is itself a tell and a
|
||||
failure, not a pass. [Why a green verdict can mean the feature is broken](how-to-test-bot-detection.md)
|
||||
is the trap here.
|
||||
- **Watch the score, not just the pass line.** A [trust or confidence score](browser-trust-score-explained.md)
|
||||
tells you more than a binary verdict, and it is where residual behaviour and IP
|
||||
signals show up even when the fingerprint is clean.
|
||||
|
||||
Run any of this at least ten times, through the proxy you actually deploy with, on the
|
||||
machine you actually deploy on.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Can you run Playwright without being detected? You can make it look like a real browser
|
||||
driven by a real person, and that clears most JavaScript-based detection, which is what
|
||||
invisible_playwright is built to do: a patched Firefox, a seed-consistent real-browser
|
||||
fingerprint, and a genuine handshake because the browser is genuine. What it does not
|
||||
do, on purpose, is fix your IP reputation, your per-account quotas, or your behaviour
|
||||
and timing. Those are detected independently, and you supply the answers: a clean exit
|
||||
and human pacing. Treat "undetectable" as a slogan and you will overclaim; treat it as
|
||||
"looks like a real browser, plus the two layers I own", and you will actually pass.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Can Playwright be truly undetectable?** No, and any tool that says so is lying. You
|
||||
can remove the browser-level tells so the fingerprint and flags look like a real
|
||||
person's browser, which clears most JavaScript detection. IP, account limits and
|
||||
behaviour are detected separately.
|
||||
|
||||
**Why does invisible_playwright pass most checks then?** Because at the layer those
|
||||
checks can see, it is a real Firefox: real fingerprint, no automation flags, a genuine
|
||||
handshake. Most public detection is a JavaScript check, and that is exactly the layer
|
||||
it addresses.
|
||||
|
||||
**If my fingerprint is clean, why am I still blocked?** Almost always the IP, the
|
||||
account's own request history, or the behaviour. Those are not browser properties, so a
|
||||
clean browser does not touch them.
|
||||
|
||||
**Does it fix my proxy or my IP reputation?** No. It deliberately does not touch the
|
||||
exit address. A perfect browser on a known-bad IP still loses, and you supply the clean
|
||||
exit.
|
||||
|
||||
**Does it make my automation behave like a human?** It gives you curved mouse motion
|
||||
for clicks, but the pacing, typing rhythm and request volume come from your code. That
|
||||
is the behaviour layer, and it is yours.
|
||||
|
||||
**Is a passing sannysoft or CreepJS result enough to be safe?** No. It means the
|
||||
browser layer is internally consistent and does not announce automation. The network
|
||||
and behaviour layers are not in those tests at all.
|
||||
|
||||
## Sources
|
||||
|
||||
- This project's release gates, which compare the browser's fingerprint field by field
|
||||
against a stock Firefox on the same machine and treat a suppressed signal as a
|
||||
failure rather than a pass.
|
||||
- The public detection suites named across this documentation set (sannysoft, CreepJS,
|
||||
BotD, FingerprintJS, BrowserLeaks), each read from its own source rather than its
|
||||
rendered verdict.
|
||||
|
||||
**See also:** [how to test whether your browser is detected](how-to-test-bot-detection.md),
|
||||
[the checklist for being detected on one site](playwright-detected-as-bot.md), and
|
||||
[what a browser trust score actually measures](browser-trust-score-explained.md).
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. It is built to look like
|
||||
a real browser, which is why it passes most checks and why it will never claim to make
|
||||
you invisible.*
|
||||
@@ -0,0 +1,245 @@
|
||||
---
|
||||
title: "Canvas fingerprint changes every run: use a seed"
|
||||
description: "Canvas, WebGL and audio hashes change every Playwright run because each session draws a fresh identity. Pass a fixed seed to make readbacks byte-identical."
|
||||
parent: "Testing and Troubleshooting"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 6
|
||||
---
|
||||
|
||||
|
||||
# Canvas fingerprint changes every run: use a seed
|
||||
|
||||
A canvas fingerprint that changes on every Playwright run is not a leak or a bug. Without
|
||||
a seed, each session is handed a fresh, self-consistent device, so the canvas, WebGL and
|
||||
audio readbacks are recomputed at every launch. Pass a fixed seed and all three come back
|
||||
byte-identical, run to run. That single argument is the whole fix.
|
||||
|
||||
You open a fingerprinting page twice from the same automation, and the canvas hash
|
||||
is different each time. The WebGL hash moves too, and so does the audio one. Nothing
|
||||
in your code changed between the two runs, and yet the machine looks like a different
|
||||
machine.
|
||||
|
||||
This is one of the most common confusions people hit with a fingerprint-spoofing
|
||||
browser, and it is almost always a misread rather than a bug. A hash that changes on
|
||||
every run is not noise leaking into your readback. It is a fresh identity being drawn
|
||||
for each session, exactly as designed, and the fix is one argument.
|
||||
|
||||
## What "changes every run" actually means
|
||||
|
||||
Canvas, WebGL and audio are the three surfaces that read back a rendered value: you
|
||||
draw something, then read the pixels or the samples out and hash them. On a real
|
||||
machine that hash is stable, because the same GPU, the same font stack and the same
|
||||
audio pipeline draw the same thing every time.
|
||||
|
||||
In this browser, those three readbacks are overwritten before they reach your code.
|
||||
The value you read is a pure function of one number: an internal hardware seed the
|
||||
wrapper derives from the identity seed of the session. Same seed in, same bytes out.
|
||||
Different seed, different bytes.
|
||||
|
||||
So when you launch without passing a seed, each session gets a new one, and the three
|
||||
hashes move together in a self-consistent way. That is not the spoof failing. That is
|
||||
the spoof drawing a new device for you. The trouble is that a device which looks
|
||||
brand new on every visit is its own signal, and it is usually not the signal you want.
|
||||
|
||||
## Why a per-run identity reads as a rotating device
|
||||
|
||||
A stable fingerprint is not automatically a suspicious one. What draws attention is a
|
||||
fingerprint that behaves in a way real hardware cannot.
|
||||
|
||||
Real hardware does not change its canvas hash between two visits. If a site, or a
|
||||
linkability service like [FingerprintJS, which hands you a visitor ID](fingerprintjs-visitor-id.md),
|
||||
sees the same cookie or the same login return with a different canvas hash, a
|
||||
different WebGL renderer and a different audio signature every time, that is a machine
|
||||
that is repainting itself. Very few legitimate users look like that, and a scorer that
|
||||
watches for churn will notice.
|
||||
|
||||
So the per-session default is the right behaviour for one job and the wrong one for
|
||||
another:
|
||||
|
||||
- **You want a fresh identity per session.** Many short, unrelated visits, nothing
|
||||
that should be linked, no returning account. Launch with no seed and take a new
|
||||
device each time. This is the default for a reason.
|
||||
- **You want the same identity every session.** A returning account, a persisted
|
||||
profile, or simply a bug you are trying to reproduce. Here a rotating device is a
|
||||
liability, and you pin it with a seed.
|
||||
|
||||
The mistake is not the rotation. The mistake is leaving it on when the situation calls
|
||||
for a stable machine.
|
||||
|
||||
## Pin the seed and the readbacks stop moving
|
||||
|
||||
Pass a seed explicitly and every field it implies comes back identical: the GPU
|
||||
string, the canvas hash, the WebGL hash, the audio context, the fonts, the screen.
|
||||
The browser object you get back is a real Playwright
|
||||
[`Browser`](https://playwright.dev/python/docs/api/class-browser), so the rest of your
|
||||
code does not change.
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
# Same seed -> same canvas / WebGL / audio hash, every run.
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
# read your fingerprint page here; the readbacks are now stable
|
||||
```
|
||||
|
||||
Run that twice and the three readbacks are byte-identical between the two runs,
|
||||
because they are computed from the same seed both times. Change the number and you get
|
||||
a different, equally self-consistent machine:
|
||||
|
||||
```python
|
||||
# A different but still internally coherent device.
|
||||
with InvisiblePlaywright(seed=1001) as browser:
|
||||
...
|
||||
```
|
||||
|
||||
The async surface is the same, one keyword apart:
|
||||
|
||||
```python
|
||||
from invisible_playwright.async_api import InvisiblePlaywright
|
||||
|
||||
async with InvisiblePlaywright(seed=42) as browser:
|
||||
page = await browser.new_page()
|
||||
await page.goto("https://example.com")
|
||||
```
|
||||
|
||||
If you launched without a seed and now want to keep the identity you happened to get,
|
||||
you do not have to guess it. Every session records the seed it was generated from, so
|
||||
log it once and you can replay that exact machine later:
|
||||
|
||||
```python
|
||||
sf = InvisiblePlaywright() # no seed -> a fresh one is drawn
|
||||
with sf as browser:
|
||||
print("seed =", sf.seed) # write this down to reproduce this device
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
```
|
||||
|
||||
## Prove it: read the same hash twice
|
||||
|
||||
Do not take the determinism on faith. The whole point of the earlier troubleshooting
|
||||
pages is that you [assert the presence of the right value rather than the absence of a
|
||||
wrong one](how-to-test-bot-detection.md), and this is a case where you can measure the
|
||||
right value directly.
|
||||
|
||||
Draw to a canvas, read it back with
|
||||
[`toDataURL()`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL),
|
||||
and compare the hash across two launches with the same seed:
|
||||
|
||||
```python
|
||||
import hashlib
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
DRAW = """() => {
|
||||
const c = document.createElement('canvas');
|
||||
c.width = 300; c.height = 150;
|
||||
const ctx = c.getContext('2d');
|
||||
ctx.textBaseline = 'top';
|
||||
ctx.font = '16px sans-serif';
|
||||
ctx.fillStyle = '#069';
|
||||
ctx.fillText('fingerprint probe 12345', 10, 10);
|
||||
return c.toDataURL();
|
||||
}"""
|
||||
|
||||
def canvas_hash(seed):
|
||||
with InvisiblePlaywright(seed=seed) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
data_url = page.evaluate(DRAW)
|
||||
return hashlib.sha256(data_url.encode()).hexdigest()
|
||||
|
||||
a = canvas_hash(42)
|
||||
b = canvas_hash(42)
|
||||
c = canvas_hash(1001)
|
||||
|
||||
print("same seed match:", a == b) # True: byte-identical across runs
|
||||
print("different seed differs:", a != c) # True: a different device
|
||||
```
|
||||
|
||||
The first comparison is the one that matters. `a == b` being `True` is the readback
|
||||
proving it is a stable function of the seed, not per-call randomness. This is exactly
|
||||
what the project's own consistency gate checks on every release: it launches the same
|
||||
seed more than once and requires an identical visitor ID from a linkability library,
|
||||
and it fails the build if the two runs disagree. A green gate there means the same seed
|
||||
is the same machine, run to run.
|
||||
|
||||
Because the readback is a function of the seed and not of the host, the same seed also
|
||||
holds its hash across operating systems, which is
|
||||
[why a Linux container and a Windows laptop can return the same canvas](canvas-webgl-cross-platform-consistency.md).
|
||||
If instead the two hashes for one seed disagree within a single machine, that is the
|
||||
tampering signal to chase, and reading the same value twice in one session is
|
||||
[the cheapest such check there is](canvas-fingerprint-noise.md).
|
||||
|
||||
## Match the seed to the profile
|
||||
|
||||
Pinning the seed and pinning the profile are two halves of one decision. If you keep a
|
||||
[persistent profile so cookies and storage survive between runs](persistent-profiles.md),
|
||||
give it a stable seed as well. A profile that returns with the same cookies but a
|
||||
different canvas hash is telling two stories at once: the account remembers you, the
|
||||
hardware does not, and that contradiction is easier to spot than either half alone.
|
||||
|
||||
The clean pairings are the obvious ones. A fresh throwaway profile takes a fresh seed.
|
||||
A durable identity that comes back tomorrow takes the same profile and the same seed
|
||||
it had yesterday. Keep the two in step and the machine you present stays coherent over
|
||||
its whole life instead of only within a single launch.
|
||||
|
||||
## Conclusion
|
||||
|
||||
A canvas hash that changes on every run is not a leak, it is a new device being drawn
|
||||
per session, and it is the correct default for unrelated one-off visits. When you need
|
||||
a machine that stays the same, whether for a returning account, a persisted profile or
|
||||
a reproducible bug, pass a seed. The three readbacks then become a byte-identical
|
||||
function of that seed, run to run and across operating systems, and the account and the
|
||||
hardware finally tell the same story.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Why does my canvas fingerprint change every run?** Because each session without a
|
||||
seed gets a fresh, self-consistent identity by design. The readback is a function of
|
||||
the session's seed, and a new session means a new seed.
|
||||
|
||||
**How do I make the canvas hash stable?** Pass a fixed seed at launch, for example
|
||||
`InvisiblePlaywright(seed=42)`. The canvas, WebGL and audio readbacks then come back
|
||||
identical on every run.
|
||||
|
||||
**Is a changing fingerprint a bug?** No. It is deliberate rotation. It becomes a
|
||||
problem only when you needed a stable machine, for instance behind a returning account
|
||||
or a persisted profile, and left rotation on.
|
||||
|
||||
**Does the same seed give the same hash on a different machine?** Yes. The readback is
|
||||
computed from the seed, not from the host GPU or fonts, so the same seed holds its
|
||||
hashes across operating systems.
|
||||
|
||||
**How do I reproduce the exact identity from an earlier run?** Read the session's seed
|
||||
after launch and log it. Passing that number back reproduces the same device.
|
||||
|
||||
**Should the seed match my persistent profile?** Yes. A profile that returns with the
|
||||
same cookies but a different fingerprint is a contradiction. Keep one stable seed per
|
||||
durable identity.
|
||||
|
||||
## Sources
|
||||
|
||||
- The project's fingerprint generator, in which the canvas, WebGL and audio readbacks
|
||||
are computed as a pure function of a hardware seed derived from the session seed.
|
||||
- The release consistency gate, which relaunches a fixed seed and requires an
|
||||
identical visitor ID from run to run, and fails the build otherwise.
|
||||
- The [quickstart](quickstart.md) and [configuration](configuration.md) pages in this
|
||||
documentation set for the seed argument and the API it belongs to.
|
||||
- Playwright's own [`Browser` API reference](https://playwright.dev/python/docs/api/class-browser)
|
||||
for what `new_page` returns: the object every example above drives is the standard
|
||||
Playwright API, not a fork of it.
|
||||
- MDN's [`HTMLCanvasElement.toDataURL()`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL)
|
||||
reference for the readback method the proof above uses to pull bytes off the canvas.
|
||||
|
||||
**See also:** [how to test whether your browser is detected](how-to-test-bot-detection.md)
|
||||
for the assert-the-right-value method, and
|
||||
[the checklist for being detected on one site](playwright-detected-as-bot.md), whose
|
||||
last step is to pin the identity so a failure is reproducible.
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The seed is the same
|
||||
lever whether you are hiding rotation or reproducing a bug: pin it and the machine
|
||||
stops moving.*
|
||||
@@ -0,0 +1,187 @@
|
||||
---
|
||||
title: "Canvas fingerprint noise: why per-call randomising fails"
|
||||
description: "Per-call canvas fingerprint noise fails a detector that reads twice and flags as masking on a second check. What a consistent canvas actually looks like."
|
||||
parent: "Canvas, WebGL, Fonts and Audio"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 1
|
||||
---
|
||||
|
||||
|
||||
# Canvas fingerprint noise: why per-call randomising fails
|
||||
|
||||
Per-call canvas fingerprint noise fails because a detector can read the same canvas
|
||||
twice. Real hardware returns an identical result both times; per-call noise returns two
|
||||
different ones, which flags the browser as tampering rather than merely unusual. The fix
|
||||
is not more noise, it is noise that stays consistent within a session and across sessions
|
||||
of the same identity.
|
||||
|
||||
The standard advice for canvas fingerprinting is to add a little noise to the pixels so
|
||||
your hash is not stable. It is the most widely deployed anti-fingerprinting technique
|
||||
there is, and against a detector that asks once it works.
|
||||
|
||||
Against a detector that asks twice it is the thing that gets you caught. This page is
|
||||
the check that catches it, the second check almost nobody knows about, and what a
|
||||
consistent alternative has to look like.
|
||||
|
||||
## The check that catches per-call noise
|
||||
|
||||
Render the same canvas twice in the same page with
|
||||
[`toDataURL()`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL)
|
||||
and compare.
|
||||
|
||||
```js
|
||||
function hash() {
|
||||
const c = document.createElement('canvas');
|
||||
const ctx = c.getContext('2d');
|
||||
ctx.textBaseline = 'top';
|
||||
ctx.font = '14px Arial';
|
||||
ctx.fillText('abcdefghijklmnop', 2, 2);
|
||||
return c.toDataURL();
|
||||
}
|
||||
hash() === hash(); // real hardware: true. Per-call noise: false.
|
||||
```
|
||||
|
||||
On real hardware the answer is always identical, because drawing the same shapes with
|
||||
the same rasteriser produces the same pixels. There is no source of variation.
|
||||
|
||||
A tool that adds `Math.random()` to the pixel values on every read produces two
|
||||
different answers, and now the page knows something far more specific than your canvas
|
||||
hash: it knows your canvas is being tampered with. An unusual hash makes you rare. A
|
||||
hash that changes between two reads one millisecond apart makes you impossible.
|
||||
|
||||
This is four lines of JavaScript. Assume it is running.
|
||||
|
||||
## The second check, which is subtler
|
||||
|
||||
A detector draws a **small canvas filled with a handful of solid reference colours**,
|
||||
then reads it back with
|
||||
[`getImageData()`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/getImageData)
|
||||
and checks those exact colour values came back unchanged. Not a hash, not a comparison
|
||||
between two reads: an assertion that a flat red rectangle is still exactly that red.
|
||||
|
||||
The first check above is well known enough that better tools already seed their noise,
|
||||
so two reads agree. This second shape is subtler, and it is worth understanding because
|
||||
it caught us.
|
||||
|
||||
Real rendering does not change a solid fill. Any per-pixel noise does, even seeded
|
||||
noise, even tiny noise. And a tool that fails this is not scored as "unusual", it is
|
||||
scored as **masking detected**, which is a different and worse category.
|
||||
|
||||
The fix is a guard: before altering anything, count the distinct colours in the buffer.
|
||||
If there are only a few, the render is a reference probe rather than a fingerprint, and
|
||||
you leave it alone. Small buffers get the same treatment, for the same reason.
|
||||
|
||||
We shipped without that guard and learned it from a detector telling us so. The general
|
||||
form is the same one that appears in audio and everywhere else:
|
||||
|
||||
> A detector does not have to recognise your noise. It only has to ask a question whose
|
||||
> correct answer is already known, and check whether it still gets that answer.
|
||||
|
||||
## Additive noise versus substitution, and the cost nobody states
|
||||
|
||||
There are two ways to make a canvas read return something other than the truth.
|
||||
|
||||
| Approach | What it does | Same hash across machines? | Main cost |
|
||||
|---|---|---|---|
|
||||
| Additive noise | Perturbs each pixel slightly; the image still looks the same, the hash changes | No. The operating system's text stack still shows through the perturbation | The underlying platform signature leaks |
|
||||
| Substitution | Replaces pixel values wholesale with seed-derived values | Yes. The hash is a pure function of the seed | Real canvas work (cropping, QR decoding, a video frame) gets the substituted values too |
|
||||
|
||||
**Additive.** Perturb each pixel slightly. The image still looks like the image, the
|
||||
hash changes. This is what extensions do.
|
||||
|
||||
**Substitution.** Replace the pixel values wholesale with values derived from a seed.
|
||||
The hash is then a pure function of the seed and nothing else, which means it is
|
||||
identical on every machine running that identity, including a Linux server pretending
|
||||
to be Windows.
|
||||
|
||||
Substitution is stronger for consistency, because with additive noise the underlying
|
||||
rendering still carries the signature of
|
||||
[the operating system's text stack](bundled-fonts-cross-platform.md) under the
|
||||
perturbation. Two machines with different font backends produce different base images,
|
||||
and a small perturbation on top does not hide that -
|
||||
[this is the reasoning that gets the same seed to the same byte-identical hash on
|
||||
Windows and Linux](canvas-webgl-cross-platform-consistency.md), not just a similar one.
|
||||
|
||||
Now the cost, which is real and which most write-ups omit. A substitution applied at
|
||||
readback does not know why the page is reading the canvas. It cannot distinguish a
|
||||
fingerprinting probe from an application that is cropping a photo, decoding a QR code,
|
||||
capturing a video frame or applying a filter. Those all read pixels through the same
|
||||
API, and they all get the substituted values.
|
||||
|
||||
So if your automation does real canvas work, you have to know this is happening. It is
|
||||
a trade, not a free win, and anyone presenting per-pixel protection as costless has not
|
||||
built one.
|
||||
|
||||
## What a defensible canvas looks like
|
||||
|
||||
Working backwards from the checks above:
|
||||
|
||||
- **Stable within a session.** Two reads agree. Non-negotiable and trivially checked.
|
||||
- **Stable across sessions of the same identity.** A hash that changes every launch
|
||||
describes a machine that changed its GPU overnight.
|
||||
- **Different between identities.** Otherwise every user of the tool shares one hash,
|
||||
which is its own cohort.
|
||||
- **Solid fills come back solid.** Reference probes are untouched.
|
||||
- **Consistent with the rest of the claim.** A canvas that says one platform under a
|
||||
user agent that says another is caught by comparison, not by rarity.
|
||||
|
||||
That list is short and every item is a thing a page can verify in a few lines. That is
|
||||
the level the checks are actually at.
|
||||
|
||||
The same canvas element carries a second surface that doesn't involve reading a single
|
||||
pixel: [`measureText()` and its ten-plus numeric fields](measuretext-textmetrics-fingerprinting.md),
|
||||
which fail the same way for the same reason if the noise added to them accumulates
|
||||
instead of staying bounded.
|
||||
|
||||
## Checking your own
|
||||
|
||||
```js
|
||||
const a = hash(), b = hash();
|
||||
console.log('stable within session:', a === b);
|
||||
|
||||
// solid-fill probe
|
||||
const c = document.createElement('canvas'); c.width = 70; c.height = 5;
|
||||
const ctx = c.getContext('2d');
|
||||
ctx.fillStyle = '#ff0000'; ctx.fillRect(0, 0, 10, 5);
|
||||
const px = ctx.getImageData(0, 0, 1, 1).data;
|
||||
console.log('solid red survived:', px[0] === 255 && px[1] === 0 && px[2] === 0);
|
||||
```
|
||||
|
||||
Then relaunch with the same identity and confirm the first hash is the same value. Two
|
||||
launches, one identity, one hash.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Does adding noise to canvas prevent fingerprinting?** It prevents a stable identifier
|
||||
and it announces that something is modifying the canvas. Which of those matters depends
|
||||
on whether anything is checking.
|
||||
|
||||
**Is Canvas Blocker style protection detectable?** The per-call randomisation kind is,
|
||||
in four lines. That is a statement about the technique, not about any particular tool.
|
||||
|
||||
**Why does my canvas hash change on every page load?** Because something is randomising
|
||||
per call or per session. No real machine does that; there is
|
||||
[a dedicated page on why a canvas fingerprint changes every run](canvas-fingerprint-changes-every-run.md).
|
||||
|
||||
**Should the hash be unique to me?** It should be consistent for one identity and
|
||||
different between identities. Unique-per-request is not privacy, it is a signature.
|
||||
|
||||
**Does `privacy.resistFingerprinting` solve this?** It alters canvas readings, and it
|
||||
also makes you identifiable as someone running that mode. There is
|
||||
[a longer page on that trade](resist-fingerprinting.md).
|
||||
|
||||
**Will noise break my application?** If you read pixels for anything real, yes,
|
||||
potentially. Protection applied at readback cannot tell your QR decoder from a
|
||||
fingerprinting probe.
|
||||
|
||||
**See also:** [AudioContext fingerprinting](audiocontext-fingerprinting.md), where the
|
||||
same per-call mistake has the same consequence and where our own noise turned out to be
|
||||
the thing being detected, [what sannysoft checks](sannysoft-explained.md), whose
|
||||
canvas-in-iframe rows are a consistency test rather than a fingerprint test, and
|
||||
[how BrowserLeaks reports the canvas and WebGL hash](browserleaks-canvas-webgl-hash.md).
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level. The solid-fill guard exists because we shipped
|
||||
without it.*
|
||||
@@ -0,0 +1,149 @@
|
||||
---
|
||||
title: "Canvas and WebGL fingerprints, identical across OSes"
|
||||
description: "Canvas and WebGL fingerprints identical across Windows and Linux: intercept readback, not the render, so one seed produces a byte-identical hash on every OS."
|
||||
parent: "Canvas, WebGL, Fonts and Audio"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 9
|
||||
---
|
||||
|
||||
|
||||
# Canvas and WebGL fingerprints, identical across OSes
|
||||
|
||||
A GPU-backed render surface can't be read from or written to directly and safely, so
|
||||
the fix intercepts the one place JavaScript can actually see the result instead - the
|
||||
same seed then produces a byte-identical canvas and WebGL hash on Windows and Linux.
|
||||
[Why headless browsers render different fonts](headless-fonts-differ.md) and
|
||||
[how to make Linux and macOS report real Windows fonts](bundled-fonts-cross-platform.md)
|
||||
cover the same shape of problem and fix, for text instead of pixels.
|
||||
|
||||
## The surface you can't safely touch is not the surface JavaScript reads
|
||||
|
||||
A GPU-backed render target is not something you can map and rewrite freely - reading
|
||||
one directly with the ordinary in-process API can crash rather than return data,
|
||||
depending on the backend. That rules out the obvious approach of patching the render
|
||||
itself.
|
||||
|
||||
It turns out you don't need to. Content never touches the render surface directly. It
|
||||
only ever gets pixels back through a small, enumerable set of export calls:
|
||||
[`toDataURL`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL)
|
||||
and [`toBlob`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob),
|
||||
[`getImageData`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/getImageData),
|
||||
[`readPixels`](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/readPixels),
|
||||
a captured [`OffscreenCanvas`](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas),
|
||||
and the chain that runs through
|
||||
[`createImageBitmap`](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap).
|
||||
Every one of those is a **readback** call, and readback is a single choke point you
|
||||
can intercept safely, even when the surface behind it cannot be touched directly.
|
||||
|
||||
So the fix is the same shape as the font one: block the host's real value at the one
|
||||
place content can actually observe it, rather than trying to prevent the value from
|
||||
existing in the first place.
|
||||
|
||||
## What gets overwritten, and what doesn't
|
||||
|
||||
At each readback call, the real pixel buffer is rewritten with output derived from
|
||||
the session's seed and the pixel's own position, before JavaScript ever sees it - for
|
||||
both the canvas-2D path and the WebGL path, since they are separate APIs with
|
||||
separate export calls that both needed the same treatment.
|
||||
|
||||
The one thing this has to get right is not breaking the pages that read canvas
|
||||
content for a legitimate reason. A reference probe - a handful of flat colours used
|
||||
to check whether canvas output has been tampered with at all - looks nothing like a
|
||||
real rendered scene: very few distinct colours across the whole buffer. Below a
|
||||
small distinct-colour threshold, the output is left untouched; above it, the
|
||||
substitution applies in full. A solid red rectangle comes back solid red. A real
|
||||
rendered scene, which is high-entropy by construction, gets the full treatment. This
|
||||
is what keeps a masking-detection probe from immediately noticing that something
|
||||
intercepts every readback.
|
||||
|
||||
## Why substitution instead of noise, here specifically
|
||||
|
||||
[Adding noise per call is the common approach, and it fails a very cheap check](canvas-fingerprint-noise.md):
|
||||
read the canvas twice in the same page and compare. What makes substitution the
|
||||
right choice for cross-platform consistency specifically is a different property:
|
||||
substituted output is a pure function of the seed and the pixel position, with zero
|
||||
input from the actual rendering pipeline underneath. Additive noise on top of a real
|
||||
render still carries the render's own signature - two machines with different font or
|
||||
GPU backends produce different base images, and a small perturbation on top doesn't
|
||||
hide that. Substitution removes the underlying image from the equation entirely, so
|
||||
there's nothing left for the host to leak into the result.
|
||||
|
||||
There's a second, sharper way per-pixel noise fails, found on this exact surface: a
|
||||
detector doesn't need two reads to catch it, because the noise itself has a
|
||||
statistical shape that a single read can flag. A small random offset applied to a
|
||||
fraction of pixels reads as unnaturally high-frequency variation - a masking-detection
|
||||
check built to look for exactly that pattern flagged it directly, on the WebGL
|
||||
readback specifically, with the rest of the fingerprint surface clean. Replacing it
|
||||
with a per-channel remap - which looks like an ordinary colour-profile difference
|
||||
between GPUs rather than injected noise - took a measured spike count from roughly
|
||||
320 down to near zero on the same probe. Substitution inherits that property too,
|
||||
for the same reason: nothing about it resembles noise added on top of a real signal.
|
||||
|
||||
| Approach | How it hides the host | Where it fails |
|
||||
|---|---|---|
|
||||
| Additive per-call noise | Perturbs a fraction of pixels on top of the real render | Two reads in one page differ; the real render's font/GPU signature still shows through; the noise has a high-frequency shape a single read can flag |
|
||||
| Full substitution | Replaces pixels with a pure function of the seed and the pixel position, with zero input from the render underneath | Must leave low-entropy buffers untouched so it does not break legitimate canvas reads |
|
||||
|
||||
## The proof: byte-identical hashes, not just "looks similar"
|
||||
|
||||
Rendered the same seed's canvas (text plus a gradient) and WebGL scene (a
|
||||
high-entropy draw) on Windows and on Linux, hashed both in-page. The hashes matched
|
||||
byte for byte on both platforms. Run against a commercial fingerprint scanner across
|
||||
multiple seeds, zero failures on either OS.
|
||||
|
||||
That is a stronger claim than "produces a plausible fingerprint." It's the same
|
||||
identity, provably, regardless of which OS is actually running underneath - which is
|
||||
what makes a seed a real, portable identity instead of a value that happens to look
|
||||
right on the machine it was tested on.
|
||||
|
||||
## What this generalises to, and where the edges still are
|
||||
|
||||
The underlying idea applies to any surface where content can only see a value
|
||||
through a small number of export or readback calls: intercept there, and it doesn't
|
||||
matter what happens upstream. It is also, necessarily, an enumeration problem - the
|
||||
fix is only as complete as the list of export paths it covers, and browsers keep
|
||||
adding new ones (newer capture and streaming APIs, newer GPU-facing interfaces).
|
||||
Treat any such list as something that needs revisiting as the platform grows, not as
|
||||
a fact that becomes true once and stays true.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Can canvas and WebGL fingerprints be made identical across operating systems?**
|
||||
Yes, if the interception happens at every point content can read the result rather
|
||||
than at the render itself, which is the part that can't be touched directly on a
|
||||
GPU-backed surface.
|
||||
|
||||
**Why substitution instead of adding noise to the real render?** Noise on top of a
|
||||
real image still carries the host's own rendering signature underneath it.
|
||||
Substitution replaces the value entirely, so nothing about the actual host reaches
|
||||
the output.
|
||||
|
||||
**Won't this break real uses of canvas, like image editing or QR decoding?** A
|
||||
masking-safe design leaves near-uniform, low-entropy output untouched and only
|
||||
substitutes high-entropy renders, which is what a fingerprinting probe looks like
|
||||
and an image editor's output usually doesn't - though the same caveat as
|
||||
[canvas fingerprint noise](canvas-fingerprint-noise.md) applies if your own use case
|
||||
happens to fall on the wrong side of that line.
|
||||
|
||||
**Is this the same fix as the font work?** The same shape - intercept at the point
|
||||
content can observe, not at the source - applied to a different surface.
|
||||
|
||||
**See also:** [canvas fingerprint noise](canvas-fingerprint-noise.md), for why
|
||||
per-call randomisation specifically fails; [how to make Linux and macOS report real
|
||||
Windows fonts](bundled-fonts-cross-platform.md), for the same architecture applied to
|
||||
fonts; [WebGL renderer strings](webgl-renderer-strings.md), for the adjacent
|
||||
surface of what the GPU claims to be rather than what it draws; and
|
||||
[how the BrowserLeaks canvas and WebGL hash is computed](browserleaks-canvas-webgl-hash.md),
|
||||
for what that hash actually measures.
|
||||
|
||||
## Sources
|
||||
|
||||
- This project's own render-readback interception work and its cross-platform
|
||||
validation (same-seed byte-identical hashes on Windows and Linux, multi-seed
|
||||
results against a commercial fingerprint scanner).
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level, on making a seed mean the same machine regardless
|
||||
of what it's actually running on.*
|
||||
@@ -0,0 +1,159 @@
|
||||
---
|
||||
title: "The ChromeDriver `cdc_` variable, and why renaming it fails"
|
||||
description: "The cdc_ variable ChromeDriver leaves on the page is a one-line Selenium test. Renaming it in the binary raises the bar but does not remove the tell."
|
||||
parent: "The Automation Layer"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 2
|
||||
---
|
||||
|
||||
|
||||
# The ChromeDriver `cdc_` variable, and why renaming it fails
|
||||
|
||||
**The `cdc_` variable is a property that ChromeDriver injects into every page it
|
||||
controls, and its presence is a one-line test for Selenium automation. Renaming the
|
||||
string in the binary hides it from a check that greps for the exact prefix, but not
|
||||
from one that looks for the pattern, because the properties are still on the page.**
|
||||
|
||||
If you have automated Chrome with Selenium and been detected, you have probably met
|
||||
this variable. This is what it is, why renaming it in the binary does not remove it,
|
||||
and what that generalises to.
|
||||
|
||||
The check looks like this:
|
||||
|
||||
```js
|
||||
Object.getOwnPropertyNames(document).find(k => k.startsWith('cdc_'))
|
||||
```
|
||||
|
||||
or the same thing scanning `window`. It is a two-line test, it is in every
|
||||
bot-detection script, and understanding why it works explains a lot about how this
|
||||
whole category of tell comes to exist.
|
||||
|
||||
## What the variable is
|
||||
|
||||
ChromeDriver, the binary Selenium talks to, needs to run its own JavaScript inside
|
||||
the page: that is how it finds elements, reads text, and executes your `execute_script`
|
||||
calls. To do that it keeps some state on the page's own objects, under names derived
|
||||
from a fixed string compiled into the binary. Historically they look like this:
|
||||
|
||||
```
|
||||
cdc_adoQpoasnfa76pfcZLmcfl_Array
|
||||
cdc_adoQpoasnfa76pfcZLmcfl_Promise
|
||||
cdc_adoQpoasnfa76pfcZLmcfl_Symbol
|
||||
```
|
||||
|
||||
The prefix is stable across installations because it is a literal in the executable,
|
||||
which is exactly what makes it a reliable signal. A page that finds one of those
|
||||
property names is not guessing: nothing else puts them there.
|
||||
|
||||
Note what this is not. It is not a flag someone forgot to remove, and it is not the
|
||||
same class of thing as `navigator.webdriver`. It is working state that the tool needs
|
||||
in order to function.
|
||||
|
||||
## Why the usual fix is a rename
|
||||
|
||||
The well-known remedy, and what [`undetected-chromedriver`](vs-undetected-chromedriver.md)
|
||||
does, is to patch the binary and replace that literal with a different random-looking
|
||||
string of the same length. Same length matters: it is an in-place patch of a compiled file, so the
|
||||
replacement has to fit.
|
||||
|
||||
That works against the check at the top of this page, because the check greps for
|
||||
`cdc_`. It does not work against a slightly better one.
|
||||
|
||||
The variables are still there, still on `document`, still a set of three related
|
||||
names appearing together, still matching a shape no page author would produce. A
|
||||
detector that looks for *the pattern* instead of the prefix, three own properties on
|
||||
`document` with a common random-looking stem and typed suffixes, finds them again.
|
||||
And because the patch has to preserve length, the shape of the replacement is
|
||||
constrained in ways that make it recognisable.
|
||||
|
||||
So: renaming raises the bar, it does not remove the surface. That distinction is the
|
||||
whole point of this page, and it applies far beyond this one variable.
|
||||
|
||||
## The general shape of the problem
|
||||
|
||||
Any automation tool that needs to run code in the page needs somewhere to keep state.
|
||||
The options are:
|
||||
|
||||
1. **Put it on page objects under a known name.** Easy, and detectable by name.
|
||||
2. **Put it on page objects under a randomised name.** Harder, and detectable by
|
||||
shape.
|
||||
3. **Do not put it on page objects at all.** Keep the state on the driver side of the
|
||||
boundary, or in an execution context the page cannot enumerate.
|
||||
|
||||
Option three is the only one that removes the surface instead of obscuring it, and
|
||||
it is a design decision made long before anyone runs a detection test. It is also why
|
||||
["which stealth plugin should I use"](playwright-stealth-levels.md) is often the wrong
|
||||
question: no plugin can move state out of the page after the fact.
|
||||
|
||||
## Where Firefox differs, and where it does not
|
||||
|
||||
Firefox's automation does not use ChromeDriver, so `cdc_` does not exist there. That
|
||||
is a fact about the protocol, not a virtue: Firefox's automation surfaces are
|
||||
simply different ones.
|
||||
|
||||
What Firefox does still do by default is set `navigator.webdriver` to `true` when a
|
||||
session is under automation control, because the
|
||||
[WebDriver specification](https://www.w3.org/TR/webdriver2/) requires it: the
|
||||
property reflects a "webdriver-active" flag the spec sets whenever the user agent
|
||||
is under remote control. So a stock Playwright Firefox is trivially detectable too,
|
||||
just by a different two-line check, and anyone claiming Firefox is inherently
|
||||
undetected is selling something.
|
||||
|
||||
The useful difference is architectural, not moral. Firefox's automation
|
||||
protocol runs in privileged code with its own execution contexts, so the state a
|
||||
driver needs does not have to live where the page can enumerate it. Whether a given
|
||||
tool takes advantage of that is a separate question from whether the engine allows
|
||||
it.
|
||||
|
||||
## What to actually check
|
||||
|
||||
If you are debugging a detection problem on a Chromium-based stack, check in this
|
||||
order:
|
||||
|
||||
1. `Object.getOwnPropertyNames(document)` and the same for `window`, looking for
|
||||
groups of related unfamiliar names, not one specific prefix.
|
||||
2. `navigator.webdriver`, remembering that `false` is not the same answer as
|
||||
`undefined`, and a clean browser gives the latter.
|
||||
3. Whether anything you loaded has patched a built-in: print
|
||||
`Function.prototype.toString.call(navigator.__lookupGetter__('webdriver'))` and
|
||||
see whether it says `[native code]`.
|
||||
4. The non-automation signals, which is usually where the real problem is by the time
|
||||
you have got this far: the GPU string, the font set, the timezone against the IP.
|
||||
|
||||
Number four catches more sessions than one to three combined, and it is the one
|
||||
nobody checks first.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**What is the `cdc_` variable?** A property ChromeDriver injects into the document,
|
||||
whose name starts with `cdc_` followed by a random-looking string. Its presence is a
|
||||
one-line check for Selenium automation.
|
||||
|
||||
**Does renaming it in the binary work?** Against a check that greps for the exact
|
||||
prefix, yes. Against a check looking for the *pattern*, three unexpected own properties
|
||||
on `document`, no, because renaming does not remove them.
|
||||
|
||||
**How do I find it?** Enumerate `document`'s own properties and look for entries no
|
||||
normal document has.
|
||||
|
||||
**Does Playwright have an equivalent?** Not this one, because it does not use
|
||||
ChromeDriver, and not a comparable global either - checked directly, enumerating
|
||||
every own property on `window` in a live Playwright-driven Chromium session finds
|
||||
nothing resembling `window.__playwright` or any similarly-named global. Some
|
||||
online guides describe one anyway; it is worth checking a claim like that yourself
|
||||
before repeating it, the same way this page checks `cdc_` by opening a real
|
||||
session rather than trusting a description of one. That does not mean Playwright
|
||||
sessions have no artefacts at all - [each automation stack has its own, and each
|
||||
one is a function whose source can be printed](tostring-native-code-detection.md) -
|
||||
only that this specific one does not appear to be real.
|
||||
|
||||
**What is the real fix?** Do not add the properties at all, which means the automation
|
||||
layer has to be built differently rather than patched afterwards.
|
||||
|
||||
**See also:** [why setting `navigator.webdriver` to false is worse than leaving it alone](navigator-webdriver-explained.md), [the three levels a stealth tool can work at](playwright-stealth-levels.md), since where the state lives is a level-two decision, and [selenium-stealth's actual maintenance status](selenium-stealth-unmaintained.md), for the popular package that patches properties next to this one.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level. Firefox-based, so `cdc_` was never our problem,
|
||||
but the general shape of it is everybody's.*
|
||||
@@ -0,0 +1,259 @@
|
||||
---
|
||||
title: "Chromium is not Chrome, and detectors know the difference"
|
||||
description: "Chrome for Testing, Playwright's default since 1.57, plays H.264 but still fails the Widevine DRM check - a compiled-in gap that no JavaScript patch can close."
|
||||
parent: "Comparisons"
|
||||
nav_order: 3
|
||||
---
|
||||
|
||||
|
||||
# Chromium is not Chrome, and detectors know the difference
|
||||
|
||||
**Short answer:** no, they are not the same, and the gap moved in 2026 rather than closing.
|
||||
Playwright's default Chromium - Chrome for Testing since v1.57 - now plays the same
|
||||
H.264/AAC codecs as real Chrome, checked directly in a live session. It still fails
|
||||
Chrome's [Widevine DRM check](https://developer.mozilla.org/en-US/docs/Web/API/Encrypted_Media_Extensions_API), and that part cannot be patched from JavaScript because it is
|
||||
a compiled-in capability, not a value a page reads off a string.
|
||||
|
||||
Every stealth guide for Chromium-based automation quietly assumes "Chromium" and "Chrome"
|
||||
mean the same thing, or that the gap between them is fixed and permanent. Neither is true.
|
||||
The gap is real, it moved in 2026, and one part of it is still a **compiled-in capability**
|
||||
that a page can test for directly and that no amount of JavaScript patching can produce.
|
||||
|
||||
This page is what Playwright actually ships today, what changed and what didn't, why the
|
||||
part that remains cannot be patched, why spoofing the user agent makes it worse rather than
|
||||
better, and why Firefox has no equivalent gap.
|
||||
|
||||
## What Playwright ships today, checked directly rather than assumed
|
||||
|
||||
Playwright's own browser documentation used to be the whole answer: the default managed
|
||||
Chromium was an open-source build, missing the proprietary parts Google adds on top. As of
|
||||
[Playwright 1.57](https://playwright.dev/docs/release-notes), that changed. The default managed binary - launched with no `channel` set
|
||||
at all - is now **Chrome for Testing**, Google's own dedicated distribution for automated
|
||||
testing, pinned to the Playwright version rather than auto-updating.
|
||||
|
||||
Chrome for Testing is not the stripped-down build the old default was. It ships the same
|
||||
proprietary codec support as the Chrome a real visitor runs. Checked directly, in a live
|
||||
Playwright session with no `channel` argument and no stealth layer applied: H.264 and AAC
|
||||
both play. The codec half of this page's original argument no longer holds for a current,
|
||||
default Playwright launch - it holds for whatever version you're actually pinned to, and it
|
||||
is worth checking your own rather than assuming either answer.
|
||||
|
||||
## The Widevine gap that survives the switch
|
||||
|
||||
Checked in the same session: Widevine still rejects.
|
||||
|
||||
```js
|
||||
await navigator.requestMediaKeySystemAccess('com.widevine.alpha', [{
|
||||
initDataTypes: ['cenc'],
|
||||
videoCapabilities: [{ contentType: 'video/mp4; codecs="avc1.42E01E"' }],
|
||||
}]);
|
||||
// current default Playwright (Chrome for Testing): rejects, NotSupportedError
|
||||
```
|
||||
|
||||
Chrome for Testing carries Chrome's codecs but not its Widevine CDM (Content Decryption
|
||||
Module) - DRM distribution has its own licensing path separate from the codec libraries,
|
||||
and Google's dedicated testing distribution does not carry it. That gap is the one worth
|
||||
building an argument around, because unlike the codec question, it is not a moving target
|
||||
tied to which Playwright version happens to be pinned - it is a deliberate omission from a
|
||||
distribution built for automation in the first place.
|
||||
|
||||
Here is the part that matters for anyone building or buying a stealth tool:
|
||||
|
||||
> **This is not a value. It is a capability.** A missing DRM module is missing machine
|
||||
> code. You can lie about `navigator.userAgent` because it is a string; you cannot lie
|
||||
> about whether the build can actually negotiate a Widevine session, because the page can
|
||||
> ask it to and read the real answer.
|
||||
|
||||
This is the same distinction as
|
||||
[a renderer string against the pixels a rasteriser actually draws](renderer-string-vs-render.md),
|
||||
and it is the expensive class of problem for the same reason.
|
||||
|
||||
[The codec page](codec-fingerprinting.md) covers the wider surface; this is the sharpest
|
||||
surviving instance of it, even after the part that used to accompany it closed.
|
||||
|
||||
## Almost nobody browses with a Widevine-less build
|
||||
|
||||
Almost nobody outside development, CI and automation runs a browser without Widevine.
|
||||
|
||||
Real people use Chrome, Edge, Brave, Opera, Vivaldi, and every one of those ships Widevine,
|
||||
because a browser that cannot play protected video from a mainstream streaming service is
|
||||
not a browser anybody keeps as their daily one. A build that answers "no" to the Widevine
|
||||
check is a developer artefact, a CI image, or automation - not a real visitor's machine.
|
||||
|
||||
So the population of "sessions reporting no Widevine support" is made up overwhelmingly of
|
||||
developers and automation. That is not a fingerprint value being rare. That is **a cohort
|
||||
whose membership is almost entirely the thing being looked for.**
|
||||
|
||||
And unlike most signals in this subject, it needs no model and no scoring. It is a
|
||||
capability check with a yes or no answer.
|
||||
|
||||
## Spoofing the user agent makes this worse
|
||||
|
||||
Setting the user agent to claim Chrome does not close the Widevine gap - it turns a merely
|
||||
missing capability into a contradiction the page can check directly.
|
||||
|
||||
A stealth tool sets the user agent to claim Google Chrome. On a current, default Playwright
|
||||
launch the codec set now agrees with that claim - that particular contradiction closed along
|
||||
with the codec gap. The Widevine one didn't. Now the page has:
|
||||
|
||||
- a user agent saying **Chrome**,
|
||||
- a Widevine check saying **no such CDM**,
|
||||
- and in Chromium, `Sec-CH-UA` brands that
|
||||
[have their own copy of the same claim](client-hints-sec-fetch.md), agreeing with the
|
||||
user agent while the DRM check contradicts both.
|
||||
|
||||
Before the spoof, the browser was merely missing a capability real visitors have. After it,
|
||||
the browser is lying about being able to do something it provably cannot, and the lie is
|
||||
checkable in one line rather than inferred from a rare value. That is
|
||||
[the same mistake the user agent page is about](playwright-user-agent.md), in its most
|
||||
concrete remaining form.
|
||||
|
||||
## The `channel` escape, and what it costs
|
||||
|
||||
Playwright does let you opt into a branded browser:
|
||||
|
||||
```python
|
||||
p.chromium.launch(channel="chrome")
|
||||
```
|
||||
|
||||
That launches the real Chrome installed on the machine, with the real Widevine. It
|
||||
genuinely closes the remaining gap - the one thing a current default launch, running Chrome
|
||||
for Testing, still doesn't give you.
|
||||
|
||||
The costs are real and worth being explicit about:
|
||||
|
||||
- **You do not ship it.** It uses whatever Chrome is installed, at whatever version, so
|
||||
your fleet is only as consistent as your machine images.
|
||||
- **It updates underneath you**, on Google's schedule rather than yours.
|
||||
- **It is not available everywhere**, particularly in slim containers, which is exactly
|
||||
where automation runs.
|
||||
- **It is still Chrome with automation attached**, so every other layer of this subject
|
||||
applies unchanged.
|
||||
|
||||
It is the right call when you can take those costs. It is not a solved problem, it is a
|
||||
traded one.
|
||||
|
||||
## Firefox has no equivalent gap
|
||||
|
||||
Firefox has no capability gap like Widevine to exploit, because it has no proprietary-versus-open
|
||||
split of this kind in the first place - which is the structural reason this belongs in a
|
||||
comparison rather than a list of tips.
|
||||
|
||||
There is no "Firefox" and
|
||||
"Firefox-without-the-codecs" pair where one is what people run and the other is what
|
||||
automation runs. The build Mozilla ships and a build compiled from the same source with
|
||||
the release configuration have the same feature set.
|
||||
|
||||
So a patched Firefox is **Firefox**, in the ways a capability check can test. A patched
|
||||
Chromium is **Chromium claiming to be Chrome**, and the claim is contradicted by things
|
||||
that are not strings.
|
||||
|
||||
That is not an argument that Firefox wins overall.
|
||||
[The argument against Firefox is its share of real traffic](firefox-vs-chromium-antidetect.md),
|
||||
and it is serious. But on this specific axis the two engines are not in comparable
|
||||
positions, and most comparisons never mention it.
|
||||
|
||||
## Codec and DRM support, by build
|
||||
|
||||
| Build | H.264 / AAC playback | Widevine DRM | What it actually is |
|
||||
|---|---|---|---|
|
||||
| Bare open-source Chromium (pre-1.57 default, or an explicit unbranded build) | No | No | Missing the proprietary codec and DRM additions Google adds on top of open-source Chromium |
|
||||
| Chrome for Testing (Playwright's default since 1.57, no `channel` set) | Yes | No | Google's own automation distribution - Chrome's codecs, not Chrome's DRM licensing |
|
||||
| Real Chrome, launched via `channel="chrome"` | Yes | Yes | The actual installed browser, with the update and install costs described above |
|
||||
| Firefox, patched at the C++ level | N/A - no split | N/A - no split | One build, not two: there is no stripped variant that only automation runs |
|
||||
|
||||
## How to check your own build for the gap
|
||||
|
||||
Run this in whatever browser your automation actually launches:
|
||||
|
||||
```js
|
||||
const v = document.createElement('video');
|
||||
console.table({
|
||||
h264: v.canPlayType('video/mp4; codecs="avc1.42E01E"') || 'no',
|
||||
aac: v.canPlayType('audio/mp4; codecs="mp4a.40.2"') || 'no',
|
||||
mp3: v.canPlayType('audio/mpeg') || 'no',
|
||||
ua: navigator.userAgent,
|
||||
});
|
||||
|
||||
navigator.requestMediaKeySystemAccess('com.widevine.alpha', [{
|
||||
initDataTypes: ['cenc'],
|
||||
videoCapabilities: [{ contentType: 'video/mp4; codecs="avc1.42E01E"' }],
|
||||
}]).then(() => console.log('widevine: yes'), () => console.log('widevine: no'));
|
||||
```
|
||||
|
||||
Then compare against the browser you are claiming to be, on the same machine.
|
||||
|
||||
- If the user agent says Chrome and H.264 comes back empty, your build predates the
|
||||
Chrome for Testing default, or you launched with an explicit bare-Chromium build, and you
|
||||
have the codec-level version of the contradiction described above.
|
||||
- If Widevine rejects while the user agent says Chrome, that is the gap that survives even
|
||||
on a current, default launch.
|
||||
- If both are consistent with the claim, this particular problem is not yours - but check
|
||||
which one actually changed before assuming why.
|
||||
|
||||
## Conclusion
|
||||
|
||||
The most repeated advice in Chromium-based stealth is to make the browser look like
|
||||
Chrome. As of Playwright 1.57's switch to Chrome for Testing as the default, the browser
|
||||
got measurably closer to actually being Chrome on the codec axis - that part of the old
|
||||
advice is less wrong than it used to be. Widevine did not follow, and it remains a
|
||||
capability rather than a value, which puts it out of reach of every technique that works
|
||||
on the others.
|
||||
|
||||
The choices that actually address the remaining gap are to run real Chrome through a
|
||||
branded channel and accept that you no longer control the binary, or to use an engine that
|
||||
does not have the gap in the first place.
|
||||
|
||||
What does not address it is a better user agent string, which converts a browser that is
|
||||
merely missing one capability into one that is provably lying about it.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Does Playwright use Chrome or Chromium?** As of Playwright 1.57, the default managed
|
||||
binary (no `channel` set) is Chrome for Testing - Google's own dedicated automation
|
||||
distribution, carrying Chrome's codecs but not its Widevine CDM. Earlier Playwright
|
||||
versions, or an explicit bare-Chromium build, still lack the codecs too. Branded channels
|
||||
remain available as an opt-in for the rest.
|
||||
|
||||
**How can a website tell an automated Chromium-family browser from real Chrome today?**
|
||||
Mostly by asking for Widevine DRM support, which the codec-carrying default still lacks.
|
||||
The codec check that used to work for this closed as of the 1.57 default switch.
|
||||
|
||||
**Can I patch Widevine support in?** Not from JavaScript. A missing DRM module is missing
|
||||
code, not a missing property.
|
||||
|
||||
**Is using a Widevine-less build suspicious?** Yes, specifically: almost the only sessions
|
||||
answering "no" to that one check are developers, CI, and automation.
|
||||
|
||||
**Should I spoof the user agent to say Chrome?** No. On a current default launch it no
|
||||
longer contradicts the codec check, but it still contradicts the Widevine one, and that
|
||||
contradiction is checkable in one line.
|
||||
|
||||
**What about `channel="chrome"`?** It closes the remaining gap and hands you a browser you
|
||||
do not ship, do not version and cannot always install.
|
||||
|
||||
**Does Firefox have the same problem?** No. There is no widely-used stripped Firefox that
|
||||
automation runs and people do not.
|
||||
|
||||
**See also:** [Codec fingerprinting](codec-fingerprinting.md) for the wider surface,
|
||||
[why you should not set the user agent](playwright-user-agent.md),
|
||||
[Client Hints and Sec-Fetch](client-hints-sec-fetch.md) for the third copy of the same
|
||||
claim, and
|
||||
[Firefox or Chromium for anti-detect](firefox-vs-chromium-antidetect.md) for the argument
|
||||
in both directions.
|
||||
|
||||
## Sources
|
||||
|
||||
- [Playwright's release notes](https://playwright.dev/docs/release-notes), on the switch
|
||||
from custom-compiled open-source Chromium to Chrome for Testing as the default managed
|
||||
binary.
|
||||
- Direct capability checks run in a live Playwright session, 2026-07-30: H.264 and AAC
|
||||
playable, Widevine (`com.widevine.alpha`) rejected with `NotSupportedError`, on the
|
||||
default managed binary with no `channel` argument set.
|
||||
- [The Encrypted Media Extensions API](https://developer.mozilla.org/en-US/docs/Web/API/Encrypted_Media_Extensions_API), for the Widevine capability check above.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level. This is the argument for the engine choice that we
|
||||
find most convincing, and it is the one most comparisons leave out.*
|
||||
@@ -0,0 +1,84 @@
|
||||
---
|
||||
title: "CLI reference"
|
||||
description: "The invisible-playwright command line: two commands, fetch and version, and what each one covers."
|
||||
parent: "Documentation"
|
||||
nav_order: 5
|
||||
---
|
||||
|
||||
|
||||
# CLI reference
|
||||
|
||||
The installed command is `invisible-playwright`, with a hyphen. `python -m
|
||||
invisible_playwright` works identically and needs nothing on `PATH`.
|
||||
|
||||
```bash
|
||||
invisible-playwright fetch # download the engine if missing, check every cached
|
||||
# one against the seal, print the path
|
||||
invisible-playwright version # wrapper, core and engine versions, and where the
|
||||
# engine is cached
|
||||
```
|
||||
|
||||
## `fetch`
|
||||
|
||||
Makes the engine present and correct, then prints where it is.
|
||||
|
||||
It checks every cached engine tree against the seal shipped inside
|
||||
`invisible-core` **before** downloading anything. That ordering is the point: a
|
||||
tree that no longer matches the seal is the case worth catching, and it is
|
||||
invisible to a plain "download if missing" that only looks at whether a file is
|
||||
there. Anything that does not match is reported on stderr and left alone; the
|
||||
sealed engine is fetched and verified against its sha256.
|
||||
|
||||
The last line on stdout is the absolute path, by itself, so this is the scripting
|
||||
form:
|
||||
|
||||
```bash
|
||||
FIREFOX="$(invisible-playwright fetch)"
|
||||
```
|
||||
|
||||
which is better than asking for a path separately, because it guarantees the
|
||||
thing it names actually exists and matches the seal.
|
||||
|
||||
Running it when everything is already correct is cheap and does nothing.
|
||||
|
||||
## `version`
|
||||
|
||||
```
|
||||
invisible_playwright 0.6.0
|
||||
invisible_core 18.12.0 (declared: ==18.12.0)
|
||||
engine firefox-18 Firefox 151.0 build 20260724001949
|
||||
seal f294a96ae4ec [.../invisible_core/seal.json]
|
||||
cache /home/you/.cache/invisible-playwright
|
||||
```
|
||||
|
||||
This is the output to paste into a bug report. Two lines are worth knowing about:
|
||||
|
||||
- if the installer's record disagrees with the core that will actually run, a
|
||||
`STALE RECORD` line appears between them. That is the state pip and `pip check`
|
||||
both call healthy, because both read the record and neither reads the files.
|
||||
- `cache` is where the engine trees live. Deleting a directory there is how you
|
||||
reclaim the space; there is no subcommand for it, on purpose - see below.
|
||||
|
||||
## What happened to the other four
|
||||
|
||||
The command line used to have six entries: `fetch`, `fetch --force`, `path`,
|
||||
`version`, `clear-cache`, `doctor`. Each was a step somebody had to know to take,
|
||||
in a package whose whole promise is that the browser handles itself. None of the
|
||||
behaviour was lost:
|
||||
|
||||
| gone | where it went |
|
||||
|---|---|
|
||||
| `doctor` | `fetch` does it on every run. It was the thing most worth doing and the thing least likely to be typed, which is the worst combination a subcommand can have. |
|
||||
| `fetch --force` | unnecessary once every run verifies. A tree is replaced because it does not match the seal, not because a flag was passed. |
|
||||
| `path` | `fetch` prints it as its last line, and unlike `path` it guarantees the tree is there and correct. |
|
||||
| `clear-cache` | deliberately not folded in. The cache root is shared with `invisible_firefox`, so pruning "trees no seal points at" would delete the other product's engine on a machine running both. `version` prints the location. |
|
||||
|
||||
The `tag` argument went with them. The seal decides which engine a given build
|
||||
runs, and the engine check refuses anything else, so a tag on the command line
|
||||
could only ever name something that would then be rejected.
|
||||
|
||||
## See also
|
||||
|
||||
[Installation](installation.md) for the initial `fetch`, and
|
||||
[Configuration](configuration.md) for the environment variables that change where
|
||||
the engine is cached or which binary gets used.
|
||||
@@ -0,0 +1,213 @@
|
||||
---
|
||||
title: "Client Hints and Sec-Fetch: headers that must agree"
|
||||
description: "Client Hints (Sec-CH-UA) and Sec-Fetch headers come from the browser's own state, so they are cheap to compare and hard to fake. Why Firefox sits differently."
|
||||
parent: "Browser Identity"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 6
|
||||
---
|
||||
|
||||
|
||||
# Client Hints and Sec-Fetch: headers that must agree
|
||||
|
||||
[Client Hints](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Client_hints) and
|
||||
Sec-Fetch are two families of request headers the browser generates from
|
||||
its own internal state, not from the page and not from anything you configure. That makes
|
||||
them awkward to fake and very cheap to check, which is a combination detectors like.
|
||||
|
||||
They also catch a specific mistake: changing the user agent string and nothing else.
|
||||
|
||||
This page is what each family carries, the mismatches that get caught, why Firefox and
|
||||
Chromium are in structurally different positions here, what automation can and cannot
|
||||
control, and how to check your own.
|
||||
|
||||
## Client Hints: one identity in three places
|
||||
|
||||
Modern Chromium reports its identity in three places that come from the same internal
|
||||
state:
|
||||
|
||||
```
|
||||
Sec-CH-UA: "Chromium";v="141", "Not?A_Brand";v="8", "Google Chrome";v="141"
|
||||
Sec-CH-UA-Mobile: ?0
|
||||
Sec-CH-UA-Platform: "Windows"
|
||||
```
|
||||
|
||||
```js
|
||||
navigator.userAgentData.brands // the same brands and versions
|
||||
navigator.userAgentData.platform // the same platform
|
||||
await navigator.userAgentData.getHighEntropyValues(['platformVersion', 'architecture'])
|
||||
```
|
||||
|
||||
```
|
||||
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) ... Chrome/141.0.0.0 ...
|
||||
```
|
||||
|
||||
In a real browser those three agree by construction, because one piece of state produces
|
||||
all of them. Comparing them is a few lines on the server and it needs no fingerprinting
|
||||
library at all.
|
||||
|
||||
### The mismatches that get caught
|
||||
|
||||
- **A spoofed user agent with untouched Client Hints.** You set the string to Chrome 141
|
||||
and the headers still describe whatever the browser really is. This is the single most
|
||||
common version of the mistake, because changing the string is the thing every guide
|
||||
tells you to do.
|
||||
- **A version that differs between the two.** A current version in the user agent and an
|
||||
older one in the hints is a straight contradiction.
|
||||
- **A platform that differs.** Claiming Windows in the string while the hint reports the
|
||||
host operating system.
|
||||
- **The JavaScript API disagreeing with the headers.** Patching
|
||||
[`navigator.userAgentData`](https://developer.mozilla.org/en-US/docs/Web/API/NavigatorUAData)
|
||||
in the page does nothing to the headers, which were sent before your script existed.
|
||||
|
||||
That last one is worth sitting with. The headers travel with the request. A page-level
|
||||
override cannot reach them, ever, because they were already sent.
|
||||
|
||||
## Firefox is in a different position, in both directions
|
||||
|
||||
Firefox does not implement User Agent Client Hints. It sends no `Sec-CH-UA` headers and
|
||||
has no `navigator.userAgentData`.
|
||||
|
||||
That cuts two ways and both are worth being explicit about.
|
||||
|
||||
**In your favour, if you are actually Firefox.** There is no second identity pipeline to
|
||||
keep synchronised. The absence is correct, expected, and matches every other real Firefox
|
||||
on the internet. The whole class of mismatch above simply does not apply.
|
||||
|
||||
**Against you, if you claim to be Chrome.** A request whose user agent says Chrome and
|
||||
which carries no Client Hints at all is contradicted by its own headers. There is no way
|
||||
to fix that from inside a Firefox, because you would have to implement the pipeline.
|
||||
|
||||
So "which browser should I claim" is not a free choice. Claim the one you are running.
|
||||
[Which is the argument for not setting the user agent at all](playwright-user-agent.md).
|
||||
|
||||
## Sec-Fetch: how the request was initiated
|
||||
|
||||
[Sec-Fetch](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Sec-Fetch-Site)
|
||||
is a separate family of headers, present in every modern browser including
|
||||
Firefox, that describes how a request was initiated rather than what the browser is. It is
|
||||
much less discussed than Client Hints, and just as cheap for a server to check.
|
||||
|
||||
```
|
||||
Sec-Fetch-Site: same-origin | same-site | cross-site | none
|
||||
Sec-Fetch-Mode: navigate | cors | no-cors | same-origin
|
||||
Sec-Fetch-Dest: document | image | script | style | empty
|
||||
Sec-Fetch-User: ?1 (only present when a user activated the navigation)
|
||||
```
|
||||
|
||||
These describe **the circumstances of the request**, not the browser. The browser fills
|
||||
them in from what it knows: where the request came from, what it is for, and whether a
|
||||
user gesture triggered it.
|
||||
|
||||
Why that is interesting for automation:
|
||||
|
||||
- A top-level navigation typed into the address bar carries `Sec-Fetch-Site: none`. One
|
||||
that came from clicking a link on the same site carries `same-origin`. A request
|
||||
fabricated outside the normal flow can easily carry the wrong one.
|
||||
- `Sec-Fetch-User: ?1` appears only when the navigation was user activated. Automation
|
||||
that clicks properly produces it; automation that navigates programmatically does not,
|
||||
and a page that expected a click can notice the difference.
|
||||
- `Sec-Fetch-Dest` has to match what the request is actually for. A document request that
|
||||
claims to be an image is not a browser.
|
||||
|
||||
The connection to the rest of this subject: user activation is also readable in the page,
|
||||
through `navigator.userActivation`, and it is the value that
|
||||
[an automation driver can announce by accident](debugger-timing-detection.md). Getting
|
||||
that wrong in either direction, claiming a gesture nobody made or lacking one a real flow
|
||||
would have, is the same class of inconsistency as everything else here.
|
||||
|
||||
## What automation can and cannot control
|
||||
|
||||
The practical division:
|
||||
|
||||
**Cannot be set from the page.** All of it. These headers are constructed by the network
|
||||
stack when the request is made. Anything you do in JavaScript happens after.
|
||||
|
||||
**Can be set by the automation layer**, badly. Most frameworks let you add or override
|
||||
request headers. Overriding these by hand is how you produce a set that no real browser
|
||||
sends, because you are now maintaining by hand something the browser was maintaining
|
||||
correctly.
|
||||
|
||||
**Should be left alone.** That is the whole recommendation. If the browser is real and
|
||||
you have not overridden its identity, both families are correct for free.
|
||||
|
||||
The one legitimate case is adding headers a site requires for its own API, which is
|
||||
unrelated to identity and does not touch either family.
|
||||
|
||||
## Checking your own
|
||||
|
||||
Send a request to any service that echoes headers back and read the full set, then
|
||||
compare against what the same page reports in JavaScript.
|
||||
|
||||
```js
|
||||
// in the page
|
||||
console.log(navigator.userAgent);
|
||||
console.log(navigator.userAgentData); // undefined in Firefox, and that is correct
|
||||
if (navigator.userAgentData) {
|
||||
console.log(await navigator.userAgentData.getHighEntropyValues(
|
||||
['platformVersion', 'architecture', 'model', 'uaFullVersion']));
|
||||
}
|
||||
```
|
||||
|
||||
What you want:
|
||||
|
||||
- If `navigator.userAgentData` exists, its brands, version and platform match both the
|
||||
user agent string and the `Sec-CH-UA` headers on the request.
|
||||
- If it does not exist, no `Sec-CH-UA` headers are being sent either, and the user agent
|
||||
claims a browser that genuinely does not send them.
|
||||
- `Sec-Fetch-Site` matches how you actually navigated.
|
||||
- `Sec-Fetch-User` is present when you clicked and absent when you navigated
|
||||
programmatically.
|
||||
- Header **order** matches a real browser's, [a separate surface](http2-fingerprint-detection.md)
|
||||
one layer down, and one more reason not to hand-assemble any of this.
|
||||
|
||||
## Conclusion
|
||||
|
||||
These headers are hard to fake for a good reason: the browser generates them from state
|
||||
it already has, so a real browser is consistent without trying and a spoofed one has to
|
||||
maintain three copies of an identity by hand.
|
||||
|
||||
The practical advice is short. Do not override the user agent, so there is nothing to
|
||||
keep in sync. Do not hand-set these headers. Claim the browser you are actually running,
|
||||
because Firefox not sending Client Hints is correct for Firefox and damning for something
|
||||
claiming to be Chrome.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**What is `Sec-CH-UA`?** A request header carrying the browser's brand and version,
|
||||
generated from the same internal state as the user agent string.
|
||||
|
||||
**Why do Client Hints give away a spoofed user agent?** Because changing the string does
|
||||
not change the headers, so the two describe different browsers.
|
||||
|
||||
**Does Firefox send Client Hints?** No, and it has no `navigator.userAgentData`. That is
|
||||
correct for Firefox and a contradiction for anything claiming to be Chrome.
|
||||
|
||||
**Can I set Client Hints from JavaScript?** No. The headers are sent before your script
|
||||
runs.
|
||||
|
||||
**What is `Sec-Fetch-User`?** A header present only when a user gesture triggered the
|
||||
navigation.
|
||||
|
||||
**Should I override these headers in my automation?** No. A real browser fills them in
|
||||
correctly, and hand-maintaining them is how you produce a combination that does not
|
||||
exist.
|
||||
|
||||
**See also:** [why you should not set the user agent](playwright-user-agent.md), which is
|
||||
the same argument from the other end,
|
||||
[JA3 and JA4](ja3-ja4-tls-fingerprint.md), for the layer below these headers, and
|
||||
[how to test whether your browser is detected](how-to-test-bot-detection.md).
|
||||
|
||||
## Sources
|
||||
|
||||
- The User Agent Client Hints headers and `navigator.userAgentData`, as implemented in
|
||||
Chromium and absent in Firefox.
|
||||
- The Fetch Metadata request headers, `Sec-Fetch-Site`, `-Mode`, `-Dest` and `-User`.
|
||||
- This project's handling of user activation, which is described on
|
||||
[the debugger page](debugger-timing-detection.md).
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level. Running a real Firefox means the Client Hints
|
||||
question answers itself, which is the kind of advantage you only get by not lying in the
|
||||
first place.*
|
||||
@@ -0,0 +1,199 @@
|
||||
---
|
||||
title: "Codec fingerprinting: canPlayType and MediaCapabilities"
|
||||
description: "Codec fingerprinting: the formats a browser claims to play reveal its build and platform; whether decoding is power efficient reveals the machine behind it."
|
||||
parent: "Browser Identity"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 7
|
||||
---
|
||||
|
||||
|
||||
# Codec fingerprinting: canPlayType and MediaCapabilities
|
||||
|
||||
Codec fingerprinting identifies a browser by which media formats it claims it can
|
||||
decode, and identifies the machine underneath by how efficiently it decodes them. Ask a
|
||||
browser what video formats it can play and the answer is not about the person using it.
|
||||
It is about the build, the operating system underneath, and increasingly the hardware,
|
||||
which makes it three separate fingerprinting surfaces wearing one API.
|
||||
|
||||
It is also one of the surfaces nobody checks after spoofing everything else, which is
|
||||
what makes it worth a page.
|
||||
|
||||
## What the two APIs actually return
|
||||
|
||||
Two APIs answer the "what can you play" question, from two different eras of the
|
||||
platform: the old `canPlayType()` returns a vague string, the modern
|
||||
`mediaCapabilities.decodingInfo()` returns a structured verdict including whether
|
||||
decoding is power efficient. The old one is deliberately vague:
|
||||
|
||||
```js
|
||||
const v = document.createElement('video');
|
||||
v.canPlayType('video/mp4; codecs="avc1.42E01E"'); // "probably", "maybe", or ""
|
||||
v.canPlayType('video/webm; codecs="vp9"');
|
||||
v.canPlayType('audio/mpeg');
|
||||
```
|
||||
|
||||
Three possible answers: `probably`, `maybe`, or an empty string. The vagueness is
|
||||
historical, and it does not reduce the information much, because what matters is the
|
||||
**pattern across a list of types**, not any single verdict.
|
||||
|
||||
The modern one is far more revealing:
|
||||
|
||||
```js
|
||||
await navigator.mediaCapabilities.decodingInfo({
|
||||
type: 'file',
|
||||
video: { contentType: 'video/mp4; codecs="avc1.42E01E"',
|
||||
width: 1920, height: 1080, bitrate: 3000000, framerate: 30 }
|
||||
});
|
||||
// { supported: true, smooth: true, powerEfficient: true }
|
||||
```
|
||||
|
||||
Note the third field. That is the interesting one and the rest of this page is largely
|
||||
about it.
|
||||
|
||||
## Codec support identifies the build and the platform
|
||||
|
||||
Which codecs a browser supports depends on how it was compiled and what the operating
|
||||
system provides. Some formats are handled by the browser's own decoders, others are
|
||||
delegated to the platform, and licensing means builds differ.
|
||||
|
||||
The practical consequences:
|
||||
|
||||
- **Different browsers give different patterns**, which is how codec probing is used for
|
||||
plain browser identification, independently of the user agent.
|
||||
- **The same browser version on different operating systems gives different patterns**,
|
||||
because the platform decoders differ. A Linux build and a Windows build of the same
|
||||
Firefox are not identical here.
|
||||
- **Stripped builds differ from consumer builds.** A minimal container image may lack
|
||||
system codecs that a desktop install has.
|
||||
|
||||
That third point is the one that bites automation. Claiming Windows while returning the
|
||||
codec profile of a slim Linux container is the same class of contradiction as
|
||||
[claiming Windows with a Linux font set](headless-fonts-differ.md), and it is checked
|
||||
the same way: by comparison, not by rarity.
|
||||
|
||||
## powerEfficient is a hardware question, not a codec question
|
||||
|
||||
`powerEfficient` reports whether decoding a given stream would use hardware
|
||||
acceleration, which is what turns this from a browser-identification surface into a
|
||||
machine one. On a desktop with a modern GPU, common formats decode in dedicated silicon
|
||||
and the answer is `true`. On a machine with no GPU, everything decodes on the CPU and the
|
||||
answer is `false` for formats a real desktop would accelerate.
|
||||
|
||||
So this API answers, in one field, the same question as
|
||||
[a software WebGL renderer](webgl-renderer-strings.md),
|
||||
[an empty speech voice list](speech-synthesis-voices.md) and
|
||||
[a missing audio device](audiocontext-fingerprinting.md): is this a person's computer or
|
||||
a server.
|
||||
|
||||
And `smooth` adds a second dimension, since it reflects whether the machine can decode
|
||||
that resolution and framerate in real time.
|
||||
|
||||
Nobody lists `decodingInfo` in a stealth checklist. It costs one `await`.
|
||||
|
||||
## Why randomising codec support is the wrong instinct
|
||||
|
||||
The reflex is to vary the answers per session. That is the same
|
||||
mistake as
|
||||
[randomising WebGL numeric parameters](webgl-parameters-are-identical.md), and it fails
|
||||
for the same reason.
|
||||
|
||||
Codec support is not a per-user setting. Everyone running a given browser build on a
|
||||
given platform reports the same pattern, which means the pattern is a **cohort**, and the
|
||||
crowd is the disguise. A browser reporting a combination of supported and unsupported
|
||||
formats that no real build produces is not blending in, it has invented a build that does
|
||||
not exist.
|
||||
|
||||
Nor should the values move between page loads. A browser that supports AV1 on one load
|
||||
and not the next is describing software that reinstalled itself mid-session.
|
||||
|
||||
The defensible approach is the one used for the other hardware-shaped values in this
|
||||
project: sample the codec profile **together with the machine class**, from combinations
|
||||
that occur, so a low-end integrated-graphics identity does not claim the codec profile of
|
||||
a workstation. It is one of four dimensions sampled jointly rather than independently,
|
||||
alongside the audio profile, the storage quota and the antialiasing level, precisely so
|
||||
they cannot contradict each other.
|
||||
|
||||
## Checking your own
|
||||
|
||||
```js
|
||||
const v = document.createElement('video');
|
||||
const types = [
|
||||
'video/mp4; codecs="avc1.42E01E"',
|
||||
'video/mp4; codecs="hev1.1.6.L93.B0"',
|
||||
'video/webm; codecs="vp8"',
|
||||
'video/webm; codecs="vp9"',
|
||||
'video/mp4; codecs="av01.0.05M.08"',
|
||||
'audio/mpeg', 'audio/ogg; codecs="opus"', 'audio/mp4; codecs="mp4a.40.2"',
|
||||
];
|
||||
console.table(Object.fromEntries(types.map(t => [t, v.canPlayType(t) || 'no'])));
|
||||
|
||||
const info = await navigator.mediaCapabilities.decodingInfo({
|
||||
type: 'file',
|
||||
video: { contentType: 'video/mp4; codecs="avc1.42E01E"',
|
||||
width: 1920, height: 1080, bitrate: 3000000, framerate: 30 },
|
||||
});
|
||||
console.log(info); // watch powerEfficient
|
||||
```
|
||||
|
||||
What you want to see:
|
||||
|
||||
- The pattern matches a stock browser of the same version **on the platform you claim**,
|
||||
not on the platform you are running.
|
||||
- `powerEfficient` is `true` for mainstream formats if you are claiming a desktop.
|
||||
- The answers are identical on a reload and on a relaunch of the same identity.
|
||||
- Nothing exotic is supported that the claimed build does not support.
|
||||
|
||||
The first and second are the ones that fail on a server, and neither is fixed by anything
|
||||
at the JavaScript layer.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Codec probing is cheap, unglamorous and rarely audited. It carries three different kinds
|
||||
of information at once: which browser you are, which platform you are on, and whether
|
||||
your machine has a video decoder.
|
||||
|
||||
The first two are fixed by making the answers match the build and platform you claim.
|
||||
The third is the familiar one: a machine with no GPU says so, in yet another place, and
|
||||
the only real fixes are the same as everywhere else.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Is `canPlayType` used for fingerprinting?** Yes, as a pattern across a list of types
|
||||
rather than as a single answer. It identifies the browser and the platform.
|
||||
|
||||
**What does `powerEfficient` reveal?** Whether decoding would be hardware accelerated,
|
||||
which is a statement about the machine rather than the codec.
|
||||
|
||||
**Should I spoof codec support?** Match it to the build and platform you claim. Do not
|
||||
randomise it, and do not let it vary between page loads.
|
||||
|
||||
**Why do Linux and Windows builds differ?** Because some decoding is delegated to the
|
||||
platform, and the platforms provide different things.
|
||||
|
||||
**Does `privacy.resistFingerprinting` cover this?** Firefox has worked on standardising
|
||||
these answers under that mode, which is one more way of being identifiable as someone
|
||||
running that mode. There is
|
||||
[a longer page on that trade](resist-fingerprinting.md).
|
||||
|
||||
**Is this checked in practice?** It is cheap enough that assuming it is checked costs you
|
||||
nothing, and it is one `await` to verify on your own setup.
|
||||
|
||||
**See also:** [screen size and viewport tells](screen-size-headless-tells.md),
|
||||
[hardwareConcurrency, deviceMemory and storage quota](hardware-concurrency-device-memory.md)
|
||||
and [Playwright in Docker](playwright-docker-detection.md), which are the rest of the
|
||||
"what the machine says about itself" family.
|
||||
|
||||
## Sources
|
||||
|
||||
- MDN, [`HTMLMediaElement.canPlayType`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/canPlayType)
|
||||
and the [Media Capabilities API](https://developer.mozilla.org/en-US/docs/Web/API/MediaCapabilities_API).
|
||||
- Firefox's own tracking of standardising these answers under resist-fingerprinting.
|
||||
- This project's codec profile, sampled jointly with the machine class rather than
|
||||
independently, for the reason given above.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level. The joint sampling is the same decision made for
|
||||
audio, storage quota and antialiasing, and for the same reason: independently sampled
|
||||
dimensions contradict each other.*
|
||||
@@ -0,0 +1,215 @@
|
||||
---
|
||||
title: "Color-gamut and HDR media queries as a fingerprint"
|
||||
description: "Color-gamut and HDR media features expose display capability without JavaScript. Why they must align with screen.colorDepth and what misalignment reveals."
|
||||
parent: "Browser Identity"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 28
|
||||
---
|
||||
|
||||
# Color-gamut and HDR media queries as a fingerprint
|
||||
|
||||
Most of the fingerprint surfaces people worry about live in JavaScript: `navigator`,
|
||||
canvas, WebGL, audio. This one does not. The [`color-gamut`](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/color-gamut), [`dynamic-range`](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/dynamic-range) and
|
||||
[`video-dynamic-range`](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/video-dynamic-range) media features describe what a display can show, and a page can
|
||||
read them from CSS alone, before a single line of script runs. That makes them a
|
||||
quiet consistency check: they have to agree with everything your JavaScript says about
|
||||
the same screen, and nothing you set in code touches them.
|
||||
|
||||
This page is what those features report, why they are read from a different code path
|
||||
than `screen.colorDepth`, the disagreement that gives a browser away, and how
|
||||
invisible_playwright keeps the two sides telling one story. It answers the question in
|
||||
the title honestly: matching these features helps you look like a real display, and it
|
||||
does nothing for your IP or your pacing.
|
||||
|
||||
## What color-gamut and dynamic-range actually report
|
||||
|
||||
Three CSS media features describe a display's color and brightness capability:
|
||||
|
||||
- `color-gamut` reports the range of color the output can render, as one of `srgb`,
|
||||
`p3` or `rec2020`. A page tests it with `@media (color-gamut: srgb) { ... }` or from
|
||||
script with `matchMedia("(color-gamut: p3)")`.
|
||||
- `dynamic-range` reports whether the display and the browser can show high dynamic
|
||||
range content, as `standard` or `high`.
|
||||
- `video-dynamic-range` is the same question aimed specifically at video output, and
|
||||
can differ from `dynamic-range` on hardware that treats the two paths separately.
|
||||
|
||||
None of these needs JavaScript to be readable. A stylesheet can branch on them and a
|
||||
detector can observe which branch applied, so they are live even on a page that runs
|
||||
no script at all. This puts them in the same family as the
|
||||
[CSS media features documented for dark mode and pointer type](css-media-query-fingerprinting.md),
|
||||
and distinct from them in what they describe: not a user preference, but a hardware
|
||||
property of the panel.
|
||||
|
||||
The values are not free-floating. A real Windows laptop with a standard sRGB panel
|
||||
reports `color-gamut: srgb` and `dynamic-range: standard`, and it reports a
|
||||
`screen.colorDepth` of 24 to match. Those two facts come from the same physical
|
||||
display, so on real hardware they never contradict each other. That is the whole
|
||||
point of the surface for a detector.
|
||||
|
||||
## Why this is read from a different code path than colorDepth
|
||||
|
||||
Here is the trap. `screen.colorDepth` is a JavaScript property. The color-gamut media
|
||||
feature is resolved by the CSS engine when it evaluates a media query. A page can read
|
||||
both, and it can compare them, but they arrive through two entirely separate paths
|
||||
inside the browser.
|
||||
|
||||
That separation is exactly what a consistency detector wants. If a stealth layer
|
||||
overrides `screen.colorDepth` in JavaScript to report a plausible 24-bit display, but
|
||||
the CSS side still resolves `color-gamut` against whatever the underlying environment
|
||||
actually has, the two disagree. One code path was patched and the other was not. A
|
||||
real browser cannot produce that disagreement, because both values are read off the
|
||||
same panel. So a page that finds `screen.colorDepth: 24` next to a `color-gamut` that
|
||||
resolves to something else has found a browser whose two halves were configured
|
||||
independently, which is a tell that no single value would have given up.
|
||||
|
||||
The same shape shows up in
|
||||
[the platform and oscpu strings that have to agree with the user agent](navigator-platform-oscpu-consistency.md):
|
||||
individually every value is plausible, and the fingerprint is in whether they line up.
|
||||
A JavaScript-only spoof can set the property a page reads first, and miss the second
|
||||
surface that reports the same underlying fact through CSS.
|
||||
|
||||
## Why a page-level override cannot fix this
|
||||
|
||||
If your approach to fingerprinting is injecting JavaScript, this surface is a problem,
|
||||
because there is nothing in JavaScript's gift to change here. You can redefine
|
||||
`matchMedia` to lie about `color-gamut`, but redefining a built-in is itself one of
|
||||
the loudest tells there is: [CreepJS](how-to-test-bot-detection.md) walks descriptors
|
||||
and prototypes and records a patched built-in by name. And even if you patch
|
||||
`matchMedia`, the pure-CSS path that applies a `@media (color-gamut: ...)` rule
|
||||
without ever calling script is still resolving against the real value. You cannot
|
||||
intercept a stylesheet branch from a `matchMedia` override.
|
||||
|
||||
The only place this can be made consistent is below JavaScript, where the CSS engine
|
||||
and the `screen` object read the same display description. invisible_playwright is a
|
||||
Firefox patched at the C++ level rather than a script injected into a stock browser,
|
||||
so the display it presents is a single coherent object: the color-gamut media feature,
|
||||
`dynamic-range`, `video-dynamic-range` and `screen.colorDepth` all resolve from one
|
||||
plausible Windows sRGB display, the way they do on the real Firefox it is built from.
|
||||
There is no second code path left unpatched, because the value is not being faked at
|
||||
the property level at all.
|
||||
|
||||
This is the same reason [an impossible screen geometry](screen-size-headless-tells.md)
|
||||
survives every page-level spoofer: the surfaces that describe the physical display are
|
||||
not the ones a script can reach.
|
||||
|
||||
## Reading it yourself
|
||||
|
||||
The `browser` returned by invisible_playwright is a real Playwright `Browser`, so you
|
||||
read these features the same way you would in any Playwright script. Launch, open a
|
||||
page, and evaluate the media queries plus the property they have to agree with:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
|
||||
report = page.evaluate("""() => ({
|
||||
colorGamut:
|
||||
matchMedia('(color-gamut: rec2020)').matches ? 'rec2020' :
|
||||
matchMedia('(color-gamut: p3)').matches ? 'p3' :
|
||||
matchMedia('(color-gamut: srgb)').matches ? 'srgb' : 'unknown',
|
||||
dynamicRange:
|
||||
matchMedia('(dynamic-range: high)').matches ? 'high' : 'standard',
|
||||
videoDynamicRange:
|
||||
matchMedia('(video-dynamic-range: high)').matches ? 'high' : 'standard',
|
||||
colorDepth: screen.colorDepth,
|
||||
pixelDepth: screen.pixelDepth,
|
||||
})""")
|
||||
|
||||
print(report)
|
||||
# {'colorGamut': 'srgb', 'dynamicRange': 'standard',
|
||||
# 'videoDynamicRange': 'standard', 'colorDepth': 24, 'pixelDepth': 24}
|
||||
```
|
||||
|
||||
The check that matters is not any single line of that output. It is that
|
||||
`colorGamut: 'srgb'` and `colorDepth: 24` describe the same display, and would still
|
||||
describe the same display if you read them again in the next session. Because the
|
||||
identity is derived from the seed, passing `seed=42` gives you the same display every
|
||||
run, so this is a value you can assert on in a test rather than a moving target. The
|
||||
[reproducible-fingerprint workflow](quickstart.md) is what makes that assertion stable.
|
||||
|
||||
Run it against a stock Firefox on the same machine and diff the two reports field by
|
||||
field. On a real desktop panel they match. The point of the exercise is to confirm the
|
||||
patched build sits on the same side of that diff as the real browser, not on the
|
||||
overcorrected side where a spoof reports a `p3` display no one asked for.
|
||||
|
||||
## The honest limit
|
||||
|
||||
This makes your browser's display self-consistent. It is worth being precise about
|
||||
what that does and does not buy you.
|
||||
|
||||
Color-gamut and dynamic-range are properties of the browser and its claimed hardware.
|
||||
Getting them right removes one way a page distinguishes a real display from a patched
|
||||
one, and it removes it at the layer where it actually lives rather than papering over
|
||||
it in script. That is a real part of why invisible_playwright reads as a genuine
|
||||
Firefox to fingerprint, TLS and driver-layer checks.
|
||||
|
||||
It is not the whole session. These media features say nothing about where your traffic
|
||||
exits or how fast you send it. A perfectly consistent sRGB display on a datacenter
|
||||
address that a scoring service already knows is still on a known address. A browser
|
||||
that fills a form in eighty milliseconds still moves like no human, whatever its
|
||||
color-gamut reports. invisible_playwright does not touch IP reputation, per-account
|
||||
quotas, rate limits, or the timing of your actions, and it does not claim to. Those
|
||||
you supply: a clean residential proxy, human pacing, one account doing one plausible
|
||||
amount of work. The fingerprint is the part that is hard to get right by hand, and it
|
||||
is the part this tool owns; the rest of the session is still yours.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Color-gamut, dynamic-range and video-dynamic-range are a display fingerprint that
|
||||
lives in CSS, readable with no JavaScript, and they have to agree with the
|
||||
`screen.colorDepth` a page reads from script through a completely separate code path.
|
||||
A page-level override touches one path and leaves the other reporting the real
|
||||
environment, which is a contradiction a real browser never produces. invisible_playwright
|
||||
presents a single coherent Windows sRGB display across both paths because it is patched
|
||||
below JavaScript, and it keeps that display stable across runs when you pin the seed.
|
||||
That is worth exactly what it is worth: a browser that looks real, on top of an exit
|
||||
and a rhythm you still have to get right yourself.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Can a website read my display's color gamut without JavaScript?** Yes. The
|
||||
`color-gamut` media feature is resolved by the CSS engine, so a stylesheet can branch
|
||||
on it and observe the result before any script runs.
|
||||
|
||||
**What is the trap with color-gamut and screen.colorDepth?** They describe the same
|
||||
physical display but are read through different code paths. If a spoof patches one and
|
||||
not the other, they disagree, which a real browser never does.
|
||||
|
||||
**Can I fix this by overriding matchMedia?** No. Redefining a built-in is itself a
|
||||
loud tell, and it still does not touch the pure-CSS path that applies a
|
||||
`@media (color-gamut: ...)` rule without calling script.
|
||||
|
||||
**What does invisible_playwright report for these features?** A plausible, consistent
|
||||
Windows sRGB display: `color-gamut: srgb`, `dynamic-range: standard`, and a matching
|
||||
24-bit `screen.colorDepth`, the same as the real Firefox it is built from.
|
||||
|
||||
**Does matching these features make me undetectable?** No. It makes your display
|
||||
self-consistent. It does nothing for your IP reputation, your rate limits or your
|
||||
behaviour, which you still have to handle with a clean proxy and human pacing.
|
||||
|
||||
**Will the same seed give the same color-gamut every run?** Yes. The display is derived
|
||||
from the seed, so `seed=42` reports the same values every session, which is what lets
|
||||
you assert on them in a test.
|
||||
|
||||
## Sources
|
||||
|
||||
- The [Media Queries Level 5 specification](https://www.w3.org/TR/mediaqueries-5/),
|
||||
which defines `color-gamut`, `dynamic-range` and `video-dynamic-range` and their
|
||||
resolution from the output device.
|
||||
- This project's fingerprint gates, which cross-check the CSS-resolved display
|
||||
features against `screen.colorDepth` and the canvas and WebGL persona for the same
|
||||
seed.
|
||||
|
||||
**See also:** [CSS media features as a fingerprint surface](css-media-query-fingerprinting.md),
|
||||
[keeping navigator.platform and oscpu consistent](navigator-platform-oscpu-consistency.md),
|
||||
and [screen sizes that give a headless machine away](screen-size-headless-tells.md).
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The color-gamut and
|
||||
colorDepth disagreement is one I would rather find in my own diff than have a page find
|
||||
for me.*
|
||||
@@ -0,0 +1,211 @@
|
||||
---
|
||||
title: "Combine invisible_playwright with httpx for speed"
|
||||
description: "Clear the fingerprint-gated entry in a real browser, export storage_state, then hand the cookies to httpx for cheap high-volume follow-up requests - and the sharp limit."
|
||||
parent: "Scraping with Playwright"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 89
|
||||
---
|
||||
|
||||
|
||||
# Combine invisible_playwright with httpx for speed
|
||||
|
||||
A browser is expensive. It starts a process, renders a page, runs the site's
|
||||
JavaScript, and holds memory the whole time. If you need one page a minute that is fine.
|
||||
If you need a thousand JSON responses from an endpoint the site already exposes, paying
|
||||
browser cost for each one is the slow way to do it.
|
||||
|
||||
The fast way is a split: use the browser for the part that needs a browser, and use a
|
||||
bare HTTP client for the part that does not. This page shows the handoff concretely -
|
||||
export the session the browser established, hand it to `httpx`, and let `httpx` do the
|
||||
bulk - and it is equally clear about the one boundary where the trick stops working,
|
||||
because that boundary is the whole skill.
|
||||
|
||||
## Why the browser clears the door and httpx does not
|
||||
|
||||
`invisible_playwright` is a Firefox patched at the C++ level and driven by stock
|
||||
Playwright. It is built to look like a real browser driven by a real person: the
|
||||
fingerprint, the TLS handshake and the driver layer all read as a genuine Firefox, which
|
||||
is why it clears the checks that turn plain automation away at the door. That is the
|
||||
part you cannot fake with a bare HTTP client. An endpoint that inspects the JavaScript
|
||||
fingerprint, or reads the TLS handshake, expects a browser to be on the other end.
|
||||
|
||||
`httpx` is the opposite tool on purpose. It is a fast, async-capable Python HTTP client
|
||||
with no JavaScript engine and no browser TLS stack. It sends a plain client handshake and
|
||||
whatever headers you give it, and nothing else. That is exactly why it is cheap, and
|
||||
exactly why it cannot pass a fingerprint check. It has no fingerprint to present.
|
||||
|
||||
So the division is not a hack, it is the honest shape of the problem. The browser is for
|
||||
the fingerprint-gated fetches. `httpx` is for the unguarded bulk. Knowing which endpoint
|
||||
is which is the entire exercise, and most of this page is about telling them apart.
|
||||
|
||||
## Establish the session in the browser
|
||||
|
||||
First, do the guarded part properly: launch the real browser, clear whatever gates the
|
||||
entry (a login, a challenge page, a first navigation that sets a session cookie), and let
|
||||
it settle. Switching from plain Playwright is two lines, and the object you get back is a
|
||||
real Playwright `Browser`, so every method below is the stock API:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright(seed=42, proxy={
|
||||
"server": "socks5://gate.example.com:1080",
|
||||
"username": "u", "password": "p",
|
||||
}) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com/app")
|
||||
# ... do whatever establishes the session: submit a form, pass an
|
||||
# interactive check, land on the page that issues the session cookie ...
|
||||
page.wait_for_load_state("networkidle")
|
||||
```
|
||||
|
||||
The seed is not decoration here. It pins the identity, so the fingerprint that created
|
||||
this session is reproducible - which matters the moment you reuse the session, because a
|
||||
reused session is still tied to the machine that created it. That coupling is the subject
|
||||
of [why reusing a session beats re-automating the login form](automating-login-vs-session-reuse.md).
|
||||
|
||||
## Export storage_state and hand it to httpx
|
||||
|
||||
Playwright already has the export you need.
|
||||
[`context.storage_state()`](https://playwright.dev/python/docs/api/class-browsercontext#browser-context-storage-state)
|
||||
returns the cookies and local storage the session accumulated, in a plain dict. Capture it
|
||||
while the browser is still open:
|
||||
|
||||
```python
|
||||
state = page.context.storage_state()
|
||||
# state == {"cookies": [{"name": ..., "value": ..., "domain": ...}, ...],
|
||||
# "origins": [{"origin": ..., "localStorage": [...]}, ...]}
|
||||
```
|
||||
|
||||
Now the browser has done its job. Everything after this can happen in a cheap client. Map
|
||||
the cookies into an `httpx.Client` and fire the follow-up requests concurrently:
|
||||
|
||||
```python
|
||||
import httpx
|
||||
|
||||
cookies = httpx.Cookies()
|
||||
for c in state["cookies"]:
|
||||
cookies.set(c["name"], c["value"], domain=c["domain"], path=c.get("path", "/"))
|
||||
|
||||
# route httpx through the SAME exit the browser used, see the caveat below
|
||||
proxy = "socks5://u:p@gate.example.com:1080"
|
||||
|
||||
with httpx.Client(cookies=cookies, proxy=proxy, http2=True,
|
||||
headers={"User-Agent": page.evaluate("navigator.userAgent")}) as client:
|
||||
for page_num in range(1, 200):
|
||||
r = client.get(f"https://example.com/api/items?page={page_num}")
|
||||
r.raise_for_status()
|
||||
handle(r.json())
|
||||
```
|
||||
|
||||
Two hundred JSON pages just came back without starting two hundred browsers. If the bulk
|
||||
endpoint returns the same data the page renders, this is also the moment to stop parsing
|
||||
HTML and read the response directly, the same idea covered in
|
||||
[capturing XHR and API responses](how-to-capture-xhr-api-responses-playwright.md).
|
||||
|
||||
## The boundary: any endpoint that re-checks the fingerprint rejects the httpx leg
|
||||
|
||||
Here is the sharp edge, and it is not negotiable. `httpx` carries the cookies but sends
|
||||
no browser fingerprint. It presents a plain TLS handshake and no JavaScript surface at
|
||||
all. So the handoff works on exactly one kind of endpoint: one that trusts the cookie and
|
||||
does not re-inspect the caller.
|
||||
|
||||
Plenty of endpoints are like that. A paginated data API behind a session cookie, a
|
||||
download URL, an internal JSON route the page itself calls - these usually check that you
|
||||
hold a valid session and nothing more. The `httpx` leg sails through.
|
||||
|
||||
But some endpoints re-run the check on every request. They read the TLS handshake, or
|
||||
require a token that only the site's JavaScript can mint, or expect a browser-shaped
|
||||
request signature alongside the cookie. Against those, the cookie is necessary but not
|
||||
sufficient, and the bare client is refused - often with a `403` or a challenge page
|
||||
where the browser got JSON. There is no client-side trick that gives `httpx` a browser
|
||||
handshake; if the endpoint re-checks the fingerprint, that endpoint stays in the browser.
|
||||
|
||||
The way you find the boundary is empirical and cheap: send one `httpx` request to the
|
||||
target endpoint with the exported cookies. If it returns the same body the browser got,
|
||||
that endpoint is safe to bulk. If it returns a challenge, an error, or a suspiciously
|
||||
short body, it is a re-checked endpoint and it belongs in the browser leg. Test one
|
||||
before you loop over a thousand.
|
||||
|
||||
## What this speeds up, and what it does not touch
|
||||
|
||||
The split is a cost optimization, not a stealth upgrade. It makes a workload cheaper by
|
||||
moving the unguarded requests off the browser. It does nothing for the four things that
|
||||
block sessions independently of the fingerprint, and moving traffic to `httpx` can make
|
||||
some of them worse if you are not careful:
|
||||
|
||||
- **IP reputation.** Route `httpx` through the same clean exit the browser used. If the
|
||||
bulk requests go out from your datacenter host directly while the browser used a
|
||||
residential proxy, you have split the session across two addresses, which is its own
|
||||
signal. Same exit for both legs.
|
||||
- **Rate limits and per-account quotas.** Two hundred requests in two seconds from one
|
||||
session is a velocity signal no fingerprint hides. Pace the `httpx` loop. The browser
|
||||
being invisible does not raise the account's quota.
|
||||
- **Timezone and locale consistency.** The session was created with a browser identity
|
||||
tied to the exit; keep the follow-up on the same exit so the story stays coherent, the
|
||||
same failure mode described in [timezone and proxy mismatch](timezone-proxy-mismatch.md).
|
||||
- **Behaviour on the guarded leg.** The browser still has to pass the guarded entry
|
||||
convincingly. The speed trick only applies after that door is open.
|
||||
|
||||
`invisible_playwright` gives you the browser that looks real. You supply the clean exit,
|
||||
the human pacing, and the judgement about which endpoints can leave the browser. The tool
|
||||
does one job well and is honest about the rest.
|
||||
|
||||
## Conclusion
|
||||
|
||||
The hybrid pattern is simple once the boundary is clear. The browser establishes the
|
||||
session because only a browser presents a real fingerprint and TLS handshake. You export
|
||||
`storage_state`, hand the cookies to `httpx`, and let the cheap client do the
|
||||
high-volume follow-up - but only against endpoints that trust the cookie and do not
|
||||
re-inspect the caller. The moment an endpoint re-checks the fingerprint, that request
|
||||
goes back into the browser, where the fingerprint lives. Test one request before you loop,
|
||||
keep both legs on the same clean exit, and pace the bulk. That is the whole method.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Can I do all my scraping with httpx and skip the browser?** Only for endpoints that do
|
||||
not check a fingerprint. The browser exists to clear the ones that do; `httpx` has no
|
||||
fingerprint to present, so anything that re-checks one will refuse it.
|
||||
|
||||
**How do I move a logged-in session from the browser to httpx?** Call
|
||||
`page.context.storage_state()` while the browser is open, then set its cookies on an
|
||||
`httpx.Client`. The cookies carry the session; the handshake does not.
|
||||
|
||||
**Why does httpx get a 403 where the browser got JSON?** That endpoint re-checks the
|
||||
caller, not just the cookie. It reads the TLS handshake or wants a browser-minted token.
|
||||
Keep that request in the browser.
|
||||
|
||||
**Do I need the same proxy for both legs?** Yes. Split the session across two exit
|
||||
addresses and you have created a mismatch signal. Route `httpx` through the same exit the
|
||||
browser used.
|
||||
|
||||
**Does this make me undetectable?** No, and nothing does. It is a speed optimization. It
|
||||
does not fix IP reputation, account quotas, rate limits, or behaviour - you supply a
|
||||
clean exit and human pacing for those.
|
||||
|
||||
**How do I know which endpoints are safe to bulk?** Send one `httpx` request with the
|
||||
exported cookies and compare the body to what the browser got. Same body, safe to loop.
|
||||
Challenge or short body, keep it in the browser.
|
||||
|
||||
## Sources
|
||||
|
||||
- The real `invisible_playwright` API as documented in
|
||||
[Quickstart](quickstart.md) and [Configuration](configuration.md): the two-line launch,
|
||||
the reproducible seed, and the proxy dict both legs must share.
|
||||
- Playwright's own
|
||||
[`context.storage_state()`](https://playwright.dev/python/docs/api/class-browsercontext#browser-context-storage-state),
|
||||
which returns cookies and local storage as a plain dict, working exactly as documented
|
||||
upstream because the object handed back is a real Playwright `Browser`.
|
||||
- This project's own practice of testing one request against the boundary before looping,
|
||||
the same empirical habit the rest of these notes are built on.
|
||||
|
||||
**See also:** [why reusing a session beats re-automating the login](automating-login-vs-session-reuse.md)
|
||||
and [how to capture XHR and API responses](how-to-capture-xhr-api-responses-playwright.md)
|
||||
for reading the JSON the page already fetches.
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The browser is for the
|
||||
fingerprint-gated fetches, httpx is for the unguarded bulk, and telling them apart is the
|
||||
whole job.*
|
||||
@@ -0,0 +1,68 @@
|
||||
---
|
||||
title: "Comparisons"
|
||||
description: "invisible_playwright against the closest alternatives at each layer - Camoufox, Patchright, nodriver, playwright-stealth - plus the engine question underneath all of them: Firefox or Chromium."
|
||||
has_children: true
|
||||
nav_order: 4
|
||||
---
|
||||
|
||||
# Comparisons
|
||||
|
||||
Most comparisons in this space put tools side by side that are not actually
|
||||
comparable: a page-level script against a patched binary, a Chromium tool against a
|
||||
Firefox one. These pages try not to do that. Each one names the layer the comparison
|
||||
actually happens at, states plainly where the other tool covers more, and does not
|
||||
claim an advantage it could not verify against the other project's own source or
|
||||
documentation.
|
||||
|
||||
Start with [Three ways to make Playwright undetected](playwright-stealth-levels.md)
|
||||
if you want the map before the individual matchups - it's the frame every comparison
|
||||
below sits inside.
|
||||
|
||||
## Concepts and the map
|
||||
|
||||
- [Three ways to make Playwright undetected](playwright-stealth-levels.md) - The three levels stealth tools work at - page, driver, engine - and what each reaches.
|
||||
- [Firefox or Chromium for anti-detect automation](firefox-vs-chromium-antidetect.md) - No CDP surface and one identity, traded against Firefox's smaller traffic share.
|
||||
- [Chromium is not Chrome, and detectors know the difference](chromium-is-not-chrome.md) - Chrome for Testing plays H.264 but fails a Widevine DRM check no patch closes.
|
||||
- [WebDriver BiDi vs CDP: does the new protocol hide you](bidi-vs-cdp-detection.md) - BiDi standardizes the control wire, but automation leaks live in the page, not the protocol.
|
||||
- [Do I need an anti-detect browser or just Playwright?](do-i-need-an-antidetect-browser.md) - What a paid anti-detect GUI adds over stock Playwright driving a patched Firefox.
|
||||
- [Migrating from Puppeteer to Playwright for stealth](migrate-puppeteer-to-playwright-stealth.md) - The near one-to-one API mapping, and what changes for detection off the CDP stack.
|
||||
- [Migrating from Selenium to Playwright for stealth](migrate-selenium-to-playwright-stealth.md) - Map driver.get and find_element to page.goto and locators, dropping the WebDriver server.
|
||||
|
||||
## Patched-engine, driver-patch and stealth-plugin tools
|
||||
|
||||
- [invisible_playwright vs Camoufox: two patched Firefoxes](vs-camoufox.md) - Both patch Firefox in C++; how each builds its fingerprint and whether a run replays.
|
||||
- [invisible_playwright vs Patchright: driver vs engine](vs-patchright.md) - Patchright patches the Playwright driver on Chromium; this patches Firefox itself. Often you need both.
|
||||
- [invisible_playwright vs rebrowser-patches: the same CDP fix](vs-rebrowser-patches.md) - Fixes the Runtime.enable CDP leak on Chromium; reaches neither Firefox nor fonts, GPU, canvas, audio.
|
||||
- [undetected-playwright vs a patched Firefox binary](vs-undetected-playwright.md) - Hides Playwright's init-script and bindings tells; a patched Firefox closes the fingerprint layer.
|
||||
- [invisible_playwright vs playwright-stealth: page vs engine](vs-playwright-stealth.md) - playwright-stealth patches the page in about four lines; this rebuilds the engine.
|
||||
- [playwright-extra stealth plugins vs a patched browser](vs-playwright-extra-stealth.md) - Applies stealth plugins as injected JavaScript a detector reads back; a patched engine compiles them in.
|
||||
- [invisible_playwright vs fingerprint-suite: injection vs engine](vs-fingerprint-suite.md) - fingerprint-suite injects a generated fingerprint into a page; this sets it in the engine.
|
||||
- [invisible_playwright vs playwright-with-fingerprints](vs-playwright-with-fingerprints.md) - Injects remote-service fingerprints into a Windows-only, ageing Chromium build, and what that trade costs.
|
||||
- [puppeteer-real-browser vs invisible_playwright](vs-puppeteer-real-browser.md) - Node plus real Chrome with runtime property patches vs Python plus Firefox with compiled spoofs.
|
||||
|
||||
## CDP and driverless Chrome tools
|
||||
|
||||
- [invisible_playwright vs nodriver and undetected-chromedriver](vs-nodriver.md) - Chrome-only tools, not Playwright forks; neither hides IP or fingerprint, by their own docs.
|
||||
- [pydoll vs invisible_playwright: CDP without a driver](vs-pydoll.md) - pydoll drives Chrome over CDP with no chromedriver; this ships seed-consistent Firefox surfaces.
|
||||
- [zendriver vs invisible_playwright: Chrome CDP vs Firefox](vs-zendriver.md) - zendriver drives Chrome over CDP; this drives a patched Firefox with cross-checked surfaces.
|
||||
- [selenium-driverless vs invisible_playwright stealth](vs-selenium-driverless.md) - Drops chromedriver by driving Chrome over raw CDP but leaves rendering and TLS stock.
|
||||
- [invisible_playwright vs SeleniumBase UC Mode](vs-seleniumbase-uc-mode.md) - UC Mode detaches chromedriver but never changes the engine, GPU, fonts, canvas or TLS.
|
||||
- [undetected-chromedriver vs a patched Firefox browser](vs-undetected-chromedriver.md) - Strips the driver's cdc_ and webdriver leaks but ships a stock Chromium fingerprint.
|
||||
- [invisible_playwright vs Ulixee Hero](vs-ulixee-hero.md) - Replayed emulation on stock Chromium vs a fingerprint decided natively in patched Firefox.
|
||||
|
||||
## Non-Playwright frameworks and HTTP-client libraries
|
||||
|
||||
- [botasaurus vs invisible_playwright: framework vs library](vs-botasaurus.md) - Batteries-included Chrome scraping framework vs a patched-Firefox engine driven with stock Playwright.
|
||||
- [invisible_playwright vs Scrapling](vs-scrapling.md) - Scrapling is an adaptive parser, not a stealth engine; its ceiling is whichever browser it wraps.
|
||||
- [scrapy-playwright vs a patched Firefox for stealth](vs-scrapy-playwright.md) - Runs stock Playwright inside Scrapy; point the handler at a patched Firefox and keep the scheduler.
|
||||
- [invisible_playwright vs DrissionPage](vs-drission-page.md) - Fuses an HTTP session mode and a CDP browser mode, each failing a different check half.
|
||||
- [curl_cffi vs invisible_playwright: TLS client vs browser](vs-curl-cffi.md) - Replays a browser's TLS and HTTP/2 at byte level but runs no JavaScript.
|
||||
- [invisible_playwright vs hrequests](vs-hrequests.md) - A hybrid TLS-impersonating HTTP client plus a browser mode with injected fingerprints.
|
||||
- [tls-client vs a real browser: when TLS is enough](vs-tls-client.md) - When JA3/HTTP2 socket spoofing suffices on JSON and HTML, and where JS forces a full browser.
|
||||
|
||||
## Unmaintained tools
|
||||
|
||||
- [puppeteer-extra-plugin-stealth: unmaintained since 2024](puppeteer-extra-stealth-unmaintained.md) - No real update since mid-2024; old patches still work but the checklist froze.
|
||||
- [pyppeteer's own maintainer says to switch to Playwright](pyppeteer-unmaintained-playwright.md) - Its README calls it unmaintained and points to playwright-python; what switching does not fix.
|
||||
- [selenium-stealth hasn't been updated since December 2021](selenium-stealth-unmaintained.md) - Last commit December 2021; what its property patches still do and what to check today.
|
||||
- [Splash is unmaintained, and it was never a real browser](splash-unmaintained-qtwebkit.md) - A QtWebKit render service reporting an engine no real browser ships, which no spoof reaches.
|
||||
@@ -0,0 +1,199 @@
|
||||
---
|
||||
title: "Computer-use agents and browser fingerprint detection"
|
||||
description: "Computer-use agents click by pixel, not DOM, so driver flags are moot for them. Engine fingerprint and action rhythm remain the detectable signals."
|
||||
parent: "AI Agents and Frameworks"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 6
|
||||
---
|
||||
|
||||
|
||||
# Computer-use agents and browser fingerprint detection
|
||||
|
||||
A computer-use agent (CUA) does not read the DOM to decide where to act. It takes a
|
||||
screenshot, sends the image to a vision model, gets back a pixel coordinate, clicks
|
||||
there, and takes another screenshot. That loop is the whole architecture of OpenAI's
|
||||
Computer-Using Agent and of Anthropic's computer-use tool, and it changes which
|
||||
detection signals matter and which stop mattering.
|
||||
|
||||
This page is about that shift: why the automation flags people usually worry about are
|
||||
moot for a coordinate agent, what is still checkable underneath it, and where
|
||||
invisible_playwright helps and where you still have to do the work yourself.
|
||||
|
||||
## Why the driver flags stop mattering
|
||||
|
||||
A CUA never triggers the DOM-automation flags sites check for, because its click is a
|
||||
coordinate delivered through the input pipeline the same way a real click is, not a
|
||||
script reaching into the page. Most bot-detection advice targets that automation layer
|
||||
anyway: `navigator.webdriver`, leftover automation globals, DOM mutations that only a
|
||||
driver produces, an untrusted event dispatched from code rather than from hardware.
|
||||
Those signals exist because a selector-driven script reaches into the page and touches
|
||||
elements directly.
|
||||
|
||||
A CUA does not do that. It never calls `querySelector`, never sets an element's
|
||||
value from script, never dispatches a synthetic event at a node it located by selector.
|
||||
So the whole family of DOM-automation tells is [mostly not the thing that catches
|
||||
it](navigator-webdriver-explained.md) - not because the agent hides them, but because
|
||||
it never generates them in the first place.
|
||||
|
||||
That is the part people get wrong. They read that agents are hard to detect and assume
|
||||
the fingerprint is solved. It is not solved. It is bypassed by the input method, and
|
||||
two other surfaces are completely untouched by that fact.
|
||||
|
||||
## What stays checkable: the engine fingerprint
|
||||
|
||||
The agent clicks by coordinate, but the click still lands in a browser, and that
|
||||
browser answers JavaScript. The site's own scripts still ask the engine what it is:
|
||||
the WebGL renderer string, the canvas hash, the audio context, the installed fonts, the
|
||||
screen geometry, the codec list. None of that goes through the DOM the agent avoids. It
|
||||
goes through the ordinary JS surface every page can read, and a stock automation build
|
||||
running on a server answers those questions like a server.
|
||||
|
||||
This is the surface invisible_playwright is built for. It is a Firefox patched at the
|
||||
C++ level so the engine renders like a real Windows Firefox: the GPU strings, the
|
||||
canvas and audio hashes, the font set and the screen all report values a real desktop
|
||||
would report, derived from one seed so they stay consistent with each other. A
|
||||
detector cross-checking those fields against one another finds agreement instead of the
|
||||
contradictions a [half-patched or double-patched stack](playwright-stealth-levels.md)
|
||||
produces.
|
||||
|
||||
The two-line launch is the same whether a human or a vision model drives it:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
# seed=42 makes the whole fingerprint reproducible run to run
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
|
||||
# the screenshot -> click(x, y) -> screenshot loop a CUA runs
|
||||
png = page.screenshot() # frame you hand to the vision model
|
||||
x, y = 480, 320 # coordinate the model returns
|
||||
page.mouse.click(x, y) # lands through the real input pipeline
|
||||
png = page.screenshot() # next frame
|
||||
```
|
||||
|
||||
`browser` here is a real Playwright `Browser`, so
|
||||
[`page.screenshot()`](https://playwright.dev/python/docs/api/class-page#page-screenshot)
|
||||
and [`page.mouse.click()`](https://playwright.dev/python/docs/api/class-mouse#mouse-click)
|
||||
are the ordinary documented methods - the same ones a coordinate-clicking agent already
|
||||
calls. There is no special CUA API to adopt. You feed the screenshot to whatever model
|
||||
you use and feed its coordinate back to `page.mouse.click`.
|
||||
|
||||
## What stays checkable: the action rhythm
|
||||
|
||||
The second surface the input method does not fix is timing, and it is the one specific
|
||||
to agents.
|
||||
|
||||
A CUA's loop has a shape. Screenshot, then a pause while a model processes the image and
|
||||
decides, then a click, then another screenshot. That thinking pause is roughly the same
|
||||
length every step because it is model latency, not human hesitation, and it repeats with
|
||||
a regularity no person produces. A human pause varies with what is on screen, drifts,
|
||||
gets distracted, double-checks. A model's pause is a distribution centered on its
|
||||
inference time.
|
||||
|
||||
invisible_playwright gives the pointer a Bezier-curve path between coordinates rather
|
||||
than a teleport, which removes the crudest motion tell. It does not reshape the
|
||||
step-to-step rhythm of your agent loop, because that rhythm is produced by your model
|
||||
and your code, not by the browser. If your loop clicks every 1.9 seconds because that is
|
||||
how long the model takes, the engine cannot know to vary it. You add the variance:
|
||||
jitter the delay between steps, and do not click the instant a screenshot returns. This
|
||||
is [the pause shaped like model latency](ai-browser-agents-stealth.md), and it is
|
||||
behaviour, which no fingerprint layer reaches.
|
||||
|
||||
## What invisible_playwright does not do
|
||||
|
||||
Being honest about the boundary is the point, because a coordinate agent makes it easy
|
||||
to believe more is handled than actually is.
|
||||
|
||||
- **It does not change your IP.** The engine can look like a real Windows desktop and
|
||||
still be sitting on a datacenter address that a site distrusts on sight. A perfect
|
||||
fingerprint on a known-bad exit still loses. Bring a clean proxy; the engine cannot
|
||||
supply one.
|
||||
- **It does not fix per-account quotas or rate limits.** Those are counted server-side
|
||||
against your account and address, and no browser property touches them.
|
||||
- **It does not pace your agent.** The step rhythm above is yours to vary. The engine
|
||||
handles the pointer path, not the schedule your loop runs on.
|
||||
- **It does not see the DOM for you.** A CUA works by pixels precisely because it does
|
||||
not read structure. invisible_playwright does not add DOM understanding; it makes the
|
||||
browser those pixels are rendered in look real.
|
||||
|
||||
What it does do is remove the engine fingerprint from the list of things that give you
|
||||
away, so that TLS, the driver layer and the render surface read as a genuine Firefox.
|
||||
That is why it passes most fingerprint checks. It is not why a session with a bad IP and
|
||||
a metronome rhythm passes, because it does not claim to fix those.
|
||||
|
||||
## A measurement worth trusting more than a verdict
|
||||
|
||||
The useful test for a CUA setup is not "did the suite say human". It is a field-by-field
|
||||
comparison against a stock browser on the same machine, because the agent's own loop can
|
||||
introduce timing the browser knows nothing about.
|
||||
|
||||
Open a fingerprinting page under invisible_playwright and under a stock Firefox on the
|
||||
same host, and diff the reports. On the engine surface the two should agree: same GPU
|
||||
family, a canvas hash that is stable across two reads in the same session (a hash that
|
||||
changes per call is [a randomiser announcing itself](canvas-fingerprint-noise.md)), a
|
||||
font list that belongs to the platform the user agent claims. Where they still differ,
|
||||
after the address, is your candidate. A [software WebGL renderer or a
|
||||
datacenter-shaped machine](playwright-docker-detection.md) survives every property patch
|
||||
because it is not the engine's to change, and it is the most common reason a clean-looking
|
||||
agent still gets a different page. Run it ten times, not once, because this domain is not
|
||||
deterministic and a single green run is not a pass.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Vision and coordinate agents move the detection problem, they do not remove it. The
|
||||
DOM-automation flags that dominate ordinary Playwright advice are moot for them, because
|
||||
a click delivered by pixel never generates those flags. What remains is the engine
|
||||
fingerprint the site reads through its own JavaScript, and the machine-regular rhythm of
|
||||
the screenshot-click loop. invisible_playwright answers the first: it makes the browser
|
||||
render like a real Windows Firefox, seed-reproducible and self-consistent. The second is
|
||||
yours - vary the timing - and so is the IP - bring a clean one. Handle all three and the
|
||||
agent looks like a person on a real machine. Handle only the browser and you have a real
|
||||
browser clicking like a robot.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Do computer-use agents get detected as bots?** Not usually through `navigator.webdriver`
|
||||
or DOM automation flags, because a coordinate click never produces them. They get caught
|
||||
on the engine fingerprint, on the IP, or on the regular timing of the screenshot-click
|
||||
loop.
|
||||
|
||||
**Does invisible_playwright work with OpenAI or Anthropic computer-use?** Yes. It returns
|
||||
a real Playwright `Browser`, so `page.screenshot()` and `page.mouse.click(x, y)` - the
|
||||
two calls a coordinate agent needs - work exactly as documented, on a Firefox that
|
||||
renders like a real Windows desktop.
|
||||
|
||||
**If the agent clicks by pixel, is the fingerprint irrelevant?** No. The click method
|
||||
avoids DOM tells, but the site still reads the engine through JavaScript. GPU, canvas,
|
||||
audio, fonts and screen are all still checkable, and a stock server build answers them
|
||||
like a server.
|
||||
|
||||
**Will it stop my agent being rate-limited?** No. Quotas and rate limits are counted
|
||||
server-side against your account and address. No browser property changes them.
|
||||
|
||||
**How do I make the timing look human?** Jitter the delay between loop steps and do not
|
||||
click the instant a screenshot returns. The engine varies the pointer path; the
|
||||
step-to-step rhythm is produced by your model and your code, so you vary that.
|
||||
|
||||
**Does it fix my IP?** No. It makes the browser look real; it does not change the exit.
|
||||
A real-looking browser on a datacenter address still loses, so bring a clean proxy.
|
||||
|
||||
## Sources
|
||||
|
||||
- OpenAI's Computer-Using Agent and Anthropic's computer-use tool, both of which drive a
|
||||
browser through a screenshot to coordinate-click to screenshot loop rather than by DOM
|
||||
selector.
|
||||
- This project's own fingerprint gates and the stock-browser comparison method used to
|
||||
separate an engine tell from a machine tell from a timing tell.
|
||||
|
||||
**See also:** [AI browser agents and stealth](ai-browser-agents-stealth.md) for the
|
||||
agent-specific timing tell in depth, [browser-use and what you can change](browser-use-detection.md)
|
||||
for a selector-driven agent by contrast, and [why you can be blocked with a clean
|
||||
fingerprint](why-blocked-with-a-clean-fingerprint.md) for the surfaces past the browser.
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The engine makes the
|
||||
browser real; the pacing and the proxy are still yours to bring.*
|
||||
@@ -0,0 +1,139 @@
|
||||
---
|
||||
title: "Configuration"
|
||||
description: "Proxy schemes, DNS handling, and timezone auto-derived from egress IP. Every environment variable the wrapper reads, what each does, and when you need it."
|
||||
parent: "Documentation"
|
||||
nav_order: 3
|
||||
---
|
||||
|
||||
|
||||
# Configuration
|
||||
|
||||
Configuration covers three independent surfaces: proxy schemes and credentials, how
|
||||
the browser's timezone is derived from the egress IP, and the environment variables
|
||||
that change caching, binary selection and download behavior. None of it is required
|
||||
for a first run - `InvisiblePlaywright()` works with defaults - but each setting below
|
||||
exists because a specific situation needs it.
|
||||
|
||||
## Proxies
|
||||
|
||||
```python
|
||||
proxy = {
|
||||
"server": "socks5://gate.example.com:1080",
|
||||
"username": "user",
|
||||
"password": "pass",
|
||||
}
|
||||
with InvisiblePlaywright(proxy=proxy) as browser:
|
||||
...
|
||||
```
|
||||
|
||||
Schemes supported: `socks5`, `socks4`, `http`, `https`. DNS is routed through the
|
||||
proxy by default, no local leak - the SOCKS5-authentication and DNS-resolution
|
||||
details, including the parts most guides get wrong, are in
|
||||
[Playwright SOCKS5 proxy with authentication](playwright-socks5-proxy-authentication.md).
|
||||
The endpoint needs an explicit port. `socks5://gate.example.com` with no `:1080` is
|
||||
refused with a `ValueError` rather than launched unproxied, which is what it used to
|
||||
do silently. If you are driving `firefox.launch()` yourself instead of using this
|
||||
class, pass the same dict to `get_default_stealth_prefs(proxy=...)` so the SOCKS
|
||||
preferences are written.
|
||||
|
||||
Around 90% of proxies are public, so their IPs are already known and blocked before
|
||||
you ever use them. A perfect browser on a known IP still loses. For the clean 10%,
|
||||
residential IPs that aren't already known, we recommend
|
||||
[sx.org](https://sx.org/?c=invisible_playwright), who filter for and serve only IPs
|
||||
that aren't already on those lists.
|
||||
|
||||
## Timezone
|
||||
|
||||
The browser timezone follows `timezone=`:
|
||||
|
||||
```python
|
||||
# default: timezone is auto-derived from the egress IP (proxy egress if a
|
||||
# proxy is set, otherwise the host's own public IP)
|
||||
with InvisiblePlaywright(proxy=proxy) as browser:
|
||||
...
|
||||
|
||||
# explicit IANA zone always wins, the only way to force a specific zone
|
||||
with InvisiblePlaywright(proxy=proxy, timezone="America/New_York") as browser:
|
||||
...
|
||||
```
|
||||
|
||||
Timezone is not one value - it is several surfaces that a detector cross-checks
|
||||
against each other and against your exit IP, which is why
|
||||
[setting `timezone_id` and still getting flagged for a mismatch](timezone-proxy-mismatch.md)
|
||||
is common enough to have its own page.
|
||||
|
||||
## Environment variables
|
||||
|
||||
The engine downloads itself on first use, verifies a sha256 shipped inside
|
||||
`invisible-core`, and caches it - the size is on the [installation](installation.md)
|
||||
page and it happens once per engine version. None of these are a required step; each
|
||||
row is for a specific situation.
|
||||
|
||||
| Variable | When you need it |
|
||||
|---|---|
|
||||
| `INVISIBLE_PLAYWRIGHT_CACHE_DIR` | Put the cached engine somewhere else - another drive, a shared location, a path your CI already caches |
|
||||
| `INVPW_BINARY_PATH` | Point at a binary you already have, and skip the download |
|
||||
| `STEALTHFOX_GITHUB_TOKEN` | A rate-limited or corporate network that refuses anonymous GitHub downloads |
|
||||
| `INVISIBLE_PLAYWRIGHT_SKEW=allow` | Run a Playwright version outside the tested range anyway |
|
||||
| `INVPW_CURSOR_ENGINE` | `python` (default), `binary`, or `off` |
|
||||
| `INVISIBLE_DOWNLOAD_DEADLINE` | Seconds allowed for one engine download, default `1800`. Raise it on a very slow link; `0` removes the bound |
|
||||
|
||||
```bash
|
||||
export INVISIBLE_PLAYWRIGHT_CACHE_DIR=/mnt/big/engines
|
||||
```
|
||||
|
||||
### Why the download has a deadline at all
|
||||
|
||||
`requests` timeouts are per socket operation, not per transfer. A connection
|
||||
that delivers one byte every 59 seconds satisfies a 60-second timeout forever,
|
||||
so before `invisible-core` 18.13.0 the engine download had no upper limit: it
|
||||
could sit there as long as whatever was above it allowed. A CI job did exactly
|
||||
that for 39 minutes and was killed by its own limit; on a laptop the same thing
|
||||
is a launch that never returns and writes nothing to a log.
|
||||
|
||||
The bound is checked between chunks and the refusal names the deadline, how long
|
||||
it had been running and how many bytes arrived, so a genuinely slow link is
|
||||
distinguishable from a stalled one. The engine archives are 217 to 238 MB
|
||||
depending on platform, so the default finishes anything above roughly 140 KB/s.
|
||||
If your connection is honestly slower than that, raise the number rather than
|
||||
removing the bound - `0` is there for the case where you are downloading over
|
||||
something too unusual to put a number on, and it restores the old behaviour of
|
||||
waiting indefinitely.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**What proxy schemes does invisible_playwright support?** `socks5`, `socks4`, `http`
|
||||
and `https`. DNS resolves through the proxy by default, and an endpoint given
|
||||
without an explicit port raises a `ValueError` instead of launching unproxied.
|
||||
|
||||
**How is the browser's timezone chosen?** By default it is derived from the egress
|
||||
IP - the proxy's exit if one is set, otherwise the host's own public IP. Pass an
|
||||
explicit IANA zone such as `timezone="America/New_York"` to override it; an explicit
|
||||
zone always wins.
|
||||
|
||||
**Do I need to set any environment variables to use invisible_playwright?** No. Every
|
||||
one in the table above addresses a specific situation - moving the cache directory,
|
||||
pointing at a binary you already have, a network that blocks anonymous downloads -
|
||||
and the defaults work without touching any of them.
|
||||
|
||||
**Why does the engine download have a deadline, and can I remove it?** Because a
|
||||
per-socket timeout does not bound a slow transfer: a connection delivering one byte
|
||||
every 59 seconds satisfies a 60-second timeout forever. The default of 1800 seconds
|
||||
covers any link above roughly 140 KB/s; set `INVISIBLE_DOWNLOAD_DEADLINE=0` to remove
|
||||
the bound entirely if your connection is genuinely slower than that.
|
||||
|
||||
**What happens if I pass a proxy server with no port?** The constructor raises a
|
||||
`ValueError` rather than launching the browser unproxied. That is a deliberate change
|
||||
from older behavior, which used to launch silently without the proxy.
|
||||
|
||||
**See also:** [Installation](installation.md) for the one-time engine download these
|
||||
environment variables configure, [Pinning fingerprint fields](pinning.md) for forcing
|
||||
specific values like GPU or screen size, and
|
||||
[Playwright SOCKS5 proxy with authentication](playwright-socks5-proxy-authentication.md)
|
||||
for the full detail behind the proxy schemes above.
|
||||
|
||||
## Next
|
||||
|
||||
[Pinning fingerprint fields](pinning.md) covers forcing specific values - a GPU
|
||||
model, a screen size, a hardware concurrency count - while leaving everything else
|
||||
seed-derived, and what breaks if you pin one field without its correlated neighbours.
|
||||
@@ -0,0 +1,193 @@
|
||||
---
|
||||
title: "crawl4ai stealth mode and custom browser engines"
|
||||
description: "crawl4ai accepts browser_type firefox but has no executable_path, so you get Playwright's managed build. Where the adapter seam is and what stealth misses."
|
||||
parent: "AI Agents and Frameworks"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 3
|
||||
---
|
||||
|
||||
|
||||
# crawl4ai stealth mode and custom browser engines
|
||||
|
||||
crawl4ai cannot launch a custom (patched) browser binary today, because its
|
||||
`BrowserConfig` has no `executable_path` field, so `browser_type="firefox"` always gets
|
||||
Playwright's own managed Firefox build. crawl4ai ships two anti-detection features and a
|
||||
browser abstraction, which makes it look like a patched engine should drop straight in.
|
||||
It does not, and the reason is that single missing field rather than an architectural one.
|
||||
|
||||
This page is what its configuration actually exposes, what its stealth mode reaches,
|
||||
where the adapter seam is, the workaround that works today, and the part that no
|
||||
configuration changes.
|
||||
|
||||
## What BrowserConfig exposes, and the field that is missing
|
||||
|
||||
`BrowserConfig` exposes the browser choice, headless mode, a user data directory, a proxy
|
||||
and extra arguments, but not the path to a binary. Read from
|
||||
`crawl4ai/async_configs.py`:
|
||||
|
||||
| Field | Default |
|
||||
|---|---|
|
||||
| `browser_type` | `"chromium"` |
|
||||
| `chrome_channel` / `channel` | `"chromium"` |
|
||||
| `headless` | `True` |
|
||||
| `user_data_dir` | `None` |
|
||||
| `proxy_config` | `None` |
|
||||
| `extra_args` | `None` |
|
||||
|
||||
`browser_type` genuinely accepts `"firefox"`, and Firefox is referenced throughout the
|
||||
project, so this is not a Chromium-only tool at the configuration level.
|
||||
|
||||
What is **not** there is `executable_path`. There is no field that says which binary to
|
||||
launch, so `browser_type="firefox"` gets you Playwright's own managed Firefox build and
|
||||
nothing else. A patched engine has no supported way in.
|
||||
|
||||
`extra_args` does not close the gap either: it passes command-line arguments to a browser
|
||||
that has already been chosen, not the choice of browser.
|
||||
|
||||
## What crawl4ai's stealth mode actually reaches
|
||||
|
||||
crawl4ai's stealth mode reaches only page-level JavaScript, and on Firefox it is largely
|
||||
inert because its evasion modules target Chromium APIs. There are two separate features
|
||||
here, and it is worth knowing which is which.
|
||||
|
||||
**Stealth mode** applies `playwright-stealth`, which is the page-level approach: scripts
|
||||
injected into the document that redefine properties before the page's own code runs.
|
||||
crawl4ai's own documentation is straight about the limitation, and it is the same one
|
||||
that library states itself: **the evasion modules target Chromium APIs and do not support
|
||||
Firefox or WebKit.**
|
||||
|
||||
So on `browser_type="firefox"` the stealth layer is largely inert, which is a genuinely
|
||||
important thing to know before choosing that combination.
|
||||
|
||||
**The undetected browser adapter** is the heavier option, aimed at sites that look at
|
||||
more than `navigator.webdriver`.
|
||||
|
||||
Both operate above the browser.
|
||||
[The three levels page](playwright-stealth-levels.md) explains what that layer can and
|
||||
cannot reach; the short version is that everything the machine reports about itself is
|
||||
untouched by either.
|
||||
|
||||
## Where the seam actually is
|
||||
|
||||
The extension point exists and it is not `BrowserConfig`. It is on the crawler strategy:
|
||||
|
||||
```python
|
||||
undetected_adapter = UndetectedAdapter()
|
||||
crawler_strategy = AsyncPlaywrightCrawlerStrategy(
|
||||
browser_config=browser_config,
|
||||
browser_adapter=undetected_adapter,
|
||||
)
|
||||
```
|
||||
|
||||
`browser_adapter` takes an adapter object, and the project ships `PlaywrightAdapter` and
|
||||
`UndetectedAdapter`. The documentation describes the pattern as allowing switching
|
||||
between browser implementations, and then gives no guidance on writing your own.
|
||||
|
||||
That is where a different engine would belong: an adapter that owns the launch and hands
|
||||
back a browser, which is exactly the shape
|
||||
[scrapy-playwright's browser provider takes](integrations/scrapy-playwright.md) and the
|
||||
reason that integration is clean. Here the seam is present but undocumented, so anything
|
||||
built on it is building against a private interface.
|
||||
|
||||
**The one-field change that would fix it properly** is `executable_path` on
|
||||
`BrowserConfig`, passed through to `launch()`. That is a small, well-scoped upstream
|
||||
change, and until it exists there is no supported route.
|
||||
|
||||
## The workaround that works today, with its cost
|
||||
|
||||
Playwright resolves its managed browsers from a directory, and that directory is
|
||||
configurable through [`PLAYWRIGHT_BROWSERS_PATH`](https://playwright.dev/docs/browsers#managing-browser-binaries).
|
||||
Put a build where Playwright expects to find one, and `p.firefox.launch()` uses it, with
|
||||
no crawl4ai change at all.
|
||||
|
||||
Be clear-eyed about what that is:
|
||||
|
||||
- It depends on Playwright's internal directory layout, which is version-stamped and not
|
||||
a public contract.
|
||||
- It applies process-wide, so everything else in that process gets the substituted
|
||||
browser too.
|
||||
- It will break on a Playwright upgrade, silently, by falling back to the managed build.
|
||||
|
||||
It works, and it is a workaround rather than an integration. If you use it, pin your
|
||||
Playwright version and check the engine at runtime rather than assuming.
|
||||
|
||||
```python
|
||||
# after launch, confirm you got the engine you meant to get
|
||||
ua = await page.evaluate("() => navigator.userAgent")
|
||||
```
|
||||
|
||||
## What no configuration changes
|
||||
|
||||
Everything the machine reports, which on a server is a consistent set of answers all
|
||||
saying the same thing:
|
||||
|
||||
- **No GPU**, so WebGL reports a software renderer.
|
||||
[What those strings mean](webgl-renderer-strings.md).
|
||||
- **A container font set** under whatever platform you claim.
|
||||
[Why more fonts is not the fix](headless-fonts-differ.md).
|
||||
- **No audio device**, and no speech voices.
|
||||
[The audio values](audiocontext-fingerprinting.md) and
|
||||
[the voice list](speech-synthesis-voices.md).
|
||||
- **A screen with no taskbar.**
|
||||
[The relationships that have to hold](screen-size-headless-tells.md).
|
||||
- **The TLS handshake**, decided before any page-level layer exists.
|
||||
[Which nothing in JavaScript can reach](ja3-ja4-tls-fingerprint.md).
|
||||
|
||||
If crawl4ai works on your laptop and fails in a container, this list is where to look
|
||||
first, and no stealth setting in the library addresses any of it.
|
||||
[The container walkthrough](playwright-docker-detection.md) goes through it in order.
|
||||
|
||||
## Conclusion
|
||||
|
||||
crawl4ai is closer to supporting a patched engine than most tools its size: it already
|
||||
abstracts the browser behind an adapter and already accepts Firefox as a browser type.
|
||||
What it lacks is the one field that says which binary to run.
|
||||
|
||||
Until that exists, the honest options are a private adapter, a process-wide directory
|
||||
substitution with the caveats above, or accepting the managed build and spending the
|
||||
effort on the machine instead, which is where most container-based failures actually
|
||||
originate.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Does crawl4ai support a custom browser binary?** Not through `BrowserConfig`. There is
|
||||
no `executable_path` field.
|
||||
|
||||
**Can crawl4ai use Firefox?** Yes, `browser_type="firefox"`, with Playwright's own
|
||||
managed build.
|
||||
|
||||
**Does crawl4ai's stealth mode work with Firefox?** Largely not. It applies
|
||||
`playwright-stealth`, whose evasion modules target Chromium APIs.
|
||||
|
||||
**What is the undetected browser adapter?** A heavier built-in adapter aimed at stronger
|
||||
detection, passed as `browser_adapter` to the crawler strategy. It still operates above
|
||||
the browser.
|
||||
|
||||
**Why does crawl4ai work locally and fail in Docker?** Because the container answers
|
||||
differently about the machine, and none of the library's settings change that.
|
||||
|
||||
**Is there any way to use a patched engine today?** A process-wide
|
||||
`PLAYWRIGHT_BROWSERS_PATH` substitution, with the fragility described above, or a custom
|
||||
adapter written against an undocumented interface.
|
||||
|
||||
**See also:** [three ways to make Playwright undetected](playwright-stealth-levels.md),
|
||||
for what the page level can reach,
|
||||
[scrapy-playwright](integrations/scrapy-playwright.md), for what a documented provider
|
||||
seam looks like, and
|
||||
[Playwright in Docker](playwright-docker-detection.md).
|
||||
|
||||
## Sources
|
||||
|
||||
- `crawl4ai/async_configs.py`, for the `BrowserConfig` fields listed above, read
|
||||
2026-07-27.
|
||||
- crawl4ai's own documentation for stealth mode and the undetected browser adapter,
|
||||
including its statement that the underlying evasion modules do not support Firefox.
|
||||
- Playwright's own [browser-management
|
||||
documentation](https://playwright.dev/docs/browsers#managing-browser-binaries), for
|
||||
the `PLAYWRIGHT_BROWSERS_PATH` behaviour the workaround depends on.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level. We would rather document the missing field than
|
||||
publish an integration guide for a seam that is not there.*
|
||||
@@ -0,0 +1,151 @@
|
||||
---
|
||||
title: "How CreepJS decides you are lying"
|
||||
description: "CreepJS asks whether a browser is telling the truth, not just what it reports. Read from its own source: how it detects a lie and why spoofing scores worse."
|
||||
parent: "Detectors, Explained"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 2
|
||||
---
|
||||
|
||||
|
||||
# How CreepJS decides you are lying
|
||||
|
||||
Most fingerprinting tests ask what your browser reports. CreepJS mostly asks whether
|
||||
your browser is *telling the truth*, which is a different question and a much harder
|
||||
one to pass by spoofing.
|
||||
|
||||
Read from the source on 2026-07-27 ([`abrahamjuliot/creepjs`](https://github.com/abrahamjuliot/creepjs),
|
||||
`src/lies/index.ts` and the module layout) and not from the rendered page, because
|
||||
the interesting part is the method instead of the numbers it prints.
|
||||
|
||||
## The shape of it
|
||||
|
||||
The project is organised into modules that map onto surfaces: `canvas`, `webgl`,
|
||||
`audio`, `fonts`, `screen`, `timezone`, `intl`, `media`, `speech`, `webrtc`,
|
||||
`navigator`, `window`, `worker`, `css`, `cssmedia`, `svg`, `domrect`, `math`,
|
||||
`engine`, `features`.
|
||||
|
||||
Then there are four that are not surfaces at all, and they are the point:
|
||||
|
||||
- **`lies`**, which detects tampering.
|
||||
- **`trash`**, which collects values that are junk or impossible.
|
||||
- **`errors`**, which records what threw when it should not have.
|
||||
- **`resistance`**, which identifies privacy tooling, including Firefox's own
|
||||
`resistFingerprinting` mode.
|
||||
|
||||
A high score is not "your fingerprint is rare". It is "nothing here contradicts
|
||||
anything else here, and nothing looks tampered with".
|
||||
|
||||
## How it finds tampering
|
||||
|
||||
Four techniques, all visible in `src/lies/index.ts`.
|
||||
|
||||
**A pristine reference.** It creates fresh iframes and reaches into
|
||||
[`contentWindow`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/contentWindow)
|
||||
to get a copy of the built-ins that your page-level patches never
|
||||
touched, because the patch ran in the parent document. Then it compares. This is the
|
||||
single most effective move against injected stealth scripts, and it is about fifteen
|
||||
lines of code.
|
||||
|
||||
**Stack-trace inspection.** It matches against `/at Function\.toString /` and
|
||||
`/at Object\.toString/`. When you replace a native function and then patch
|
||||
[`Function.prototype.toString`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/toString)
|
||||
to hide it, the way your replacement is called leaves a
|
||||
different frame in the stack than a genuine native call would. The disguise is
|
||||
detected by how the disguise itself behaves.
|
||||
|
||||
**Descriptor and prototype walking.** For each API it takes
|
||||
[`Object.getOwnPropertyDescriptor(proto, name)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor),
|
||||
checks whether `descriptor.value` is
|
||||
unexpectedly `undefined`, pulls the getter out, and compares
|
||||
[`Object.getPrototypeOf(apiFunction)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getPrototypeOf)
|
||||
against the native prototype. An override moved
|
||||
from the prototype to the instance, or a getter that is a plain function rather than
|
||||
a native one, shows up here without any cleverness.
|
||||
|
||||
**Blocking the probe is itself recorded.** Among the lie names in the source are
|
||||
`client blocked phantom iframe` and `client blocked behemoth iframe`. If your
|
||||
environment prevents CreepJS from creating its reference iframes, that prevention is
|
||||
written down as a lie.
|
||||
|
||||
That last one is the principle worth taking away, and it generalises far beyond this
|
||||
tool: **suppressing a signal is a signal**. A browser that refuses to answer is not
|
||||
quieter than one that answers plainly, it is louder, because refusing is rare and
|
||||
answering is universal.
|
||||
|
||||
## Why uniform spoofing scores badly
|
||||
|
||||
Consider the two ways people try to pass this.
|
||||
|
||||
**Override everything from JavaScript.** Every override is a candidate for all four
|
||||
techniques above. The more surfaces you patch, the more lie records you generate, and
|
||||
a page with many detected lies scores worse than one with an unusual but honest
|
||||
fingerprint. Effort spent hiding actively hurts.
|
||||
|
||||
**Turn on maximum privacy protection.** The `resistance` module exists precisely to
|
||||
identify this. Firefox's `resistFingerprinting` produces a recognisable pattern, and
|
||||
being identified as a privacy-tool user is its own classification.
|
||||
[There is a longer page on why that is the wrong tool for automation](resist-fingerprinting.md).
|
||||
|
||||
There is a third option that scores well and is much more work: do not lie in
|
||||
JavaScript at all. If a value is decided below the JavaScript layer, in the engine,
|
||||
then there is no override to find, no prototype moved, no `toString` to hide, and no
|
||||
difference between what the page sees and what a fresh iframe sees. The lie detector
|
||||
finds nothing because nothing lied.
|
||||
|
||||
That is not a claim about any particular tool being undetectable. It is a claim about
|
||||
where the detection pressure lands: on the seam between the patch and the runtime.
|
||||
Remove the seam and this whole category of check has nothing to bite on. Everything
|
||||
else, the plausibility of your GPU, your fonts, your timezone against your IP,
|
||||
remains exactly as hard as it was.
|
||||
|
||||
## What one real, unmodified session actually scored
|
||||
|
||||
Run directly against a live Playwright-driven Chromium session with no stealth
|
||||
layer of any kind applied - no injected patches, no engine-level work, nothing
|
||||
this project or any comparable tool does. CreepJS's own headless module returned
|
||||
0% headless and 0% stealth, with a 25% "like headless" partial-similarity score
|
||||
alongside them. Worth stating plainly what that does and does not mean: it says
|
||||
this one specific, directly-checked session did not trip CreepJS's headless
|
||||
heuristics that day, not that headless or automation detection in general is
|
||||
solved, and not that every Playwright launch configuration scores the same way.
|
||||
The rest of the report - the parts covered throughout this page, the lie
|
||||
detection, the consistency checks, the machine-level surfaces - is where the
|
||||
actual work happens regardless of what this one narrow module reports.
|
||||
|
||||
## Reading your own report
|
||||
|
||||
Two things worth doing when you open it:
|
||||
|
||||
1. **Read the lies section before the score.** A number tells you where you landed.
|
||||
The lie list tells you what to fix, and it names the API.
|
||||
2. **Compare the same session twice, and two sessions with the same configuration.**
|
||||
Consistency across a reload and across a fresh launch is what a real browser has.
|
||||
If your fingerprint moves between reloads, something is adding noise per call
|
||||
rather than per identity, and that is its own signature.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**What does the CreepJS score actually mean?** Not "your fingerprint is rare". It means
|
||||
nothing here contradicts anything else here, and nothing looks tampered with.
|
||||
|
||||
**Why does it detect my stealth plugin?** Four ways, and each is cheap: a pristine copy
|
||||
of the built-ins from a fresh iframe, stack-trace inspection, descriptor and prototype
|
||||
walking, and recording a blocked probe as a lie.
|
||||
|
||||
**Should I block CreepJS from creating its iframes?** No. Blocking is written down as a
|
||||
lie, by name, in its source. Suppressing a signal is a signal.
|
||||
|
||||
**Why does more patching score worse?** Because every override is another candidate for
|
||||
those four techniques. A page with many detected lies scores worse than one with an
|
||||
unusual but honest fingerprint.
|
||||
|
||||
**What passes it?** Not lying in JavaScript at all. If the value is decided below the
|
||||
JavaScript layer there is no override to find and no seam to detect.
|
||||
|
||||
**See also:** [what sannysoft checks](sannysoft-explained.md), whose canvas-in-iframe test is the same idea in miniature, [the three levels](playwright-stealth-levels.md), and [AudioContext fingerprinting](audiocontext-fingerprinting.md), where its silent-buffer check is worked through in detail.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright).
|
||||
CreepJS is a release gate here. The lie names above are quoted from its source and
|
||||
not paraphrased, because the exact strings are what you will see in a report.*
|
||||
@@ -0,0 +1,144 @@
|
||||
---
|
||||
title: "Why content_frame() returns None for a cross-origin iframe"
|
||||
description: "content_frame() returns None on a cross-origin iframe, frame.evaluate() throws, frame_locator times out - one shared cause: process isolation, not a permissions bug."
|
||||
parent: "The Automation Layer"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 9
|
||||
---
|
||||
|
||||
# Why content_frame() returns None for a cross-origin iframe
|
||||
|
||||
`content_frame()` returns `None` for a cross-origin iframe when Firefox's
|
||||
site-isolation feature puts that iframe in a separate OS process: the automation
|
||||
driver's frame tree holds only an empty placeholder for it, so there is no real frame
|
||||
reference to hand back. It is not a permissions bug, and the same single cause is why
|
||||
`frame.evaluate()` throws and `frame_locator` times out on the same iframe.
|
||||
|
||||
That cluster of symptoms all lands on the same page, all against the same cross-origin
|
||||
iframe: [`element_handle.content_frame()`](https://playwright.dev/python/docs/api/class-elementhandle)
|
||||
returns `None`, [`frame.evaluate()`](https://playwright.dev/python/docs/api/class-frame)
|
||||
throws a permission error naming a cross-origin object, and
|
||||
[`frame_locator(...).click()`](https://playwright.dev/python/docs/api/class-framelocator)
|
||||
times out with `force=True` changing nothing. Disabling JavaScript works around it and
|
||||
defeats the point of automating the page at all.
|
||||
|
||||
These read like three unrelated bugs. They are one bug, and it isn't a permissions
|
||||
problem. If the iframe you are after is same-origin instead, none of this applies and
|
||||
[scraping it is a short job with `frame_locator`](how-to-scrape-iframe-content-playwright.md).
|
||||
|
||||
## What's actually different about that iframe
|
||||
|
||||
The common thread is that the iframe is cross-origin from the page embedding it -
|
||||
the shape a third-party widget almost always has: a consent banner, a payment form, a
|
||||
support chat, anything served from a different domain than the page around it.
|
||||
|
||||
Firefox's site-isolation feature can put a cross-origin iframe in an entirely
|
||||
separate OS process from the page that embeds it, as a security boundary between
|
||||
origins. That boundary is exactly right for security and exactly wrong for an
|
||||
automation driver that assumed it could reach into every frame from one process.
|
||||
|
||||
## Why the driver's own frame tracking breaks
|
||||
|
||||
The frame tracking breaks because it is built from a single process while the iframe
|
||||
lives in another. Playwright drives Firefox through
|
||||
[Juggler, an internal automation protocol](playwright-protocol-drift.md), which keeps
|
||||
a tree of every frame on the page so `page.frames`, `content_frame()` and friends can
|
||||
find them. That tree is built and maintained from the parent process.
|
||||
|
||||
When the iframe's browsing context lives in a different, isolated process, the
|
||||
parent-side frame tree registers a placeholder for it instead of the real thing: no
|
||||
URL, no docShell reference, no execution context that actually wraps the iframe's
|
||||
global object. Every one of the three failing operations needs exactly the piece
|
||||
that placeholder doesn't have, which is why fixing one never fixed the others - they
|
||||
were never three separate problems to fix.
|
||||
|
||||
## Why this is easy to misdiagnose the first time
|
||||
|
||||
The first fix attempt targeted the wrong layer entirely, and it's worth walking
|
||||
through why, because the failure mode generalises.
|
||||
|
||||
The instinct was to wrap the suspect property read in a try/catch, on the theory that
|
||||
a security exception was firing and needed handling. It wasn't. The property in
|
||||
question simply isn't exposed to page-level script at all, so reading it from that
|
||||
scope returns `undefined` rather than throwing - there was never an exception to
|
||||
catch, and the code silently did nothing.
|
||||
|
||||
A second attempt tried comparing two identifiers to detect the isolated case
|
||||
directly. Both sides of that comparison turned out to be unreachable from the
|
||||
context the check ran in, so the comparison was comparing two things that were
|
||||
always going to be equal (or always going to be absent) regardless of whether the
|
||||
real bug was present.
|
||||
|
||||
Neither fix was tested against a reproduction that failed on the broken binary and
|
||||
passed on a fixed one - both were committed on the strength of a plausible-sounding
|
||||
theory. [The general version of that mistake, and the discipline that catches it,](how-to-test-bot-detection.md)
|
||||
is worth reading before trusting your own first hypothesis on a bug like this one.
|
||||
|
||||
## The actual fix, and why it's a single preference
|
||||
|
||||
The fix is a single preference forcing the non-isolating strategy, so every
|
||||
cross-origin iframe loads into the same process as the page around it instead of a
|
||||
separate one. That is a real trade: the security boundary the isolating strategy adds
|
||||
is gone, in exchange for an automation driver whose frame tree actually reaches every
|
||||
frame on the page. For a stealth-automation engine that already assumes a fully
|
||||
trusted, single-purpose session, that trade is the right one; it would not be for a
|
||||
general-purpose browser handling untrusted content by default.
|
||||
|
||||
Once the site-isolation strategy was identified as the actual variable, confirming it
|
||||
took one controlled comparison: the same URL, loaded once with the isolating strategy
|
||||
active and once with it set to keep same-process handling for every origin. Four
|
||||
frame-tree entries with empty URLs and no reachable content frame in the first case;
|
||||
five entries with full URLs and a working `content_frame()` in the second. The
|
||||
strategy setting was the only thing that differed between the two runs.
|
||||
|
||||
## What to check in your own setup
|
||||
|
||||
```python
|
||||
frames = page.frames
|
||||
for f in frames:
|
||||
print(f.url or "(empty - possibly isolated)", f.name)
|
||||
```
|
||||
|
||||
An entry with an empty URL and no name, sitting where a real iframe should be, is the
|
||||
shape of this exact problem. Confirm it by toggling Firefox's site-isolation strategy
|
||||
preference and re-running the same check: if the empty entry gains a real URL, that
|
||||
preference is the cause, not a permissions or timing issue anywhere in your own code.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Why does `content_frame()` return `None` for an iframe that clearly has content?**
|
||||
The iframe's browsing context is very likely running in a separate, isolated process,
|
||||
and the driver's frame tree only has a placeholder for it rather than the real
|
||||
reference.
|
||||
|
||||
**Why does `frame.evaluate()` throw a cross-origin permission error here specifically?**
|
||||
Same root cause. The evaluation target the driver is trying to reach isn't actually
|
||||
wired to the real execution context.
|
||||
|
||||
**Does `force=True` fix a `frame_locator` timeout on a cross-origin iframe?** No,
|
||||
because the element genuinely isn't reachable through the frame tree the driver is
|
||||
using; forcing the click doesn't change what frame tree exists.
|
||||
|
||||
**Is this a permissions bug?** No. Nothing was denied in the security sense; the
|
||||
property being read simply isn't exposed to the scope trying to read it, and the
|
||||
underlying frame reference the driver needs was never populated in the first place.
|
||||
|
||||
**See also:** [why an attached debugger makes automation detectable](debugger-timing-detection.md),
|
||||
for another case where the automation layer itself was the actual surface; and
|
||||
[how to test whether your setup is actually working](how-to-test-bot-detection.md),
|
||||
for the reproduction discipline that caught the two wrong fixes here.
|
||||
|
||||
## Sources
|
||||
|
||||
- This project's own patch history for the root-cause diagnosis, the two earlier
|
||||
incorrect fixes and why each one failed to address anything, the single-preference
|
||||
fix, and the regression test suite that locks the fixed behaviour in.
|
||||
- Playwright's own API reference for the three calls involved: [`ElementHandle.content_frame`](https://playwright.dev/python/docs/api/class-elementhandle),
|
||||
[`Frame.evaluate`](https://playwright.dev/python/docs/api/class-frame), and
|
||||
[`FrameLocator`](https://playwright.dev/python/docs/api/class-framelocator).
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level, on a bug that took two wrong committed fixes before
|
||||
the actual cause was reproduced.*
|
||||
@@ -0,0 +1,228 @@
|
||||
---
|
||||
title: "CSS fingerprinting: what media queries reveal"
|
||||
description: "Media queries and CSS system colours fingerprint a machine with no JavaScript, beyond page-level stealth. What they expose, and the two consistency traps."
|
||||
parent: "Browser Identity"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 9
|
||||
---
|
||||
|
||||
|
||||
# CSS fingerprinting: what media queries reveal
|
||||
|
||||
**CSS fingerprinting identifies a machine using only stylesheet media queries and system
|
||||
colours, with no JavaScript at all.** Media queries reveal the pointer type, the
|
||||
operating-system dark-mode setting, display resolution and colour gamut, the screen size,
|
||||
and accessibility preferences; CSS system colours reveal the operating system itself. Each
|
||||
is read by loading a different resource per branch, so the server learns the answer from
|
||||
which request arrives.
|
||||
|
||||
Almost everything written about [what a browser fingerprint is](what-is-a-browser-fingerprint.md)
|
||||
assumes JavaScript. Disable it, block it, patch it, and the discussion is about what a
|
||||
script can read.
|
||||
|
||||
CSS does not need a script. A stylesheet can ask what kind of pointer you have, whether
|
||||
your system is in dark mode, how many colours your display shows, and how large it is,
|
||||
and it can report the answer by loading a different background image per branch. No
|
||||
JavaScript runs, so **no page-level stealth layer is involved at all**.
|
||||
|
||||
This page covers what the features expose, the two places where CSS and JavaScript can
|
||||
disagree about the same machine, the system-colour surface almost nobody knows about,
|
||||
and what a consistent answer looks like.
|
||||
|
||||
## How a stylesheet exfiltrates without a script
|
||||
|
||||
**A stylesheet exfiltrates data with no JavaScript at all by loading a different image
|
||||
per media-query branch, so the browser that requests one image rather than another has
|
||||
answered the query.** The pattern is a few lines of CSS and has been known for years:
|
||||
|
||||
```css
|
||||
@media (pointer: fine) { body { background-image: url("/p?fine"); } }
|
||||
@media (pointer: coarse) { body { background-image: url("/p?coarse"); } }
|
||||
@media (prefers-color-scheme: dark) { body { border-image: url("/c?dark"); } }
|
||||
```
|
||||
|
||||
Only the matching branch loads its image, so the server learns the answer from which
|
||||
request arrives. Repeat across a dozen features and you have a fingerprint assembled
|
||||
entirely from network requests.
|
||||
|
||||
Two consequences worth being explicit about:
|
||||
|
||||
- **Blocking or patching JavaScript does nothing here.** There is no function to
|
||||
override and no object to inspect.
|
||||
- **It works on the first paint**, before any script you inject has a chance to run,
|
||||
which sidesteps the timing problem that
|
||||
[page-level patches have anyway](navigator-webdriver-explained.md).
|
||||
|
||||
Estimates of how much entropy this reaches vary, and the useful number is not the total.
|
||||
It is that these values are *free* to collect and are rarely part of anyone's checklist.
|
||||
|
||||
## The media features that actually carry information
|
||||
|
||||
Not every media feature carries useful entropy. The ones that identify a machine fall into
|
||||
five groups: pointer and hover capabilities, colour scheme, display characteristics,
|
||||
accessibility preferences, and size.
|
||||
|
||||
| Media feature | What it reveals |
|
||||
|---|---|
|
||||
| `pointer`, `any-pointer`, `hover`, `any-hover` | Input devices: mouse vs touch, and whether the device has both |
|
||||
| `prefers-color-scheme` | OS dark-mode setting, close to a coin flip across real users |
|
||||
| `resolution`, `color-gamut` | Display panel class (`p3` marks a modern, wide-gamut display) |
|
||||
| `prefers-reduced-motion`, `prefers-contrast`, `forced-colors`, `inverted-colors` | Accessibility preferences; a non-default value is rare and identifying |
|
||||
| `width`, `height`, `device-width`, `device-height` | Screen and viewport size, and the CSS/JavaScript consistency trap below |
|
||||
|
||||
**Pointer and hover.**
|
||||
[`pointer`](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/pointer),
|
||||
`any-pointer`, `hover`, `any-hover`. A desktop with a
|
||||
mouse reports `fine` and `hover`. A phone reports `coarse` and `none`. A touchscreen
|
||||
laptop reports both, through the `any-` variants, which is how a device with two input
|
||||
methods is distinguished from one with a single method.
|
||||
|
||||
**Colour scheme.**
|
||||
[`prefers-color-scheme`](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme)
|
||||
is the operating system's dark mode setting,
|
||||
and it is close to a coin flip across real users, so it is a genuine bit rather than a
|
||||
constant.
|
||||
|
||||
**Display characteristics.** `resolution` and `color-gamut` describe the panel.
|
||||
`color-gamut: p3` says a modern, better-than-average display; see
|
||||
[color-gamut as a display fingerprint](color-gamut-hdr-media-query-fingerprint.md) for how
|
||||
that one media query alone narrows the field.
|
||||
|
||||
**Accessibility preferences.** `prefers-reduced-motion`, `prefers-contrast`,
|
||||
`forced-colors`, `inverted-colors`. Almost everyone leaves these at the default, which
|
||||
is exactly why a non-default value is informative: it is rare.
|
||||
|
||||
**Size.** `width`, `height`, `device-width`, `device-height`, and the interaction with
|
||||
`resolution`. Which brings us to the trap.
|
||||
|
||||
## Trap one: CSS and JavaScript can disagree about the screen
|
||||
|
||||
**In Firefox, the size a media query resolves against and the size `screen.width`
|
||||
reports come from different code inside the browser** - two separate paths to the same
|
||||
physical fact. Patch only the JavaScript side and the two disagree about the same
|
||||
machine; this is a mistake specific to spoofing, and it is invisible unless you look
|
||||
for it directly.
|
||||
|
||||
Concretely, spoofing only the JavaScript side produces a browser where:
|
||||
|
||||
```js
|
||||
screen.width // 1920
|
||||
matchMedia('(device-width: 1920px)').matches // false, the real panel is something else
|
||||
```
|
||||
|
||||
One line of CSS and one line of JavaScript, and they disagree about the machine they are
|
||||
running on. That is not an unusual value, it is a contradiction, and contradictions are
|
||||
what the checks in this whole subject are built on.
|
||||
|
||||
The same applies to the pointer capabilities: a touchscreen laptop reporting `coarse` to
|
||||
CSS while the JavaScript side claims a desktop persona is the same class of mismatch.
|
||||
|
||||
This project handles both in the browser's own media-feature code, so the CSS device
|
||||
size comes from the same profile as `screen`, and the pointer capabilities report a
|
||||
mouse rather than whatever hardware the host happens to have.
|
||||
|
||||
### How to check it yourself
|
||||
|
||||
```js
|
||||
console.log(screen.width, screen.height);
|
||||
console.log(matchMedia(`(device-width: ${screen.width}px)`).matches); // want true
|
||||
console.log(matchMedia('(pointer: fine)').matches,
|
||||
matchMedia('(any-pointer: coarse)').matches);
|
||||
```
|
||||
|
||||
If the second line is `false`, something is spoofing one side only.
|
||||
|
||||
## Trap two: CSS system colours give away the operating system
|
||||
|
||||
**[CSS system colour keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/system-color) -
|
||||
`ButtonFace`, `ButtonText`, `Canvas`, `CanvasText`, `Highlight`, `HighlightText`,
|
||||
`Menu`, `Field`, and a few dozen more - resolve to the operating system's own interface
|
||||
palette, readable with no permission and one function call.** This surface is
|
||||
genuinely obscure, and it is checked in production:
|
||||
|
||||
```js
|
||||
const d = document.createElement('div');
|
||||
d.style.color = 'ButtonText';
|
||||
d.style.backgroundColor = 'ButtonFace';
|
||||
document.body.appendChild(d);
|
||||
getComputedStyle(d).color; // an RGB triple from the OS theme
|
||||
```
|
||||
|
||||
Those values are the actual theme colours. On Windows they come from the Win32 palette.
|
||||
On Linux they resolve through the desktop theme, and the RGB values are different, even
|
||||
when the user agent says Windows.
|
||||
|
||||
So a browser claiming Windows and returning a Linux theme's palette has answered the
|
||||
platform question twice with two different answers, from a surface most people have
|
||||
never enumerated. A commercial fingerprinting service hashes exactly this set.
|
||||
|
||||
This project pins the full palette to the Windows default so it matches the claimed
|
||||
platform, with one exception worth knowing: when the persona is a dark-theme user, the
|
||||
palette is skipped and the dark-mode preference is set instead, because pinning a light
|
||||
palette onto a dark-mode profile would create the contradiction it exists to prevent.
|
||||
|
||||
## What a consistent CSS answer looks like
|
||||
|
||||
Working from all of the above:
|
||||
|
||||
- **Pointer and hover describe one plausible input device**, and agree between the
|
||||
`any-` variants and the plain ones.
|
||||
- **The CSS device size matches `screen`**, exactly.
|
||||
- **`prefers-color-scheme` matches the system-colour palette.** Dark mode with a light
|
||||
palette is a contradiction.
|
||||
- **Accessibility preferences are at their defaults** unless you have a reason, because
|
||||
non-default values are rare and therefore identifying.
|
||||
- **`color-gamut` and `resolution` suit the display you claim.**
|
||||
- **Everything is stable for the session.** A colour scheme that flips mid-session is a
|
||||
browser nobody has.
|
||||
|
||||
## Conclusion
|
||||
|
||||
CSS fingerprinting matters not because it is the strongest signal but because it is the
|
||||
one that operates below every layer people normally work at. There is no script to
|
||||
patch, so the values have to be right at the source or not at all.
|
||||
|
||||
The two traps are the practical takeaway. CSS and JavaScript reach the screen size by
|
||||
different routes inside the browser, and the system-colour palette is a platform tell
|
||||
sitting in plain sight, readable with one `getComputedStyle` call.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Can a website fingerprint me with CSS alone?** Yes. Media queries can load different
|
||||
resources per branch, so the server learns the answer without any script running.
|
||||
|
||||
**Does blocking JavaScript stop CSS fingerprinting?** No. That is the point of it.
|
||||
|
||||
**What is `prefers-color-scheme` worth to a tracker?** Roughly one bit, and a reliable
|
||||
one, because real users are split between the two settings.
|
||||
|
||||
**Why would CSS and `screen.width` disagree?** Because the browser resolves them through
|
||||
different code, so spoofing one and not the other leaves them inconsistent.
|
||||
|
||||
**Are CSS system colours really used for fingerprinting?** Yes, by hashing the resolved
|
||||
values of the system keywords. They also reveal the operating system independently of
|
||||
the user agent.
|
||||
|
||||
**Should I set unusual accessibility preferences?** No. Almost everyone is at the
|
||||
default, so anything else narrows you down rather than hiding you.
|
||||
|
||||
**See also:** [screen size and viewport tells](screen-size-headless-tells.md), which is
|
||||
the JavaScript half of the size question,
|
||||
[why headless browsers render different fonts](headless-fonts-differ.md), another
|
||||
platform tell that no script controls, and
|
||||
[the checklist for being detected on one site](playwright-detected-as-bot.md).
|
||||
|
||||
## Sources
|
||||
|
||||
- MDN's [reference for the `@media` at-rule](https://developer.mozilla.org/en-US/docs/Web/CSS/@media)
|
||||
and the individual media features named above.
|
||||
- Published work on CSS-based fingerprinting, which is where the load-an-image-per-branch
|
||||
technique is described.
|
||||
- This project's own media-feature and system-colour handling, and the reason the palette
|
||||
is skipped for dark-theme personas.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level. The system-colour palette is pinned here because a
|
||||
commercial detector was hashing it and catching the host operating system through it.*
|
||||
@@ -0,0 +1,200 @@
|
||||
---
|
||||
title: "Why an attached debugger makes automation detectable"
|
||||
description: "A fingerprinting service reported developer_tools true with no devtools open. The cause was the automation framework's attached debugger, four separate leaks."
|
||||
parent: "The Automation Layer"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 3
|
||||
---
|
||||
|
||||
|
||||
# Why an attached debugger makes automation detectable
|
||||
|
||||
An attached JavaScript debugger makes automation detectable because it measurably
|
||||
changes how fast the page runs, and that timing difference shows up even when every
|
||||
property on the page looks normal. **Attaching a debugger, which is how automation
|
||||
frameworks evaluate code and track execution, puts the JavaScript engine into debug
|
||||
mode - and debug mode is slower in ways a page can time.**
|
||||
|
||||
That is what caught us. A commercial fingerprinting service was reporting
|
||||
`developer_tools: true` on our sessions. No devtools window was open. Nothing was
|
||||
inspecting anything. The browser looked, by every property-level check we could run,
|
||||
completely normal. It was right anyway.
|
||||
|
||||
This page is what that means, the four separate leaks it turned out to be, and the one
|
||||
that mattered most, which had nothing to do with timing at all.
|
||||
|
||||
## The mechanism
|
||||
|
||||
Playwright drives Firefox through a component that needs to evaluate code in the page,
|
||||
track promises and manage execution contexts. The natural way to do that is the
|
||||
engine's own `Debugger` API. [The same frame-tracking machinery has its own separate
|
||||
failure mode against cross-origin iframes](cross-origin-iframe-unreachable.md), for a
|
||||
different reason than anything covered here.
|
||||
|
||||
Attaching one calls `setIsDebuggee()` on every realm it touches, and that flag is not
|
||||
cosmetic. It puts the JavaScript engine into debug mode:
|
||||
|
||||
- **The optimising JIT is disabled**, so JavaScript runs several times slower.
|
||||
- A slow path runs **on every native function call**.
|
||||
- A slow path runs **on every frame exit**.
|
||||
- A slow path runs **on every exception**.
|
||||
|
||||
None of that is visible as a property. There is no `navigator.isBeingDebugged`. But it
|
||||
is trivially visible as *time*.
|
||||
|
||||
Run 50,000 iterations of something and measure. A normal Firefox and a debug-mode
|
||||
Firefox produce different distributions, not just different totals, and a model trained
|
||||
on real browsers separates them easily. That is what the service was doing, and
|
||||
`developer_tools: true` was its conclusion.
|
||||
|
||||
**The general point, which is bigger than this bug:** [a browser fingerprint](what-is-a-browser-fingerprint.md)
|
||||
is not only the set of values a browser reports. It includes how the browser behaves, and performance is a
|
||||
behaviour. You can spoof every string on the page and still be running measurably
|
||||
differently from the thing you claim to be - [the same value-versus-output gap](renderer-string-vs-render.md)
|
||||
that cost us a WebGL renderer flag before it cost us this one.
|
||||
|
||||
## Fix one: attach without entering debug mode
|
||||
|
||||
The debugger does not actually need debug mode for what an automation driver uses it
|
||||
for. Evaluating code in a realm and holding references to values work without it; what
|
||||
needs it is stepping, breakpoints and the hooks that fire on every call.
|
||||
|
||||
So the engine gained a flag. When it is set, the realm is never marked as a debuggee:
|
||||
the JIT stays on, the slow paths stay off, and evaluation still works because that path
|
||||
never consulted the flag in the first place.
|
||||
|
||||
Result: `developer_tools: false`, on every session we measured afterwards.
|
||||
|
||||
## Fix two: the stack traces said too much
|
||||
|
||||
Two separate leaks, both readable from ordinary JavaScript by anyone who throws an
|
||||
error and reads [`Error.stack`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/stack).
|
||||
|
||||
**Frames belonging to the automation layer.** The driver's own code lived at
|
||||
`chrome://juggler/...`, and when the stack was built those frames were in it. A page
|
||||
that captures a stack sees frames from a source no ordinary browsing produces. The fix
|
||||
is to skip frames whose source belongs to the automation layer while the stack string is
|
||||
built.
|
||||
|
||||
**The name of evaluated code.** When the driver evaluated something, the engine labelled
|
||||
it `debugger eval code`, with an introduction type of `debugger eval`. Both strings are
|
||||
visible in stacks. They now say `eval code` and `eval`, which is what ordinary
|
||||
evaluation is called.
|
||||
|
||||
Neither of these needs a fingerprinting library. `try { null.f() } catch (e) { e.stack }`
|
||||
is the whole technique.
|
||||
|
||||
## Fix three: attached but invisible
|
||||
|
||||
Even with debug mode skipped, the debugger was still being registered in the realm's
|
||||
internal list of debuggers, which meant `hasDebuggers()` was true.
|
||||
|
||||
That state is not readable from JavaScript. It did, however, keep two engine paths alive
|
||||
that are not gated on debug mode: a notification on every major garbage collection, and
|
||||
allocation sampling. So a page realm remained distinguishable from one that had never
|
||||
been debugged, on an axis nobody was looking at yet.
|
||||
|
||||
The fix registers the debugger everywhere it is needed for the driver to work and not in
|
||||
the list that flips that flag. The realm is now indistinguishable from a never-debugged
|
||||
one.
|
||||
|
||||
This is the sort of thing that is easy to dismiss as theoretical. We fixed it because
|
||||
the previous three had all been theoretical right up until something measured them.
|
||||
|
||||
## Fix four, and this is the one that mattered
|
||||
|
||||
The others were about how the engine behaved. This one was about something the driver
|
||||
did to the page, and it was the load-bearing fix.
|
||||
|
||||
Every execution context, when created, immediately ran a small helper in **the page's own
|
||||
realm**, so that serialisation would be fast later. It ran before any of the page's
|
||||
scripts.
|
||||
|
||||
That helper touched `JSON`, `Date.prototype` and `Array.prototype`. In the page's realm.
|
||||
Before the page existed.
|
||||
|
||||
A page that has been automated therefore started with built-in prototypes that had been
|
||||
touched by something else first, and that is observable. In a controlled experiment,
|
||||
this was the difference between being blocked and not being blocked by a commercial
|
||||
protection stack, with everything else held constant.
|
||||
|
||||
The fix is unglamorous: build the helper lazily, on first use, which is always after the
|
||||
page has loaded and always in response to something the client asked for. The page realm
|
||||
is now untouched until the page's own first script runs.
|
||||
|
||||
If you take one thing from this page, take that shape:
|
||||
|
||||
> The most expensive leak was not a value the browser reported. It was code that ran in
|
||||
> the page's world before the page did.
|
||||
|
||||
## The related one: every evaluate was a user gesture
|
||||
|
||||
While looking at the same file we found that evaluating script was announcing itself
|
||||
another way. Before running your code, the driver was telling the browser that a user
|
||||
gesture was in progress, presumably so that gesture-gated APIs would work from
|
||||
automation.
|
||||
|
||||
The side effect is that [`navigator.userActivation`](https://developer.mozilla.org/en-US/docs/Web/API/UserActivation)`.isActive` and `hasBeenActive` became
|
||||
true as a result of `page.evaluate()`. A page that reads user activation therefore saw a
|
||||
user gesture that no user made, at a moment no user could have made one. The same theme
|
||||
runs through [synthetic clicks and the `isTrusted` flag](playwright-clicks-istrusted.md):
|
||||
automation announcing an interaction that no human performed.
|
||||
|
||||
It is now off by default, and available behind a preference for the cases that genuinely
|
||||
need gesture-gated APIs.
|
||||
|
||||
## What to check in your own setup
|
||||
|
||||
```js
|
||||
// 1. does the automation layer appear in stacks?
|
||||
try { null.f() } catch (e) { console.log(e.stack) }
|
||||
|
||||
// 2. is anything claiming a user gesture I did not make?
|
||||
console.log(navigator.userActivation.isActive, navigator.userActivation.hasBeenActive);
|
||||
|
||||
// 3. rough timing sanity, compared against a normal browser on the same machine
|
||||
const t = performance.now();
|
||||
for (let i = 0; i < 5e6; i++) Math.sqrt(i);
|
||||
console.log(performance.now() - t);
|
||||
```
|
||||
|
||||
For the third one the absolute number means nothing. Run it in your automated browser
|
||||
and in a normal browser on the same machine and compare the ratio. A large gap is the
|
||||
JIT being off, and no property-level fix addresses it.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Why does a fingerprinting service report devtools when nothing is open?** Because an
|
||||
attached debugger changes engine behaviour, and that is measurable through timing even
|
||||
with no window and no property to read.
|
||||
|
||||
**Can a page detect that the JIT is disabled?** Not directly, and it does not need to.
|
||||
It measures how long things take and compares against what a normal browser does.
|
||||
|
||||
**Is `Error.stack` really used for detection?** Yes, and it is one of the cheapest
|
||||
techniques available. It costs one thrown error, and it exposes both the source of every
|
||||
frame and the label the engine gave to evaluated code.
|
||||
|
||||
**Does `page.evaluate()` leave traces?** It can. Ours announced a user gesture, and it
|
||||
warmed a helper in the page realm before the page loaded. Both were fixed, and both
|
||||
would have been invisible to any property-level audit.
|
||||
|
||||
**Does this affect Chromium-based automation?** The specific fixes are Firefox-side. The
|
||||
category is not: any driver that attaches to the JavaScript engine or runs code in the
|
||||
page's world before the page has the same class of problem.
|
||||
|
||||
**How would I have found this myself?** By comparing against a stock browser on the same
|
||||
machine, on timing and on stack contents, rather than on values. Every one of these was
|
||||
invisible in a property dump.
|
||||
|
||||
**See also:** [Function.prototype.toString and the native code check](tostring-native-code-detection.md),
|
||||
for the property-level half of the same story, and
|
||||
[three ways to make Playwright undetected](playwright-stealth-levels.md), where the
|
||||
driver layer is the one this page is about.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level. All four fixes are in this project's engine and
|
||||
driver, and the fourth one was found by controlled experiment after the first three did
|
||||
not fully close it.*
|
||||
@@ -0,0 +1,263 @@
|
||||
---
|
||||
title: "Detecting installed fonts in JavaScript by width"
|
||||
description: "Detect installed fonts in JavaScript with no enumeration API: how the width-comparison probe tells present from absent, and why headless browsers fail it."
|
||||
parent: "Canvas, WebGL, Fonts and Audio"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 11
|
||||
---
|
||||
|
||||
|
||||
# Detecting installed fonts in JavaScript by width
|
||||
|
||||
There is a font-detection technique that needs no font-enumeration API, no
|
||||
permission, and no privileged surface. It draws a short string in a candidate
|
||||
font, draws the same string in a known fallback, and compares the two rendered
|
||||
widths. If they differ, the candidate font is present. If they match to the
|
||||
pixel, the browser fell back, so the font is absent.
|
||||
|
||||
That single comparison is old, cheap, and still in wide use, because it is hard
|
||||
to disable without breaking real pages. This page is what the width-comparison
|
||||
probe actually measures, why it is a different thing from hashing [`measureText`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/measureText)
|
||||
output, what it returns on a bare headless browser, and how a browser that ships
|
||||
its own font set answers it the same way on Windows, Linux and macOS.
|
||||
|
||||
## How the width-comparison probe works
|
||||
|
||||
The mechanism is a fallback trick. Set an element to a font stack whose only
|
||||
entry is a generic family the platform is guaranteed to resolve, measure a test
|
||||
string, and record that width as the baseline. Then prepend a candidate family
|
||||
to the same stack and measure again. The browser uses the candidate if it can
|
||||
resolve it, and falls back to the generic if it cannot. A different width means
|
||||
the candidate rendered; an identical width means it did not exist.
|
||||
|
||||
```javascript
|
||||
// The classic width-comparison presence probe, no enumeration API involved.
|
||||
function fontIsPresent(family) {
|
||||
const probe = "mmmmmmmmmmlli wwww 0123456789";
|
||||
const canvas = document.createElement("canvas");
|
||||
const ctx = canvas.getContext("2d");
|
||||
|
||||
ctx.font = "72px monospace";
|
||||
const baseline = ctx.measureText(probe).width;
|
||||
|
||||
ctx.font = `72px "${family}", monospace`;
|
||||
const candidate = ctx.measureText(probe).width;
|
||||
|
||||
// Present if the candidate changed the width away from the fallback.
|
||||
return candidate !== baseline;
|
||||
}
|
||||
```
|
||||
|
||||
The same idea works with a hidden DOM element and [`offsetWidth`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetWidth) instead of a
|
||||
canvas; the width number comes from the same text-shaping path either way. A
|
||||
detector then runs this over a list of a few hundred font names and turns the
|
||||
present/absent bits into a vector. Two facts about that vector are what make it
|
||||
useful to a detector: it is stable for one machine, and it varies between
|
||||
machines, because the installed-font set is one of the more distinctive things
|
||||
about a device.
|
||||
|
||||
## Why this is different from hashing measureText
|
||||
|
||||
It is easy to lump this in with `measureText` fingerprinting, but the two probe
|
||||
different things and a browser can answer one well and the other badly.
|
||||
|
||||
A `measureText` hash reads the exact sub-pixel width of one string in one font
|
||||
and treats the fractional part as entropy. It does not care whether a font is
|
||||
present; it cares that the same font renders to a slightly different width on
|
||||
two machines because of the rasterizer behind it.
|
||||
|
||||
The width-comparison probe on this page throws that precision away. It only
|
||||
asks a yes-or-no question: did the width move at all. A font that renders one
|
||||
pixel wider than the fallback is just as "present" as one that renders forty
|
||||
pixels wider.
|
||||
|
||||
That distinction matters for a disguise. Hiding from the hash means making the
|
||||
fractional width deterministic and detached from the host rasterizer, which is
|
||||
[what a bounded per-run offset on the text-shaping path does](measuretext-textmetrics-fingerprinting.md).
|
||||
Hiding from the presence probe means controlling which families resolve at all,
|
||||
which is a font-set problem, not a metrics problem.
|
||||
|
||||
Get the first right and the second wrong and you have a clean width hash sitting
|
||||
on top of a font list that screams "Linux server". The two have to be solved
|
||||
together, and this is one reason [headless browsers render a different set of fonts than a desktop](headless-fonts-differ.md).
|
||||
|
||||
## What the probe reads on a bare headless browser
|
||||
|
||||
Run the probe on stock headless Chrome or Firefox in a container and the result
|
||||
is not "no fonts". It is a font set that belongs to the base image.
|
||||
|
||||
A default Linux container answers "present" for DejaVu, Liberation and a handful
|
||||
of Noto families, and "absent" for every family a Windows desktop ships: no
|
||||
Segoe UI, no Calibri, no Cambria, no Consolas. The probe does not need to know
|
||||
those names to score you. It runs its whole list, gets a vector that matches no
|
||||
consumer operating system, and that mismatch is the signal.
|
||||
|
||||
Claiming Windows in the user agent while the font vector is a Linux base image
|
||||
is a one-line contradiction, and it is exactly the kind of internal disagreement
|
||||
that [a browser that inspects consistency rather than values](how-to-test-bot-detection.md)
|
||||
records as a lie.
|
||||
|
||||
The same probe list produces a different vector in each of these three cases:
|
||||
|
||||
| Environment | Fonts that resolve (present) | Windows desktop fonts (absent) |
|
||||
|---|---|---|
|
||||
| Default Linux container | DejaVu, Liberation, a few Noto families | Segoe UI, Calibri, Cambria, Consolas |
|
||||
| Real Windows desktop | Segoe UI, Calibri, Cambria, Consolas and the rest of the Windows set | none, they are installed |
|
||||
| Bundled font set (this project) | the same fixed Windows set on every host | none, shipped inside the binary |
|
||||
|
||||
The reverse failure is just as visible. A build that tries to suppress the probe
|
||||
by forcing every candidate to fall back returns "absent" for everything,
|
||||
including the generic families a real browser always has. An all-absent vector
|
||||
is not a real machine either. A suppressed signal is itself a tell, so the goal
|
||||
is not to answer "no" to everything, it is to answer the way a specific real
|
||||
desktop would.
|
||||
|
||||
## Running the probe against a bundled font set
|
||||
|
||||
The approach this project takes is to stop borrowing the host's fonts at all.
|
||||
The patched Firefox carries a fixed set of real Windows font files inside the
|
||||
binary and builds the family list from a single manifest, so the same set is
|
||||
present whether the process runs on a Windows laptop, a Linux server or a macOS
|
||||
runner. The width-comparison probe sees that set and nothing from the machine
|
||||
underneath.
|
||||
|
||||
Here is the probe run end to end against a reproducible identity. It measures a
|
||||
list of families, splits them into present and absent, and prints the vector the
|
||||
detector would score.
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
CANDIDATES = [
|
||||
"Segoe UI", "Calibri", "Cambria", "Consolas", "Arial", "Tahoma",
|
||||
"Times New Roman", "Verdana", "Georgia", "Trebuchet MS",
|
||||
"DejaVu Sans", "Liberation Sans", "Ubuntu", "Noto Sans CJK SC",
|
||||
]
|
||||
|
||||
PROBE_JS = """
|
||||
(families) => {
|
||||
const probe = "mmmmmmmmmmlli wwww 0123456789";
|
||||
const ctx = document.createElement("canvas").getContext("2d");
|
||||
const widthIn = (stack) => { ctx.font = `72px ${stack}`; return ctx.measureText(probe).width; };
|
||||
const baseline = widthIn("monospace");
|
||||
const present = [], absent = [];
|
||||
for (const f of families) {
|
||||
(widthIn(`"${f}", monospace`) !== baseline ? present : absent).push(f);
|
||||
}
|
||||
return { present, absent };
|
||||
}
|
||||
"""
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
result = page.evaluate(PROBE_JS, CANDIDATES)
|
||||
print("present:", result["present"])
|
||||
print("absent :", result["absent"])
|
||||
```
|
||||
|
||||
The Windows families resolve and the Linux-only families fall back, on every
|
||||
host, because the resolution is decided by the bundled manifest and not by
|
||||
whatever fonts the container happens to have. `browser` here is a real Playwright
|
||||
`Browser`, so this is ordinary `page.evaluate` against a live page, nothing the
|
||||
wrapper had to add.
|
||||
|
||||
## Why the answer is identical across operating systems
|
||||
|
||||
The reason this holds up is that both halves of the probe are host-independent by
|
||||
construction.
|
||||
|
||||
The present/absent half is settled by the manifest. The family list is built
|
||||
from the same checked-in data on all three platforms, so the set of names that
|
||||
resolve is a property of the build, not of the OS font directory. There is no
|
||||
path where the host's DejaVu or the host's system UI font leaks into the list
|
||||
that content can enumerate.
|
||||
|
||||
The width half is where a naive bundle would still leak. If the widths came
|
||||
straight from the platform rasterizer, the same bundled font would measure a
|
||||
little differently under DirectWrite on Windows than under FreeType on Linux, and
|
||||
the fractional widths would sort the machines back into OS buckets even with an
|
||||
identical font set.
|
||||
|
||||
Instead the width for a run gets one bounded sub-pixel offset, applied once to
|
||||
the last glyph of the run and derived from the session seed, rather than from
|
||||
the host text engine. It is length-independent, so it does not grow with the
|
||||
string, and it is deterministic, so the same seed gives the same width every
|
||||
time. The result is that the width-comparison probe, and the finer width-hash
|
||||
probe layered on it, both answer from the seed rather than from the operating
|
||||
system.
|
||||
|
||||
You can watch that directly: run the block above with `seed=42` on two different
|
||||
machines and the present/absent split and the measured widths match. Change the
|
||||
seed and the widths shift together while the present/absent split stays fixed,
|
||||
because the font set is the same identity and only the metrics jitter is
|
||||
per-seed. That is the difference between a font disguise that is [consistent
|
||||
across platforms](bundled-fonts-cross-platform.md) and one that merely looks
|
||||
right on the machine you built it on.
|
||||
|
||||
## Conclusion
|
||||
|
||||
The width-comparison probe is durable precisely because it is simple: a fallback,
|
||||
two measurements, a subtraction. You cannot answer it by patching a property,
|
||||
because there is no property, only the rendered width of a string. The only way
|
||||
to give it a coherent answer is to control the font set it resolves and the
|
||||
widths it reads, together, and to make both come from the identity rather than
|
||||
from the host.
|
||||
|
||||
That is the test to hold any stealth setup to. Enumerate the presence vector,
|
||||
confirm it matches a real desktop instead of a base image, then read the widths
|
||||
twice and confirm they are stable and detached from the OS underneath. A vector
|
||||
that is all-present, all-absent, or quietly shaped like the server it runs on has
|
||||
failed, whatever the headline verdict says.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Can JavaScript detect installed fonts without an enumeration API?** Yes. It
|
||||
draws a test string in a candidate font and in a generic fallback and compares
|
||||
the two widths; a difference means the font is installed. No permission or
|
||||
special API is required.
|
||||
|
||||
**How does the width comparison actually tell present from absent?** The browser
|
||||
uses the candidate font if it can resolve it and the fallback if it cannot. The
|
||||
same string in a resolved font measures a different width than in the fallback,
|
||||
so a width that moves means present and a width that matches means absent.
|
||||
|
||||
**Is this the same as measureText fingerprinting?** No. `measureText`
|
||||
fingerprinting reads the exact fractional width as entropy. The presence probe
|
||||
only checks whether the width moved at all. A browser can hide from one and leak
|
||||
the other, so both have to be handled.
|
||||
|
||||
**Why does a headless browser fail this probe?** Because its font set belongs to
|
||||
the base image, not to the platform it claims. A Linux container answers
|
||||
"absent" for every Windows desktop font, and that vector matches no real
|
||||
consumer OS.
|
||||
|
||||
**Does hiding fonts by making them all absent work?** No. An all-absent vector is
|
||||
not a real machine either, and a suppressed signal is its own tell. The aim is to
|
||||
answer the way a specific real desktop would, not to answer no to everything.
|
||||
|
||||
**Why do the widths come out the same on Windows and Linux here?** Because the
|
||||
font set is built from one manifest on every OS, and the width for a run carries a
|
||||
single bounded, seed-derived offset instead of the host rasterizer's metrics, so
|
||||
the numbers track the seed rather than the operating system.
|
||||
|
||||
## Sources
|
||||
|
||||
- This project's font architecture notes: a bundled Windows font set built from a
|
||||
single manifest, exposing the same families on all three operating systems, and
|
||||
a bounded per-run width offset on the text-shaping path that replaces the host
|
||||
rasterizer's metrics.
|
||||
- The width-comparison presence technique as it appears in public detection
|
||||
suites, read as the fallback-and-subtract mechanism described above rather than
|
||||
from any one implementation.
|
||||
|
||||
**See also:** [why a bundled font set stays identical across platforms](bundled-fonts-cross-platform.md),
|
||||
[how the measureText width hash is handled](measuretext-textmetrics-fingerprinting.md),
|
||||
and [why headless browsers render a different font set](headless-fonts-differ.md).
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The font set is the
|
||||
same on every host by construction, which is the only reason this probe answers
|
||||
the same way whether the process runs on a laptop or a container.*
|
||||
@@ -0,0 +1,199 @@
|
||||
---
|
||||
title: "window.devicePixelRatio: the pref that spoofs it"
|
||||
description: "Set window.devicePixelRatio in Firefox with the layout.css.devPixelsPerPx string pref, why plausible pref keys do nothing, and the three values it must match."
|
||||
parent: "Browser Identity"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 22
|
||||
---
|
||||
|
||||
|
||||
# window.devicePixelRatio: the pref that spoofs it
|
||||
|
||||
In Firefox, [`window.devicePixelRatio`](https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio) is spoofed by one about:config pref,
|
||||
`layout.css.devPixelsPerPx`, set as a string such as `"1.25"`. The keys that live in a
|
||||
`screen` or a `dpr` namespace look right but are never read, so setting one changes
|
||||
nothing. Getting the value to move is the easy half; keeping it consistent with the two
|
||||
other places a device pixel ratio shows up is what keeps a session unremarkable.
|
||||
|
||||
There is a whole class of Firefox device-pixel-ratio spoofs that share one property:
|
||||
they set a pref, the code runs without error, and `window.devicePixelRatio` does not
|
||||
change. The value stays at whatever the machine reports, the spoof is announced nowhere,
|
||||
and the only way you find out is by reading the property back.
|
||||
|
||||
This page is about the one pref that does move it, the reason the plausible-looking keys
|
||||
do not, and the three values that have to tell the same story once you get it moving.
|
||||
|
||||
## Why a dpr spoof can run and change nothing
|
||||
|
||||
Firefox reads a fixed set of preferences at startup. A pref name that is not declared in
|
||||
the build is not an error: you can set it, it lands in the profile, and no code ever asks
|
||||
for it. It is a note left in a room nobody visits.
|
||||
|
||||
Device pixel ratio is the surface where this bites hardest, because the name that
|
||||
suggests itself is almost never the name the engine reads. People reach for something in a
|
||||
`screen` or a `dpr` namespace, set it, and move on without reading the value back. We did
|
||||
a version of this ourselves in an earlier build: the wrapper wrote a dpr value to a key
|
||||
that Firefox does not read, so it was a silent no-op for every session until we noticed
|
||||
the property had never actually moved. We removed the dead write and kept only the pref
|
||||
below. The lesson outlived the bug: a pref you set is not a pref that took effect, and
|
||||
[the general version of that trap has its own page](firefox-prefs-not-applying.md).
|
||||
|
||||
## The pref Firefox actually reads
|
||||
|
||||
`window.devicePixelRatio` in Firefox is driven by the native about:config pref
|
||||
`layout.css.devPixelsPerPx`. It is a string pref, and the value is the ratio written as
|
||||
text:
|
||||
|
||||
```python
|
||||
from playwright.sync_api import sync_playwright
|
||||
|
||||
with sync_playwright() as p:
|
||||
browser = p.firefox.launch(firefox_user_prefs={
|
||||
# a STRING, not a bare float: "1.25", not 1.25
|
||||
"layout.css.devPixelsPerPx": "1.25",
|
||||
})
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
print(page.evaluate("window.devicePixelRatio")) # 1.25
|
||||
browser.close()
|
||||
```
|
||||
|
||||
Two things about this pref that catch people out. It is a string, so pass the number as
|
||||
text; a bare numeric value is a different kind of pref value and the parser will not treat
|
||||
it the same way. And it is a global scale for the whole browser, not a per-context knob,
|
||||
which is exactly why it has to be kept consistent with the per-context values Playwright
|
||||
sets separately. That is the next section.
|
||||
|
||||
## The three values that must tell the same story
|
||||
|
||||
Setting the pixel ratio is the easy half. The half that gets a session flagged is
|
||||
consistency, because a device pixel ratio shows up in three places that a detector can
|
||||
read independently and compare:
|
||||
|
||||
1. `window.devicePixelRatio`, driven by the pref above.
|
||||
2. Playwright's per-context [`device_scale_factor`](https://playwright.dev/python/docs/api/class-browser#browser-new-context), which scales the rendered viewport.
|
||||
3. The CSS [resolution media feature](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/resolution), for example `matchMedia("(resolution: 1.25dppx)")`,
|
||||
which the browser answers from its own scaling.
|
||||
|
||||
If the pref says 1.25 and the context was created with `device_scale_factor=1.0`, the
|
||||
number reported by `devicePixelRatio` and the geometry the page actually renders at
|
||||
disagree. A real display never does that. The media query is the third witness: it has to
|
||||
resolve to the same ratio the property reports, or a script that reads both has found a
|
||||
contradiction that no real machine produces.
|
||||
|
||||
This is the same failure mode as a user agent claiming one platform on an engine
|
||||
reporting another. The individual value is plausible; the disagreement is the tell. It is
|
||||
also why [an impossible screen geometry is a datacenter signal](screen-size-headless-tells.md)
|
||||
rather than an automation one, and why
|
||||
[the CSS resolution query is worth reading directly](css-media-query-fingerprinting.md)
|
||||
instead of trusting the single property.
|
||||
|
||||
## Measuring the agreement with a seed
|
||||
|
||||
The point of a seed-reproducible browser is that you stop hand-tuning these values and
|
||||
start reading them back. With `invisible_playwright` the pixel ratio, the context scale
|
||||
factor and the media-query answer are all derived from one seed and kept in agreement,
|
||||
so the useful thing to write is not a setter but a check that the three witnesses match:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
CHECK = r"""
|
||||
() => {
|
||||
const dpr = window.devicePixelRatio;
|
||||
// does the CSS resolution query agree with the property?
|
||||
const mq = matchMedia(`(resolution: ${dpr}dppx)`).matches;
|
||||
return {
|
||||
devicePixelRatio: dpr,
|
||||
resolutionQueryAgrees: mq,
|
||||
screen: `${screen.width}x${screen.height}`,
|
||||
// physical pixels implied by the scale
|
||||
physical: `${Math.round(screen.width * dpr)}x${Math.round(screen.height * dpr)}`,
|
||||
};
|
||||
}
|
||||
"""
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
report = page.evaluate(CHECK)
|
||||
print(report)
|
||||
assert report["resolutionQueryAgrees"], "dpr and the resolution media query disagree"
|
||||
```
|
||||
|
||||
Run it twice with the same seed and every field comes back identical, which is what makes
|
||||
a failure reproducible: if a page reacts to the pixel ratio, you can replay the exact same
|
||||
ratio rather than hoping the next random draw lands on it. Run it against a stock browser
|
||||
on the same machine and diff the report field by field; anything that differs other than
|
||||
the address is a candidate, and `resolutionQueryAgrees` being `false` on either side is a
|
||||
straight fail, not a score to weigh.
|
||||
|
||||
## What a mismatch looks like from the outside
|
||||
|
||||
It helps to picture what a script sees when the three values are not aligned, because it
|
||||
explains why "just set devicePixelRatio to a normal number" is not enough.
|
||||
|
||||
A common real-display pairing is a 1920x1080 screen at a device pixel ratio of 1.0, or a
|
||||
scaled laptop panel at 1.25 or 1.5. A detector does not check whether your number is one
|
||||
of those. It checks whether the number, the rendered geometry and the media query point
|
||||
at the same display. A browser reporting 2.0 while rendering at 1.0 scale, or answering
|
||||
the resolution query as if it were 1.0 while `devicePixelRatio` says 2.0, has described a
|
||||
screen that cannot exist. That is a positive signal of tampering, and it is worse than
|
||||
reporting a boring, honest 1.0, because an inconsistency is information a plain value is
|
||||
not. The whole reason to read the value back after setting it is to be sure you produced a
|
||||
real display and not an impossible one.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Device pixel ratio is a small field with a large blast radius. The pref that moves it in
|
||||
Firefox is `layout.css.devPixelsPerPx`, set as a string; the plausible-sounding keys in
|
||||
other namespaces are notes in an empty room. Getting the value to change is the easy part.
|
||||
The part that keeps a session unremarkable is making the property, the context scale
|
||||
factor and the CSS resolution media query agree, and then reading all three back to prove
|
||||
they do, against a stock browser, more than once.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**How do I set window.devicePixelRatio in Firefox?** Set the about:config string pref
|
||||
`layout.css.devPixelsPerPx` to the ratio as text, for example `"1.25"`. It is the only
|
||||
pref that actually drives the property.
|
||||
|
||||
**I set a dpr pref and nothing changed. Why?** Almost certainly you set a pref name the
|
||||
engine does not read. A pref that is not declared in the build is accepted silently and
|
||||
never consulted. Read `window.devicePixelRatio` back to confirm it moved.
|
||||
|
||||
**Does device_scale_factor set devicePixelRatio?** It scales the rendered viewport for a
|
||||
context, and it must match the pref, but it is a separate value. If they disagree the
|
||||
browser reports a display that cannot exist.
|
||||
|
||||
**What device pixel ratio should I use?** One that a real display has, like 1.0, 1.25 or
|
||||
1.5, and the same value in all three places. The specific number matters less than the
|
||||
three witnesses agreeing.
|
||||
|
||||
**Can a site detect a spoofed dpr?** Not from a plausible value on its own. It detects the
|
||||
contradiction when the property, the render geometry and the resolution media query point
|
||||
at different displays.
|
||||
|
||||
**Why does the ratio have to be a string?** `layout.css.devPixelsPerPx` is a string pref;
|
||||
pass the number as text, `"1.25"`, not as a bare float.
|
||||
|
||||
## Sources
|
||||
|
||||
- [MDN: `Window.devicePixelRatio`](https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio) -
|
||||
the ratio of physical pixels to CSS pixels that the property reports.
|
||||
- [MDN: the `resolution` media feature](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/resolution) -
|
||||
the `dppx` unit used in the media-query check above.
|
||||
- [Playwright: `device_scale_factor` on `browser.new_context`](https://playwright.dev/python/docs/api/class-browser#browser-new-context) -
|
||||
the per-context knob that must agree with the pref.
|
||||
- Firefox's `layout.css.devPixelsPerPx` pref itself, and the dead dpr write once shipped
|
||||
here, read from the browser's own behaviour rather than from a rendered report.
|
||||
|
||||
**See also:** [why a pref you set can quietly do nothing](firefox-prefs-not-applying.md),
|
||||
[what an impossible screen geometry gives away](screen-size-headless-tells.md), and
|
||||
[reading the CSS resolution query directly](css-media-query-fingerprinting.md).
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The dead dpr write in this
|
||||
page is one we shipped ourselves, and only caught by reading the value back.*
|
||||
@@ -0,0 +1,232 @@
|
||||
---
|
||||
title: "Anti-detect browser or Playwright stealth: which you need"
|
||||
description: "Deciding between a paid anti-detect browser and stock Playwright on a patched Firefox build: what they share, what the paid GUI adds, and how to script it."
|
||||
parent: "Comparisons"
|
||||
nav_order: 33
|
||||
---
|
||||
|
||||
|
||||
# Anti-detect browser or Playwright stealth: which you need
|
||||
|
||||
The honest version of this question is not "which one wins". It is "which
|
||||
layers do I actually need, and which am I paying for twice". A commercial
|
||||
anti-detect browser and a patched-engine library overlap on exactly one layer
|
||||
and differ on the rest, so the answer depends entirely on which layer your
|
||||
real problem lives in.
|
||||
|
||||
This page names the layers, shows where the two approaches meet and where they
|
||||
part, and gives you the runnable version of the engine layer so you can decide
|
||||
by trying rather than by reading marketing.
|
||||
|
||||
## What you are actually comparing
|
||||
|
||||
A commercial anti-detect browser is usually three things sold as one product:
|
||||
|
||||
- a **patched browser engine** that reports a consistent, human-looking
|
||||
fingerprint,
|
||||
- a **profile and identity manager** that stores many separate personas and
|
||||
keeps them apart,
|
||||
- and **proxy wiring plus IP reputation handling**, so each persona leaves
|
||||
from its own network exit.
|
||||
|
||||
All three sit behind a paid GUI, and the whole thing is built for a person
|
||||
clicking through many accounts by hand.
|
||||
|
||||
Stock Playwright driving an open patched Firefox build gives you the first of
|
||||
those three, scriptably, in Python. You get the same engine-level fingerprint
|
||||
spoofing. What you do not get for free is the profile manager and the proxy or
|
||||
reputation layer - the library deliberately leaves those to you, because in
|
||||
code you usually already have your own way of storing state and choosing an
|
||||
exit.
|
||||
|
||||
So the real question is not "GUI or library". It is: **is your bottleneck the
|
||||
engine, or is it the network and the identities?** If it is the engine, the two
|
||||
approaches are equivalent and one of them is free and scriptable. If it is the
|
||||
network, the engine choice will not move the needle at all.
|
||||
|
||||
## The layer they share: a patched engine
|
||||
|
||||
This is the part that overlaps, and it is worth being precise about what
|
||||
"patched engine" buys you, because it is the same thing in both cases.
|
||||
|
||||
A real browser reports hundreds of correlated values: the GPU string and the
|
||||
pixels it actually draws, the audio device, the installed fonts, the screen
|
||||
geometry, the codecs, the TLS handshake, and the driver layer that automation
|
||||
frameworks usually announce themselves through - the best-known example being
|
||||
[`navigator.webdriver`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/webdriver),
|
||||
a specified boolean a real user's browser never sets. A patched engine makes those
|
||||
read as a genuine Firefox driven by a person, and - this is the part a page
|
||||
script cannot do - keeps them **consistent with each other**, because most
|
||||
detection is a cross-check between two values that should agree rather than a
|
||||
lookup of one unusual value. See
|
||||
[what a browser fingerprint is made of](what-is-a-browser-fingerprint.md) for
|
||||
the surfaces involved.
|
||||
|
||||
This is also why the engine layer beats the stealth-plugin layer, in a GUI
|
||||
product or a library alike. A JavaScript patch applied to a page runs after the
|
||||
browser has already answered the network and driver questions, and stacking two
|
||||
spoofers produces a contradiction neither produces alone -
|
||||
[picking one stealth layer](playwright-stealth-levels.md) is the whole game.
|
||||
The engine layer answers those questions before any page loads, which is why
|
||||
this project patches Firefox at the C++ level instead of injecting scripts. The
|
||||
same reasoning shows up when you compare
|
||||
[a patched Firefox against a patched Chromium](firefox-vs-chromium-antidetect.md)
|
||||
or against [another Firefox-based build](vs-camoufox.md): the durable difference
|
||||
is always where the patch lives, not the brand on the box.
|
||||
|
||||
## The layers the paid product adds: proxy and identity management
|
||||
|
||||
Here is where the paid GUI earns its money, and where the library asks you to
|
||||
bring your own.
|
||||
|
||||
A commercial anti-detect browser stores dozens or hundreds of profiles, assigns
|
||||
each a proxy, and tries to keep the exit IPs clean and separated so two
|
||||
personas never share a fingerprint-plus-network story. For a human running many
|
||||
accounts by hand, that management surface is the product, and rebuilding it in
|
||||
code is real work.
|
||||
|
||||
A library hands you the engine and stops there. You supply the proxy per
|
||||
session, you decide how identities are stored and rotated, and you own the IP
|
||||
quality. That is a feature when you are automating: you plug the exit into your
|
||||
own pipeline instead of clicking through a vendor's UI. It is a cost when what
|
||||
you actually wanted was the vendor's managed clean IPs, because a patched engine
|
||||
does not include any.
|
||||
|
||||
The dividing line is clean: **the engine makes you look real; the proxy and
|
||||
identity layer decides whether "real" is enough.** The library gives you the
|
||||
first outright and leaves the second as an explicit input.
|
||||
|
||||
## Doing it in code: the two-line version
|
||||
|
||||
If your bottleneck is the engine, this is the whole switch. Any existing
|
||||
Playwright script becomes a stealthed one by changing how the browser launches;
|
||||
nothing after that line changes, because the object you get back is a real
|
||||
Playwright [`Browser`](https://playwright.dev/python/docs/api/class-browser).
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
# seed=42 makes the identity reproducible: same GPU, canvas, audio,
|
||||
# fonts and screen on every run, so a failing run can be replayed exactly.
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
print(page.title())
|
||||
```
|
||||
|
||||
You supply the proxy - the identity/network layer the paid product would manage
|
||||
for you - as a plain dict. This is the part the library leaves in your hands on
|
||||
purpose:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
proxy = {
|
||||
"server": "socks5://gate.example.com:1080",
|
||||
"username": "user",
|
||||
"password": "pass",
|
||||
}
|
||||
|
||||
# timezone defaults to auto, derived from the proxy's egress IP, so the
|
||||
# browser's zone matches where the network says you are.
|
||||
with InvisiblePlaywright(seed=42, proxy=proxy) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
page.click("#submit") # pointer arcs to the target on a Bezier curve
|
||||
```
|
||||
|
||||
The async API is identical in shape (`from invisible_playwright.async_api
|
||||
import InvisiblePlaywright`, then `await page.goto(...)`), and every standard
|
||||
Playwright method works unchanged because there is no wrapped subset to learn.
|
||||
Install is the ordinary way, and the engine downloads itself on first use:
|
||||
|
||||
```bash
|
||||
pip install invisible-playwright
|
||||
```
|
||||
|
||||
That is the engine layer, in full, scriptable. What it does not print is a
|
||||
managed clean IP - you passed that in yourself.
|
||||
|
||||
## The honest caveat: the engine will not fix your IP
|
||||
|
||||
This is the sentence that decides most buy-versus-code questions, so it gets its
|
||||
own section.
|
||||
|
||||
invisible_playwright is designed to look like a real browser driven by a real
|
||||
person, and that is precisely why it clears most detection: the fingerprint,
|
||||
the TLS handshake and the driver layer read as a genuine Firefox. It does not,
|
||||
on its own, fix **IP reputation, per-account quotas, rate limits, or the timing
|
||||
and behaviour of the session**. Those are yours to supply - a clean proxy,
|
||||
human pacing, sensible request velocity.
|
||||
|
||||
A perfect browser on a datacenter IP, or on a residential IP a thousand other
|
||||
people are using this minute, still loses, and no engine choice changes that.
|
||||
If your manual visit from the same machine and network also gets the wrong
|
||||
page, the problem was never the browser -
|
||||
[why a clean fingerprint still gets blocked](why-blocked-with-a-clean-fingerprint.md)
|
||||
is the whole story. This is the same layer a paid product's proxy management is
|
||||
selling, and it is the one honest reason to reach for the GUI: if IP quality is
|
||||
your real bottleneck, the engine will not fix it, and you should be buying
|
||||
network reputation, not a browser.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Buy the GUI when you are a person managing many accounts by hand and you want
|
||||
the profile store and managed clean exits handled for you. Use the library when
|
||||
you want programmatic control and you already have, or can build, your own
|
||||
identity and proxy plumbing - you get the same patched engine, in Python, for
|
||||
free, and you keep the network layer under your own pipeline.
|
||||
|
||||
The overlap is the engine. The paid extra is the network and identity
|
||||
management the library deliberately leaves to you. Decide by naming which of
|
||||
those two is actually blocking you today, and the answer stops being a matter of
|
||||
taste.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Do I need an anti-detect browser at all?** Only for the engine layer, and a
|
||||
patched Firefox build gives you that scriptably. If you need managed proxies and
|
||||
a many-account GUI, the paid product bundles those on top.
|
||||
|
||||
**Is stock Playwright enough by itself?** For the fingerprint, only with a
|
||||
patched engine under it - plain Playwright announces itself at the driver and
|
||||
network layers. For IP reputation and behaviour, no tool is enough; you supply
|
||||
those.
|
||||
|
||||
**Will a patched engine fix my blocks?** It fixes fingerprint, TLS and driver
|
||||
tells, which is most detection. It does not fix a bad IP, a blown quota, or
|
||||
robotic timing.
|
||||
|
||||
**What does the paid product do that the library does not?** It manages
|
||||
profiles at scale and wires up proxies with some IP reputation handling behind a
|
||||
GUI. The library leaves proxy and identity choice to your code on purpose.
|
||||
|
||||
**Can I get reproducible identities in code?** Yes - pass `seed=42` and every
|
||||
fingerprint field comes back identical run after run, which is what makes a
|
||||
failing run replayable.
|
||||
|
||||
**If IP quality is my problem, does any of this help?** No. The engine choice is
|
||||
orthogonal to network reputation. Buy or rent clean exits; the browser layer
|
||||
cannot substitute for them.
|
||||
|
||||
## Sources
|
||||
|
||||
- This project's [Quickstart](quickstart.md) and [Configuration](configuration.md)
|
||||
pages, for the real launch API, proxy dict and timezone behaviour shown above.
|
||||
- The troubleshooting order in
|
||||
[Playwright detected as a bot on one site](playwright-detected-as-bot.md),
|
||||
which ranks engine tells above IP as the more common and cheaper fix, and IP
|
||||
reputation as the last and most expensive suspect.
|
||||
- [MDN: `Navigator.webdriver`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/webdriver)
|
||||
and [Playwright's `Browser` class reference](https://playwright.dev/python/docs/api/class-browser),
|
||||
for the driver-layer property and the object the launch call above returns.
|
||||
|
||||
**See also:** [what a browser fingerprint is made of](what-is-a-browser-fingerprint.md),
|
||||
[choosing a single stealth layer](playwright-stealth-levels.md), and
|
||||
[why a clean fingerprint can still be blocked](why-blocked-with-a-clean-fingerprint.md).
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The engine layer
|
||||
is the part I can hand you; the clean IP is the part you still have to bring.*
|
||||
@@ -0,0 +1,213 @@
|
||||
---
|
||||
title: "Do websites know you are using a script?"
|
||||
description: "How sites detect scripts driving the browser: navigator.webdriver, CDP, BiDi artifacts, synthetic events and timing tells. What hides automation-layer reveals."
|
||||
parent: "Detectors, Explained"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 13
|
||||
---
|
||||
|
||||
|
||||
# Do websites know you are using a script?
|
||||
|
||||
Often, yes, and usually not for the reason people assume. The fingerprint gets most
|
||||
of the attention, but a site can tell a script is driving the browser through a
|
||||
separate set of tells that have nothing to do with the GPU, the fonts or the screen.
|
||||
These are automation-layer tells, and they answer a narrower question than "who are
|
||||
you": they answer "is a program at the wheel".
|
||||
|
||||
The honest version of the answer is that these tells are fixable, and that fixing them
|
||||
does not make you invisible. It removes the announcement that a script is present. It
|
||||
does not remove a datacenter IP, a per-account quota, or the fact that you filled a
|
||||
form in eighty milliseconds. This page covers the announcement, and is clear about
|
||||
where the announcement ends.
|
||||
|
||||
## The four tells that say "a script is here"
|
||||
|
||||
None of these depend on your fingerprint. A browser with a flawless machine identity
|
||||
still trips every one of them if the automation layer is careless.
|
||||
|
||||
- **`navigator.webdriver`.** A boolean the automation standard requires the browser to
|
||||
set to `true` when a driver is attached. It is the single most checked automation
|
||||
flag on the web, it is one line to read, and [setting it to `false` is not the fix a
|
||||
real browser reports `undefined`](navigator-webdriver-explained.md).
|
||||
- **CDP or BiDi artifacts.** The remote control protocols that most drivers speak leave
|
||||
observable traces: extra objects on the page, timing side effects, a debugger that is
|
||||
attached. A page can probe for the protocol itself rather than for any property it
|
||||
sets, which is [why CDP and BiDi have their own detection surface](bidi-vs-cdp-detection.md).
|
||||
- **Synthetic events with `isTrusted` false.** Every DOM event carries an `isTrusted`
|
||||
flag. The browser sets it to `true` for events it generated from real hardware input
|
||||
and `false` for events created in JavaScript. A driver that clicks by dispatching a
|
||||
synthetic event produces `isTrusted: false`, and [that flag cannot be forged from
|
||||
page script](playwright-clicks-istrusted.md).
|
||||
- **Unnaturally regular timing.** Keystrokes at a perfectly uniform interval, a click
|
||||
the same number of milliseconds after every load, requests on a fixed period. This
|
||||
one is different from the other three: it is not something the browser leaks, it is
|
||||
something your code produces.
|
||||
|
||||
The first three are properties of the automation plumbing. The fourth is a property of
|
||||
how you drive. That distinction is the whole point of this page.
|
||||
|
||||
## Why invisible_playwright does not expose the first three
|
||||
|
||||
invisible_playwright is a Firefox patched at the C++ level, driven by stock Playwright
|
||||
over a patched protocol. The design goal is that the browser looks like a real Firefox
|
||||
driven by a real person, and the automation layer is where "driven by a real person"
|
||||
is won or lost.
|
||||
|
||||
The control channel does not present the driver tells that a normal automation setup
|
||||
exposes: `navigator.webdriver` reads the way a clean browser reads, and the protocol
|
||||
the wrapper speaks to the engine is not the one the common protocol probes are looking
|
||||
for. More importantly, input is not synthesized in page script. Clicks and keystrokes
|
||||
are routed through the browser's real input pipeline, so the events a page sees are
|
||||
generated by the engine the same way a physical mouse or keyboard would generate them.
|
||||
That means `isTrusted` is genuinely `true`, because the event genuinely came through
|
||||
the trusted path, not because a flag was patched.
|
||||
|
||||
Switching from plain Playwright to this is two lines, and every Playwright method works
|
||||
unchanged afterwards:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
page.fill("#name", "Ada Lovelace") # keystrokes go through the real input path
|
||||
page.click("#submit") # a genuinely trusted click, isTrusted true
|
||||
```
|
||||
|
||||
The `browser` object is a real Playwright `Browser`, so there is no reduced API to
|
||||
learn. The `seed=42` argument makes the machine identity reproducible, which matters
|
||||
for debugging: the same seed gives the same browser every run, so a failing run can be
|
||||
replayed instead of guessed at.
|
||||
|
||||
## The tell you still own: timing and behaviour
|
||||
|
||||
Here is the caveat, stated plainly. Removing the driver tells hides that a script is
|
||||
present. It does nothing about the fourth tell, because the fourth tell is yours.
|
||||
|
||||
A trusted click that lands at the exact same offset after every page load is still a
|
||||
robot. A form filled faster than a human can read it is still a robot. A request loop
|
||||
on a metronome is still a robot. Some sites do not fingerprint the browser at all, they
|
||||
watch the session, and against those sites the quality of your pacing is the entire
|
||||
game. This is especially true for [AI agents, whose pauses can be shaped like model
|
||||
latency rather than human thought](ai-browser-agents-stealth.md).
|
||||
|
||||
You control this, which is good news, because it means the fix is in your code rather
|
||||
than in the engine. Vary the intervals. Do not act faster than a person could. Let the
|
||||
page settle before the next action. The engine gives you trusted events and human-like
|
||||
mouse arcs by default; the rhythm of when you fire them is on you.
|
||||
|
||||
```python
|
||||
import random
|
||||
import time
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
for field, value in [("#first", "Ada"), ("#last", "Lovelace")]:
|
||||
page.click(field)
|
||||
page.type(field, value, delay=random.randint(80, 220)) # per-keystroke jitter
|
||||
time.sleep(random.uniform(0.4, 1.1)) # think between fields
|
||||
page.click("#submit")
|
||||
```
|
||||
|
||||
## What this does not fix, so you supply it
|
||||
|
||||
The driver layer is one of several independent things a site checks, and being clean on
|
||||
one says nothing about the others. invisible_playwright reads as a genuine Firefox at
|
||||
the fingerprint, TLS and driver layers, which is why it passes most detection checks.
|
||||
It does not, on its own, address:
|
||||
|
||||
- **IP reputation.** A perfect browser on a known datacenter or already-blocked address
|
||||
still loses. You supply a clean exit.
|
||||
- **Per-account quotas and rate limits.** These are counted server-side against your
|
||||
account or address, and no browser property changes the count.
|
||||
- **Behaviour and timing**, covered above, which is yours to shape.
|
||||
- **The country and timezone agreeing with the exit.** The engine auto-derives the
|
||||
timezone from the egress IP so these do not drift apart, but the exit itself is a
|
||||
choice you make.
|
||||
|
||||
The rule from the rest of these notes applies here too: a suppressed signal is itself a
|
||||
signal. Hiding that a script is present is worth doing precisely because it is not the
|
||||
same as hiding everything, and treating it as a complete solution is how a clean driver
|
||||
layer ends up flagged for a metronomic click.
|
||||
|
||||
## How to confirm it on your own setup
|
||||
|
||||
Do not take a vendor's word for any of this, including ours. Open a page that reads
|
||||
these values in both invisible_playwright and a stock browser on the same machine, and
|
||||
compare the fields. Read `navigator.webdriver`. Attach a listener and read
|
||||
`event.isTrusted` on a real click versus a scripted one. The [method for testing this without fooling yourself with
|
||||
a green verdict is its own page](how-to-test-bot-detection.md), and the short version is:
|
||||
assert the signal you expect is present, do not just confirm a bad one is absent.
|
||||
|
||||
```python
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
print("webdriver:", page.evaluate("() => navigator.webdriver"))
|
||||
trusted = page.evaluate("""() => new Promise(resolve => {
|
||||
document.addEventListener('click', e => resolve(e.isTrusted), { once: true });
|
||||
})""")
|
||||
page.click("body")
|
||||
print("isTrusted:", trusted)
|
||||
```
|
||||
|
||||
Run it more than once. This domain is not deterministic, and a single green run is not
|
||||
a pass.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Websites can tell a script is driving a browser, and they do it mostly through the
|
||||
automation layer rather than the fingerprint: `navigator.webdriver`, the control
|
||||
protocol's artifacts, and untrusted synthetic events. invisible_playwright is built so
|
||||
those three do not announce themselves, because its input goes through the real pipeline
|
||||
and its protocol does not expose the driver tells. That is genuinely useful and it is
|
||||
genuinely bounded. The fourth tell, timing, is not the engine's to fix and not something
|
||||
any browser patch can hide. Get the plumbing clean with the tool, get the rhythm human
|
||||
with your code, and put both behind an exit that does not give you away on its own.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Can a website tell I am using a script?** Often yes, through automation-layer tells
|
||||
like `navigator.webdriver`, control-protocol artifacts and untrusted synthetic events,
|
||||
which are independent of your fingerprint.
|
||||
|
||||
**Does hiding navigator.webdriver make me undetectable?** No. It removes one specific
|
||||
announcement. Timing, IP reputation and rate limits are separate and remain yours to
|
||||
handle.
|
||||
|
||||
**What is isTrusted and why does it matter?** It is a per-event flag the browser sets
|
||||
`true` only for events from real input. Events synthesized in page script come back
|
||||
`false`, which flags automation. Input through the real pipeline is trusted for real.
|
||||
|
||||
**Will invisible_playwright pass every bot check?** It reads as a genuine Firefox at the
|
||||
fingerprint, TLS and driver layers, which is why it passes most. It does not fix your IP,
|
||||
your quotas, or superhuman pacing.
|
||||
|
||||
**How do I make my timing look human?** Vary intervals, add per-keystroke jitter, pause
|
||||
between actions, and never act faster than a person could read the page.
|
||||
|
||||
**Is running a script against a site illegal?** That is a question about a site's terms
|
||||
and your jurisdiction, not about detection. This page is about how detection works, not
|
||||
about permission to automate.
|
||||
|
||||
## Sources
|
||||
|
||||
- The [WebDriver specification](https://www.w3.org/TR/webdriver2/#interface) for the
|
||||
`navigator.webdriver` requirement, the [WebDriver BiDi specification](https://www.w3.org/TR/webdriver-bidi/)
|
||||
for the remote-protocol surface, and the [DOM standard](https://dom.spec.whatwg.org/#dom-event-istrusted)
|
||||
for the `isTrusted` event flag, each read from its own text rather than from a summary.
|
||||
- This project's own input path and protocol behaviour, and its release gates, from which
|
||||
the trusted-event and driver-tell claims above are measured rather than asserted.
|
||||
|
||||
**See also:** [navigator.webdriver, explained](navigator-webdriver-explained.md) for the
|
||||
one flag every site reads, [why isTrusted separates a real click from a scripted one](playwright-clicks-istrusted.md),
|
||||
and [testing detection without fooling yourself with a verdict](how-to-test-bot-detection.md).
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. It hides that a script is
|
||||
present; the pacing is still yours to get right.*
|
||||
@@ -0,0 +1,18 @@
|
||||
---
|
||||
title: "Documentation"
|
||||
description: "How to install, configure and use invisible_playwright: install and fetch the engine, the two-line switch from plain Playwright, proxy and timezone configuration, pinning specific fields, and the CLI."
|
||||
has_children: true
|
||||
nav_order: 2
|
||||
---
|
||||
|
||||
# Documentation
|
||||
|
||||
The product itself, not the browser it's built on. [Installation](installation.md)
|
||||
gets the wrapper and the engine on disk, [Quickstart](quickstart.md) is the two-line
|
||||
switch from plain Playwright, [Configuration](configuration.md) covers proxies,
|
||||
timezone and environment variables, [Pinning fingerprint fields](pinning.md) covers
|
||||
forcing specific values while leaving the rest seed-derived, and the
|
||||
[CLI reference](cli-reference.md) covers the command line.
|
||||
|
||||
If you're here to understand *why* a particular signal matters rather than how to
|
||||
configure this package, that's [Guides](guides.md) instead.
|
||||
@@ -0,0 +1,255 @@
|
||||
---
|
||||
title: "Does a proxy leak DNS? DoH and DNS leaks explained"
|
||||
description: "How a SOCKS5 proxy can leak DNS when the host resolves names locally, where DNS-over-HTTPS fits, and how to verify that names exit where the connection does."
|
||||
parent: "Network, Proxy and WebRTC"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 21
|
||||
---
|
||||
|
||||
|
||||
# Does a proxy leak DNS? DoH and DNS leaks explained
|
||||
|
||||
A proxy moves your connection to a different exit. It does not automatically move the
|
||||
step that happens before the connection: turning `example.com` into an IP address. If
|
||||
that lookup is done by your own machine while the connection leaves through the proxy,
|
||||
you have a browser whose traffic exits in one country and whose DNS queries exit from
|
||||
your real network. That split is a DNS leak, and it is one of the most common ways a
|
||||
proxied session still tells a consistent story about where you actually are.
|
||||
|
||||
This page explains where name resolution happens, the difference between remote and
|
||||
local resolution over SOCKS5, where DNS-over-HTTPS fits, how to check which one you are
|
||||
doing, and the one thing fixing the leak does not fix.
|
||||
|
||||
## Where DNS resolution actually happens
|
||||
|
||||
DNS resolution happens in one of two places: on your own host, using whatever resolver
|
||||
your operating system is configured to use, or at the proxy exit, where the proxy does
|
||||
the lookup on your behalf. Every connection to a hostname is really two steps: first a
|
||||
name is resolved to an address, then a socket is opened to that address. People think of
|
||||
a proxy as covering "the connection", but there are two connections in that sentence, and
|
||||
a proxy does not necessarily cover both.
|
||||
|
||||
In detail, the resolver step can run in one of two places:
|
||||
|
||||
- **On your host**, using whatever DNS server your operating system is configured to
|
||||
use. That is usually your ISP's resolver, or one handed to you by your local network.
|
||||
- **At the proxy exit**, where the proxy itself does the lookup on your behalf and only
|
||||
the connection details come back to you.
|
||||
|
||||
When the host resolves, the lookup packets leave from your real network before the proxy
|
||||
is ever involved. A passive observer on your network, and the resolver you queried, both
|
||||
see that you asked for `example.com` at a given second. Moments later the destination
|
||||
site sees a connection arrive from the proxy's country. Correlating those two is not
|
||||
hard, and it undoes the reason you added the proxy.
|
||||
|
||||
## Remote vs local resolution over SOCKS5
|
||||
|
||||
SOCKS5, defined in [RFC 1928](https://datatracker.ietf.org/doc/html/rfc1928), is the
|
||||
scheme where this actually has a choice, which is why it comes up here and not with plain
|
||||
HTTP proxying. The protocol lets a client send the proxy either an **address** it has
|
||||
already resolved, or a **hostname** for the proxy to resolve itself.
|
||||
|
||||
- **Local (host-side) resolution.** The client resolves `example.com` to an IP using the
|
||||
host's resolver, then tells the proxy "connect to this IP". The lookup left your
|
||||
network. This is the leak.
|
||||
- **Remote (proxy-side) resolution.** The client tells the proxy "connect to this
|
||||
hostname", and the proxy resolves it at the exit. The lookup and the connection now
|
||||
leave from the same place.
|
||||
|
||||
The trap is that the leaking version is often the default in naive setups. A lot of
|
||||
tooling resolves the hostname first out of habit and only then hands an address to the
|
||||
proxy, so the connection is proxied and the DNS is not. Nothing errors. The page loads.
|
||||
The exit IP looks right in a quick check. The lookup quietly went out your front door.
|
||||
This is the same class of silent-default problem as
|
||||
[SOCKS5 authentication that falls back to an unproxied connection](playwright-socks5-proxy-authentication.md)
|
||||
instead of failing loudly. The difference between the two schemes, and why SOCKS5 is the
|
||||
one that carries hostnames at all, is covered in
|
||||
[SOCKS5 vs HTTP proxy for a browser](socks5-vs-http-proxy-browser.md).
|
||||
|
||||
invisible_playwright resolves DNS through the proxy by default, so names and connections
|
||||
exit from the same place. There is no separate switch to remember: pass a SOCKS5 proxy
|
||||
and the hostname goes to the exit, not to your local resolver.
|
||||
|
||||
## Where DNS-over-HTTPS fits
|
||||
|
||||
DNS-over-HTTPS (DoH), standardized in
|
||||
[RFC 8484](https://datatracker.ietf.org/doc/html/rfc8484), encrypts the resolver query
|
||||
and sends it over HTTPS to a chosen resolver. It is a related but different fix from
|
||||
proxy-side resolution, and the two solve different problems.
|
||||
|
||||
Its purpose is confidentiality: your local network and your ISP can no longer read which
|
||||
hostnames you are looking up, because the query looks like ordinary HTTPS traffic to some
|
||||
server.
|
||||
|
||||
What DoH does **not** do on its own is change *where* the query exits. If the browser's
|
||||
DoH request itself goes out your real network rather than through the proxy, the encrypted
|
||||
lookup still originates from your real IP. The resolver you picked now knows the name, and
|
||||
a determined observer still sees a lookup-shaped request leaving your network at the same
|
||||
moment a proxied connection opens elsewhere. Encryption hides the *content* of the leak,
|
||||
not the *fact* of it.
|
||||
|
||||
So DoH and proxy-side resolution answer different questions:
|
||||
|
||||
- **Proxy-side resolution** decides *where the lookup exits*. It closes the geographic
|
||||
split that this whole page is about.
|
||||
- **DoH** decides *whether the lookup is readable in transit*. It is about privacy from
|
||||
the network path, not about exit location.
|
||||
|
||||
For a proxied automation session, the property you want is that the name resolves at the
|
||||
exit. When resolution happens at the proxy, the exit's own resolver handles the name, and
|
||||
the "which resolver, encrypted or not" question moves to the exit's side of the world,
|
||||
where it belongs. Firefox exposes DoH through standard `network.trr.*` about:config
|
||||
preferences if you want the encrypted-in-transit property on top, but it is not a
|
||||
substitute for resolving at the exit.
|
||||
|
||||
## Launch invisible_playwright and resolve names at the exit
|
||||
|
||||
The whole point of the product here is that the correct behaviour is the default. You pass
|
||||
a SOCKS5 proxy the ordinary way and the hostname is resolved at the exit, alongside the
|
||||
connection.
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
proxy = {
|
||||
"server": "socks5://gate.example.com:1080",
|
||||
"username": "user",
|
||||
"password": "pass",
|
||||
}
|
||||
|
||||
# seed=42 makes the whole identity reproducible run to run
|
||||
with InvisiblePlaywright(seed=42, proxy=proxy) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
print(page.title())
|
||||
```
|
||||
|
||||
The `browser` object is a real Playwright `Browser`, so every method you already use works
|
||||
unchanged. The only thing that differs from stock Playwright here is that the name in
|
||||
`page.goto(...)` is resolved through the proxy rather than by your host, so the DNS query
|
||||
and the HTTP connection both leave from `gate.example.com`'s exit and not from your
|
||||
network. Async is the same, from `invisible_playwright.async_api`.
|
||||
|
||||
If you drive `firefox.launch()` yourself instead of using this class, the same proxy dict
|
||||
has to reach the launch through `get_default_stealth_prefs(proxy=...)` so the SOCKS
|
||||
preferences that route DNS are actually written. Skipping that is how a hand-rolled setup
|
||||
ends up proxying the connection and leaking the lookup.
|
||||
|
||||
## How to verify names exit where the traffic does
|
||||
|
||||
Do not assume. The failure mode of a DNS leak is that everything looks fine, so the check
|
||||
has to be positive: confirm the lookup exit, do not just confirm the absence of an error.
|
||||
|
||||
A minimal, honest check has two halves that must agree:
|
||||
|
||||
```bash
|
||||
# 1. What does the world see your CONNECTION exit as?
|
||||
# Run this THROUGH the browser session, not with a bare curl on the host,
|
||||
# or you have measured the path you do not use.
|
||||
```
|
||||
|
||||
Inside the session, read the exit the destination actually sees:
|
||||
|
||||
```python
|
||||
with InvisiblePlaywright(seed=42, proxy=proxy) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com/ip") # any endpoint that echoes the caller IP
|
||||
print("connection exit:", page.inner_text("body"))
|
||||
```
|
||||
|
||||
Then compare that against where your **DNS** appears to resolve from, using a resolver-echo
|
||||
service that reports the address of the machine that queried it. If the connection exit and
|
||||
the resolver-side address are in the same place, resolution is happening at the exit. If the
|
||||
resolver address is your home ISP while the connection exit is the proxy's country, you have
|
||||
found the leak. This is the same "measure the real path, through the proxy, not on localhost"
|
||||
discipline described in [how to check a proxy for an IP leak](how-to-check-proxy-ip-leak.md),
|
||||
and it belongs next to the WebRTC and timezone checks, because all three fail in the same
|
||||
quiet way: a value that is individually plausible and disagrees with another value.
|
||||
|
||||
While you are checking exits, check the [timezone against the exit IP](timezone-proxy-mismatch.md)
|
||||
too. A DNS leak and a timezone mismatch are the same category of tell: two surfaces that
|
||||
should point at one location and do not.
|
||||
|
||||
## The honest caveat: this fixes the leak, not the reputation
|
||||
|
||||
Resolving names at the exit closes a specific, real gap: it stops your DNS from pointing
|
||||
at your real network while your connection points somewhere else. That is worth doing, and
|
||||
it is the default here for that reason.
|
||||
|
||||
It does not make the exit IP good. If the proxy's address is a known datacenter range, or
|
||||
is already on shared blocklists, or is a country that does not match the rest of your
|
||||
session, a perfectly consistent DNS path does not help. The name and the connection now
|
||||
exit from the *same* place, but that place can still have a bad reputation. What decides
|
||||
whether a datacenter exit is recognised as one is a separate question, covered in
|
||||
[can websites detect a datacenter proxy IP](can-websites-detect-a-datacenter-proxy-ip.md).
|
||||
|
||||
The honest framing for the whole product is the same here as everywhere: invisible_playwright
|
||||
is built to look like a real Firefox driven by a real person, which is why the fingerprint,
|
||||
the TLS handshake and the driver layer read as genuine, and why it passes most detection
|
||||
checks that inspect the browser. It does not supply a clean IP, per-account quotas, rate
|
||||
limits, or human timing. You bring a reputable exit and sane pacing; the browser brings the
|
||||
part that has to look real. A closed DNS leak is one clean surface among several, not a
|
||||
finish line.
|
||||
|
||||
## Conclusion
|
||||
|
||||
A proxy can leak DNS whenever the host resolves names locally while the connection exits
|
||||
elsewhere. Over SOCKS5 the fix is to hand the proxy a hostname to resolve at the exit rather
|
||||
than an address you resolved at home, so names and connections leave from the same place.
|
||||
DoH is a companion, not a replacement: it encrypts the lookup in transit but does not by
|
||||
itself move where the lookup exits. Verify positively, comparing the connection exit against
|
||||
the resolver-side address, and remember that closing the leak fixes location consistency,
|
||||
not the reputation of the address you exit from.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Does using a proxy hide my DNS?** Only if the proxy does the name resolution. If your
|
||||
host resolves the name and then hands the proxy an IP, the lookup left your real network
|
||||
and the connection did not, which is a DNS leak.
|
||||
|
||||
**What is the difference between remote and local DNS resolution?** Local means your machine
|
||||
resolves the hostname before contacting the proxy; remote means the proxy resolves it at the
|
||||
exit. SOCKS5 supports both, and only remote resolution keeps names and connections exiting
|
||||
together.
|
||||
|
||||
**Does DNS-over-HTTPS stop a DNS leak?** Not by itself. DoH encrypts the query so the path
|
||||
cannot read it, but if the encrypted query still leaves from your real network the leak of
|
||||
location is unchanged. It answers "is my lookup readable", not "where does my lookup exit".
|
||||
|
||||
**Does invisible_playwright leak DNS?** No. It resolves DNS through the proxy by default, so
|
||||
the name and the connection exit from the same place. You just pass a SOCKS5 proxy the normal
|
||||
way.
|
||||
|
||||
**How do I check for a DNS leak?** Positively, through the browser session and not on
|
||||
localhost. Compare the exit IP the destination sees against the address a resolver-echo
|
||||
service reports; if they disagree in location, you have a leak.
|
||||
|
||||
**If my DNS no longer leaks, am I safe?** It fixes location consistency, not IP reputation.
|
||||
A datacenter or blocklisted exit is still a datacenter or blocklisted exit after the leak is
|
||||
closed.
|
||||
|
||||
## Sources
|
||||
|
||||
- The SOCKS5 protocol's two connect modes (address versus hostname), defined in
|
||||
[RFC 1928](https://datatracker.ietf.org/doc/html/rfc1928), which is the mechanism that
|
||||
makes proxy-side resolution possible at all.
|
||||
- DNS Queries over HTTPS (DoH), standardized in
|
||||
[RFC 8484](https://datatracker.ietf.org/doc/html/rfc8484), which encrypts the resolver
|
||||
query in transit without changing where it exits.
|
||||
- This project's proxy handling, which routes DNS through the proxy by default rather than
|
||||
through the host resolver, and refuses a proxy endpoint given without an explicit port
|
||||
rather than launching unproxied.
|
||||
- The release gates behind the network pages in this set, including the exit-consistency and
|
||||
WebRTC checks, which all assert a present, correct signal rather than the absence of a
|
||||
wrong one.
|
||||
|
||||
**See also:** [how to check a proxy for an IP leak](how-to-check-proxy-ip-leak.md),
|
||||
[SOCKS5 vs HTTP proxy for a browser](socks5-vs-http-proxy-browser.md), and
|
||||
[Playwright SOCKS5 proxy with authentication](playwright-socks5-proxy-authentication.md).
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The default that keeps DNS and
|
||||
the connection exiting together is the whole point of this page; the reputation of the exit is
|
||||
still yours to bring.*
|
||||
@@ -0,0 +1,253 @@
|
||||
---
|
||||
title: "Does a VPN stop browser fingerprinting?"
|
||||
description: "A VPN changes the IP a server sees, not the browser fingerprint. Why canvas, WebGL, fonts and timezone survive the tunnel, and what actually covers the fingerprint half."
|
||||
parent: "Detectors, Explained"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 12
|
||||
---
|
||||
|
||||
|
||||
# Does a VPN stop browser fingerprinting?
|
||||
|
||||
No. A VPN changes one thing: the IP address the server sees. The browser
|
||||
fingerprint - canvas, WebGL, installed fonts, the user agent, the timezone, the
|
||||
hardware counters - is exactly what it was before you connected. Worse, a VPN can
|
||||
make a session look more suspicious rather than less, because it introduces a second
|
||||
story about where you are and gives a detector two stories to compare.
|
||||
|
||||
This page is what a VPN moves, what it leaves in place, the specific way it can
|
||||
backfire, and what has to cover the half it cannot.
|
||||
|
||||
## What a VPN actually changes
|
||||
|
||||
A VPN routes your traffic through a server somewhere else and presents that server's
|
||||
address as the origin of every request. From the server's point of view, you are in
|
||||
the country the exit sits in, on the network the exit belongs to. That is genuinely
|
||||
useful and it is the entire effect: one field, the source IP, is replaced.
|
||||
|
||||
Everything a detector reads from *inside* the page is untouched, because none of it
|
||||
travels through the tunnel as a value the VPN can rewrite. The page runs JavaScript
|
||||
on your actual machine and asks your actual browser questions. The tunnel carries the
|
||||
answers without changing them.
|
||||
|
||||
So the honest split is: a VPN is the network half. The fingerprint half is a
|
||||
different problem with a different owner.
|
||||
|
||||
## What a VPN leaves untouched
|
||||
|
||||
Open any fingerprinting report through a VPN and read the fields rather than the
|
||||
verdict. The address at the top has changed. Nothing below it has:
|
||||
|
||||
- **[Canvas](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API) and
|
||||
[WebGL](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API).** The hash of a
|
||||
rendered image and the GPU vendor and renderer strings come from your graphics stack.
|
||||
A tunnel does not touch the graphics stack.
|
||||
- **Fonts.** The installed-font list is read from the operating system. It still
|
||||
describes your real machine, and if that is a server it still describes a server.
|
||||
- **User agent and platform.**
|
||||
[`navigator.userAgent`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/userAgent),
|
||||
[`navigator.platform`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/platform),
|
||||
[`navigator.oscpu`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/oscpu)
|
||||
report the browser you are actually running.
|
||||
- **Hardware counters.**
|
||||
[`hardwareConcurrency`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/hardwareConcurrency),
|
||||
[`deviceMemory`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/deviceMemory),
|
||||
the audio device sample rate, the screen dimensions and device pixel ratio all come
|
||||
from the box the browser runs on.
|
||||
- **Timezone.**
|
||||
[`Intl.DateTimeFormat().resolvedOptions().timeZone`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat)
|
||||
reads your system clock's zone, which is set by your operating system, not by your
|
||||
exit.
|
||||
|
||||
A commercial system hashes many of these together into a stable identifier. That
|
||||
identifier is stable *across* IP changes by design, which means switching VPN exits
|
||||
does not make you a new visitor. It makes you the same visitor from a new address,
|
||||
which is its own pattern.
|
||||
|
||||
## When a VPN makes you more suspicious, not less
|
||||
|
||||
This is the part most guides skip. A VPN does not just fail to help the fingerprint
|
||||
layer. It can actively contradict itself.
|
||||
|
||||
**The timezone that does not move.** Your exit is in one country; your system clock
|
||||
is still in another. A detector reads the exit's geolocation and the browser's
|
||||
reported timezone and sees two different places. A plain browser with no VPN at least
|
||||
tells one consistent story. A VPN with an unaligned clock tells two, and disagreement
|
||||
between values that should agree is precisely
|
||||
[what timezone-versus-proxy checks look for](timezone-proxy-mismatch.md).
|
||||
|
||||
**The address that leaks past the tunnel.**
|
||||
[WebRTC](https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API) can enumerate
|
||||
network candidates directly and, depending on configuration, surface an address the
|
||||
VPN was supposed to hide, printed right next to the exit. That is the strongest
|
||||
possible contradiction: the browser volunteering the very thing the tunnel exists to
|
||||
conceal. It also fails the other way, returning nothing at all, which is itself a
|
||||
signal that something is suppressing the API. Getting these to agree is a surface of
|
||||
its own, covered in
|
||||
[making the WebRTC address match the exit](webrtc-ip-match-proxy-exit.md).
|
||||
|
||||
**The reputation the exit already carries.** A shared VPN endpoint has been used by
|
||||
thousands of other people, and a busy exit accumulates a reputation that has nothing
|
||||
to do with your fingerprint. A perfectly ordinary browser on a known-bad exit is
|
||||
detected on the exit alone.
|
||||
|
||||
None of these three is a fingerprint fix. Two of them are new ways to fail that you
|
||||
did not have before you connected.
|
||||
|
||||
## The fingerprint half: what invisible_playwright controls
|
||||
|
||||
invisible_playwright is a Firefox patched at the C++ level and driven by stock
|
||||
Playwright. It is built to look like a real browser driven by a real person, which is
|
||||
why the fingerprint, the TLS handshake and the driver layer read as a genuine
|
||||
Firefox rather than as automation. It owns the half a VPN cannot reach: it derives a
|
||||
complete, internally consistent identity - GPU, canvas, audio, fonts, screen, roughly
|
||||
400 fields - from a single seed, so the values agree with each other instead of being
|
||||
a plausible field sitting next to a contradicting one.
|
||||
|
||||
Switching from plain Playwright is a two-line change, and the browser it returns is a
|
||||
real Playwright `Browser` with every standard method:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
# proxy = the network half; the fingerprint half is handled by the engine
|
||||
proxy = {"server": "socks5://gate.example.com:1080", "username": "u", "password": "p"}
|
||||
|
||||
with InvisiblePlaywright(seed=42, proxy=proxy) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
# navigator.userAgent, canvas hash, WebGL strings, fonts and timezone
|
||||
# all describe one coherent machine, and the timezone follows the exit
|
||||
```
|
||||
|
||||
Pass a `seed` and every field it implies comes back identical run after run, so a
|
||||
session you want to reproduce is reproducible. Omit it and each session gets a
|
||||
distinct identity. Either way, the fingerprint the page reads is a coherent whole
|
||||
rather than your real machine wearing a new IP.
|
||||
|
||||
## Aligning timezone and geolocation to the exit
|
||||
|
||||
The specific failure a VPN introduces - a clock that contradicts the exit - is the
|
||||
one the engine closes automatically. By default the browser timezone is derived from
|
||||
the egress IP: the proxy exit if a proxy is set, otherwise the host's own public
|
||||
address. The clock follows the exit instead of staying pinned to the host.
|
||||
|
||||
```python
|
||||
# default: timezone auto-derived from the egress IP, so the clock matches the exit
|
||||
with InvisiblePlaywright(proxy=proxy) as browser:
|
||||
...
|
||||
|
||||
# an explicit IANA zone always wins, when you need to force one
|
||||
with InvisiblePlaywright(proxy=proxy, timezone="America/New_York") as browser:
|
||||
...
|
||||
```
|
||||
|
||||
The geolocation and locale surfaces are aligned to the same exit rather than left to
|
||||
disagree. When the network path cannot reach an external lookup, the derivation still
|
||||
resolves from a bundled dataset rather than falling back to the host's zone, which is
|
||||
[why the timezone stays correct offline](offline-geoip-timezone-proxy.md). The result
|
||||
is that the tunnel and the browser tell one story, which is what a VPN on its own
|
||||
cannot arrange.
|
||||
|
||||
## Measuring the difference
|
||||
|
||||
The claim is checkable, and checking it is the point. Run a fingerprinting report
|
||||
twice through the same exit: once with a stock Firefox pointed at the VPN, once with
|
||||
invisible_playwright pointed at the same proxy, and diff the two reports field by
|
||||
field rather than reading the scores.
|
||||
|
||||
With the stock browser, the address at the top matches the exit and the rows below it
|
||||
describe your real machine, including a timezone that may sit on a different continent
|
||||
from the address. With the engine, the address matches the exit *and* the rows below
|
||||
it describe one coherent machine whose clock, locale and geolocation sit in the same
|
||||
place as the exit. The delta is every fingerprint field plus the timezone alignment -
|
||||
which is exactly the half the VPN left untouched in the first report.
|
||||
|
||||
Run it at least ten times and space the runs out. This domain is non-deterministic,
|
||||
and a single green run is not a result.
|
||||
|
||||
## What invisible_playwright does not do
|
||||
|
||||
The honest caveat, because overclaiming is both false and a liability. The engine
|
||||
covers the fingerprint, the TLS layer and the driver tells. It does not supply the
|
||||
network half and it cannot repair it:
|
||||
|
||||
- **IP reputation.** A poor-reputation exit is detected on its own, whatever the
|
||||
fingerprint looks like. You supply a clean proxy; the engine does not launder a
|
||||
dirty one.
|
||||
- **Per-account quotas and rate limits.** These are counted server-side against your
|
||||
account or your address, not read from the browser. Pacing is yours to manage.
|
||||
- **Behaviour and timing.** Pointer motion is generated on a Bezier curve, but the
|
||||
rhythm of a whole session - how fast you move between actions, whether an agent
|
||||
pauses in a shape that looks like model latency - is yours to shape.
|
||||
|
||||
The framing that holds up: a VPN is the network half and invisible_playwright is the
|
||||
fingerprint half. You need both, and a clean exit and human pacing on top of both.
|
||||
|
||||
## Conclusion
|
||||
|
||||
A VPN answers exactly one question a detector asks - where is this request coming
|
||||
from - and leaves every other question answered by your real machine. On a bad day it
|
||||
adds two contradictions, a stranded timezone and a WebRTC leak, that a plain browser
|
||||
would not have produced. It is a necessary piece and not a sufficient one.
|
||||
|
||||
Cover the fingerprint layer with something built to look like a real browser, align
|
||||
the clock and geolocation to the exit so the two halves agree, put a clean IP under
|
||||
it, and pace the session like a person. A VPN does one of those four. Treat it as one
|
||||
of four, not as the answer, and it does its job.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Does a VPN change my browser fingerprint?** No. It changes the source IP and
|
||||
nothing the page reads from inside the browser: canvas, WebGL, fonts, user agent,
|
||||
timezone and hardware are unchanged.
|
||||
|
||||
**Can a VPN make detection worse?** Yes. If your system timezone does not match the
|
||||
exit, or WebRTC leaks an address past the tunnel, you have handed a detector a
|
||||
contradiction it would not otherwise have.
|
||||
|
||||
**Is a VPN the same as a proxy here?** For this purpose, close enough: both replace
|
||||
the visible IP and neither touches the fingerprint. The engine takes a proxy directly
|
||||
and aligns the browser's timezone to that exit.
|
||||
|
||||
**Will a VPN hide that I am automating?** No. Automation tells and the fingerprint
|
||||
live in the browser, not the network. The address is the one thing the tunnel moves.
|
||||
|
||||
**Do I still need a good IP if my fingerprint is perfect?** Yes. A coherent browser
|
||||
on a known-bad exit is detected on the exit alone. The two halves are independent.
|
||||
|
||||
**Does invisible_playwright include a VPN or proxy?** No. It handles the fingerprint,
|
||||
TLS and driver layers and aligns the timezone to whatever exit you pass. You supply
|
||||
the clean IP.
|
||||
|
||||
## Sources
|
||||
|
||||
- This project's release gates, including the WebRTC gate whose negative-only checks
|
||||
once passed on a feature that was returning nothing, and the timezone derivation
|
||||
that resolves the zone from the egress address.
|
||||
- The public fingerprinting suites - CreepJS, BotD, FingerprintJS, sannysoft and
|
||||
BrowserLeaks - read field by field before and after a VPN, which is where the
|
||||
"one field changed, the rest did not" observation comes from.
|
||||
- [MDN: `Navigator.userAgent`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/userAgent),
|
||||
[`Navigator.platform`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/platform)
|
||||
and [`Navigator.oscpu`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/oscpu),
|
||||
the browser-reported properties a VPN cannot rewrite.
|
||||
- [MDN: `Navigator.hardwareConcurrency`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/hardwareConcurrency),
|
||||
[`Navigator.deviceMemory`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/deviceMemory)
|
||||
and [`Intl.DateTimeFormat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat),
|
||||
the hardware and clock surfaces read straight from the host.
|
||||
- [MDN: the Canvas API](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API),
|
||||
[the WebGL API](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API) and
|
||||
[the WebRTC API](https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API), the
|
||||
graphics and networking surfaces a tunnel does not reach.
|
||||
|
||||
**See also:** [when the timezone does not match the proxy](timezone-proxy-mismatch.md)
|
||||
for the contradiction a VPN introduces, and
|
||||
[what no in-page test can see about the TLS handshake](ja3-ja4-tls-fingerprint.md) for
|
||||
the network layer neither a VPN nor a fingerprint fix reaches from JavaScript.
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The fingerprint half is
|
||||
what it controls; the clean IP and the human pacing are still yours to supply.*
|
||||
@@ -0,0 +1,209 @@
|
||||
---
|
||||
title: "Does chaining two proxies help avoid detection?"
|
||||
description: "Chaining two proxies hides your origin from the first operator, but the target only ever scores the last exit IP - here is what a proxy chain changes and what it does not."
|
||||
parent: "Network, Proxy and WebRTC"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 27
|
||||
---
|
||||
|
||||
# Does chaining two proxies help avoid detection?
|
||||
|
||||
Chaining proxies is one of those ideas that sounds like it should stack: if one hop
|
||||
hides you, two hops must hide you more, and a site scoring your traffic should see
|
||||
something twice as clean. It is a reasonable intuition and it is measuring the wrong
|
||||
thing.
|
||||
|
||||
The target of your request sees exactly one address: the exit of the last hop. It has
|
||||
no way to know whether that packet reached the last hop directly from your machine or
|
||||
through five relays first, because a chain is invisible past its final link. So the
|
||||
question this page answers honestly: a chain changes who can trace the traffic back to
|
||||
you, not what the destination scores. Those are two different goals, and only one of
|
||||
them is about detection.
|
||||
|
||||
## What the destination actually sees
|
||||
|
||||
A web server terminates a TCP connection from one peer. That peer is whatever machine
|
||||
opened the socket to it, which for a proxied request is the last hop's exit. Every
|
||||
signal the server can derive from the network layer - the source IP, its
|
||||
[ASN and reputation](can-websites-detect-a-datacenter-proxy-ip.md), the reverse DNS,
|
||||
the country, whether the range is residential or datacenter - is a property of that one
|
||||
exit and nothing behind it.
|
||||
|
||||
Add a second proxy in front of the first and the picture at the destination does not
|
||||
move. The exit is still the exit. If that final IP sits in a flagged datacenter range,
|
||||
a second hop upstream of it does not launder the range, because the range that gets
|
||||
scored is the one the packet leaves from. If the final IP is a clean residential
|
||||
address, one hop or three hops behind it score identically.
|
||||
|
||||
This is the specific fact worth internalising: **the number of hops is not a field the
|
||||
target can read.** It reads the last one and stops.
|
||||
|
||||
## Where a chain genuinely helps: who can trace you
|
||||
|
||||
A chain is not useless. It solves a real problem, just not the detection one.
|
||||
|
||||
With a single proxy, the operator of that proxy sees both ends: your real address on
|
||||
the way in and the destination on the way out. They can correlate the two. Chaining
|
||||
splits that knowledge across operators. The first hop sees your origin but not your
|
||||
destination; the last hop sees your destination but not your origin. No single operator
|
||||
holds both halves unless they collude or share ownership.
|
||||
|
||||
That is an operational-privacy property, and it is a real one:
|
||||
|
||||
- **Trust splitting.** You stop trusting any one provider with the full picture of who
|
||||
is talking to what.
|
||||
- **Jurisdiction separation.** Placing hops in different legal jurisdictions raises the
|
||||
cost of compelling a single operator to hand over a correlation that no single
|
||||
operator has.
|
||||
- **Origin concealment from the entry node.** If you do not want the entry provider to
|
||||
log your real IP against your traffic, a hop in front of it removes that link.
|
||||
|
||||
None of these change the score the destination computes. They change who could later
|
||||
reconstruct the path. If your goal is "this site should not treat me as automated," a
|
||||
chain does not address it. If your goal is "no single intermediary can build a profile
|
||||
of my origin plus my destinations," a chain is exactly the tool.
|
||||
|
||||
## What a chain costs
|
||||
|
||||
Two hops are not free, and the costs land on the axes detection actually watches.
|
||||
|
||||
**Latency stacks.** Every hop adds a round trip and its own processing delay. A chain
|
||||
that crosses two continents can add hundreds of milliseconds per request. Slow,
|
||||
irregular response times are themselves a weak behavioural signal, and they make
|
||||
human-like pacing harder to hit because your own timing floor is now higher and noisier.
|
||||
|
||||
**Failure points multiply.** A single proxy is one thing that can drop, throttle, or
|
||||
inject. A chain is two, in series, and the compound reliability is the product of the
|
||||
two. If each hop is up 99 percent of the time, the chain is up about 98 percent, and a
|
||||
mid-session hop failure looks to the site like an abandoned or truncated session.
|
||||
|
||||
**The weakest exit still governs the score.** You can put a pristine entry node in front
|
||||
of a tired, over-shared exit and gain nothing at the destination, because the exit is
|
||||
what gets measured. Spending effort on the hop the target cannot see, while the hop it
|
||||
can see stays dirty, is the common way a chain disappoints.
|
||||
|
||||
## How invisible_playwright fits: one server, chain built upstream
|
||||
|
||||
invisible_playwright routes the browser to a single proxy server. It writes the
|
||||
[SOCKS](https://datatracker.ietf.org/doc/html/rfc1928) or HTTP preferences for one
|
||||
endpoint and sends traffic there. It does not build a chain inside the browser, and
|
||||
there is no per-request multi-hop setting to configure, because a chain is an upstream
|
||||
network arrangement, not a browser feature.
|
||||
|
||||
If you want a chain, you build it below the address you hand the wrapper: the endpoint
|
||||
you configure is the entry to your chain, and whatever it forwards to is your business
|
||||
and invisible to both the browser and the destination. From the wrapper's point of view
|
||||
it is one server - the same single `server` plus optional credentials shape that
|
||||
[Playwright itself documents](https://playwright.dev/python/docs/network#http-proxy)
|
||||
for launching a browser, passed straight through.
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
# One endpoint. If this endpoint happens to be the entry of a chain you run
|
||||
# upstream, the browser neither knows nor needs to - it sees a single hop.
|
||||
proxy = {
|
||||
"server": "socks5://entry.example.com:1080",
|
||||
"username": "user",
|
||||
"password": "pass",
|
||||
}
|
||||
|
||||
with InvisiblePlaywright(seed=42, proxy=proxy) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
# Read back the address the destination actually attributes to you -
|
||||
# this is the LAST hop's exit, whatever sits behind it.
|
||||
print(page.inner_text("body"))
|
||||
```
|
||||
|
||||
The `browser` returned is a real Playwright `Browser`; every documented method works
|
||||
unchanged. The important line is the last one: point it at a service that echoes the
|
||||
requesting IP and you will read the exit of your chain, the same single address the
|
||||
destination reads. Confirm it inside the browser rather than assuming it, and let
|
||||
[the browser timezone auto-derive from that exit](timezone-proxy-mismatch.md) so the
|
||||
address and the clock tell the same story.
|
||||
|
||||
## Why the fingerprint is the part chaining cannot touch
|
||||
|
||||
Here is the honest framing of what this product does and does not do.
|
||||
|
||||
invisible_playwright is a Firefox patched at the C++ level and driven by stock
|
||||
Playwright, built to look like a real browser operated by a real person. That is why it
|
||||
passes most detection checks that live in the browser: the fingerprint (GPU, canvas,
|
||||
audio, fonts, screen, roughly 400 fields, seed-reproducible), the TLS handshake and the
|
||||
driver layer all read as a genuine Firefox rather than an automated one. A CreepJS,
|
||||
BotD, FingerprintJS or sannysoft run reads it as an ordinary browser because at those
|
||||
layers it is one.
|
||||
|
||||
A proxy chain sits entirely below all of that. It cannot improve a fingerprint, because
|
||||
the fingerprint is computed in the browser and shipped over whatever network you use. It
|
||||
cannot fix a datacenter exit's reputation, per-account quotas, rate limits, or the
|
||||
timing of your behaviour. Those are yours to supply: a clean exit,
|
||||
[the right kind of proxy for the job](residential-datacenter-mobile-proxies-explained.md),
|
||||
human pacing, and quotas you respect.
|
||||
|
||||
So the two layers are orthogonal. The browser makes you look like a real person's
|
||||
browser. The exit IP decides whether that browser is arriving from an address the site
|
||||
trusts. A chain rearranges trust among your proxy operators and does nothing to either
|
||||
of those. If the exit is bad, chaining behind it does not help; the fix is a better
|
||||
exit, or [rotating exits deliberately rather than accidentally](how-to-rotate-proxies-playwright.md).
|
||||
|
||||
## Conclusion
|
||||
|
||||
Chaining two proxies is a privacy tool, not a detection tool. It changes who can trace
|
||||
your traffic back to you by splitting that knowledge across operators and jurisdictions,
|
||||
and it does so at the cost of latency and an extra failure point. What it does not
|
||||
change is the one thing the destination measures: the last exit's IP, its ASN and its
|
||||
reputation. That value is identical whether one hop or three sit behind it.
|
||||
|
||||
If you are being scored as automated, look at the exit's reputation and the browser's
|
||||
realness, not the number of hops. invisible_playwright handles the browser realness and
|
||||
routes to a single server; the chain, if you want one, is something you build upstream
|
||||
of that server for reasons that have nothing to do with the site's verdict.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Does chaining two proxies make me harder to detect?** Not at the destination. It sees
|
||||
only the last exit IP, so the chain behind it is invisible to the site's scoring.
|
||||
|
||||
**Then what is a proxy chain good for?** Hiding your origin from the first proxy
|
||||
operator and splitting trust across operators and jurisdictions, so no single
|
||||
intermediary sees both your origin and your destination.
|
||||
|
||||
**Will a chain clean up a bad exit IP?** No. The final hop is what gets scored. A clean
|
||||
entry node in front of a flagged exit gains nothing at the target.
|
||||
|
||||
**Does invisible_playwright support multi-hop proxies?** It routes to one server. A
|
||||
chain is built upstream of the endpoint you configure, not inside the browser, and the
|
||||
browser sees a single hop.
|
||||
|
||||
**What is the cost of chaining?** Added latency at every hop and a second serial failure
|
||||
point, so the compound uptime drops and your timing floor rises.
|
||||
|
||||
**If chaining does not help detection, what does?** A trustworthy exit IP plus a browser
|
||||
that reads as a real one at the fingerprint, TLS and driver layers, together with human
|
||||
pacing and quotas you respect.
|
||||
|
||||
## Sources
|
||||
|
||||
- This project's proxy handling, which configures a single endpoint per session and
|
||||
auto-derives the browser timezone from that endpoint's egress.
|
||||
- The network-layer fact that a TCP peer is the last hop only: a destination reads the
|
||||
exit's address and cannot enumerate hops behind it.
|
||||
- The release gates that measure fingerprint realness in the browser, which is a layer
|
||||
no proxy arrangement touches in either direction.
|
||||
- [RFC 1928, "SOCKS Protocol Version 5"](https://datatracker.ietf.org/doc/html/rfc1928),
|
||||
the protocol a proxy endpoint speaks.
|
||||
- [Playwright's own proxy configuration docs](https://playwright.dev/python/docs/network#http-proxy),
|
||||
which document the single-endpoint `server`/`username`/`password` shape used above.
|
||||
|
||||
**See also:** [can websites detect a datacenter proxy IP](can-websites-detect-a-datacenter-proxy-ip.md),
|
||||
[sticky versus rotating proxy sessions](sticky-vs-rotating-proxy-sessions.md), and
|
||||
[why you might still be blocked with a clean fingerprint](why-blocked-with-a-clean-fingerprint.md).
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The browser is built to
|
||||
look real; the exit IP is still yours to choose, and a chain changes who can trace it,
|
||||
not what the site scores.*
|
||||
@@ -0,0 +1,201 @@
|
||||
---
|
||||
title: "Does clearing cookies stop fingerprint tracking?"
|
||||
description: "No. Cookies are stateful and clearable, but fingerprinting is stateless and rebuilds the same identity from canvas, WebGL, fonts, audio and TLS every clear."
|
||||
parent: "Browser Identity"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 27
|
||||
---
|
||||
|
||||
|
||||
# Does clearing cookies stop fingerprint tracking?
|
||||
|
||||
Short version: no. Clearing cookies deletes something the site handed you and asked
|
||||
you to hold. Fingerprinting never handed you anything to delete. It reads what your
|
||||
browser is, every time you show up, and rebuilds the same identifier from scratch.
|
||||
That is not an accident of the design, it is the whole point of it: fingerprinting
|
||||
exists precisely because cookies can be cleared and it wanted an identifier that
|
||||
could not.
|
||||
|
||||
This page explains the difference between the two, why the second one ignores the
|
||||
first, what does change the identity, and where the honest limits of the fingerprint
|
||||
layer are.
|
||||
|
||||
## What a cookie is, and what a fingerprint is
|
||||
|
||||
A cookie is state. The site writes a value into your browser, your browser stores it,
|
||||
and it sends it back on the next request. Because it is stored, it can be deleted, and
|
||||
when you clear it the site has to start over. This is a real, working privacy control
|
||||
for the thing it controls.
|
||||
|
||||
A fingerprint is not stored anywhere on your machine for you to clear. It is computed
|
||||
on the spot from properties your browser exposes: how it draws a
|
||||
[canvas](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL),
|
||||
which GPU and renderer string it reports through
|
||||
[WebGL](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_debug_renderer_info),
|
||||
which fonts it can load, how its
|
||||
[audio stack](https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API)
|
||||
processes a signal, and, below the page entirely, how its TLS handshake looks. The
|
||||
site hashes those together into an identifier. There is no file to remove because none
|
||||
of it was ever written down on your side.
|
||||
|
||||
So the two answer different questions. A cookie asks "did I give you a token before?"
|
||||
A fingerprint asks "are you the same machine as before?" Clearing the first has no
|
||||
effect on the second.
|
||||
|
||||
## Why fingerprinting survives the clear
|
||||
|
||||
Stateful versus stateless is the entire story.
|
||||
|
||||
Clear your cookies, clear local storage, open a private window, and then reload a
|
||||
fingerprinting page. The canvas still draws the same pixels, so it hashes to the same
|
||||
value. WebGL still reports the same renderer. The font probe still finds the same
|
||||
list. The audio path still returns the same numbers. Combine those and you get the
|
||||
same identifier you had five minutes ago, because none of the inputs changed. The
|
||||
[FingerprintJS visitor ID is a hash of exactly these components](fingerprintjs-visitor-id.md),
|
||||
and a hash of unchanged inputs is unchanged output.
|
||||
|
||||
This is why "clear cookies between sessions" does not rotate you a new identity. It
|
||||
rotates the one thing that was trivial to rotate and leaves untouched every signal
|
||||
that was hard to. A detector that leans on the fingerprint rather than the cookie is
|
||||
built specifically to not care what you did to your storage.
|
||||
|
||||
The corollary matters for automation: if you run a loop that clears cookies between
|
||||
iterations expecting to look like a fresh visitor each time, every iteration presents
|
||||
the identical fingerprint. You have not created many visitors, you have created one
|
||||
visitor who keeps deleting their cookies, which is itself a pattern.
|
||||
|
||||
## What actually changes the identity
|
||||
|
||||
If the identifier is a hash of canvas, WebGL, fonts, audio and TLS, then the only way
|
||||
to present a different identity is to change those underlying values so they hash
|
||||
differently, and to change them together so they still agree with one another. A canvas
|
||||
that says one machine next to a font list that says another is not a new identity, it
|
||||
is a contradiction, and [contradictions are what the tampering-focused suites look for](creepjs-explained.md).
|
||||
|
||||
That is a much harder thing to do than emptying a cookie jar, which is the reason a
|
||||
cookie clear can never do it. The cleared browser still renders canvas the same way and
|
||||
still reports the same fonts. Changing those values in a self-consistent way is what a
|
||||
fingerprint-management layer is for, and it is what invisible_playwright does per seed.
|
||||
|
||||
## Doing it with invisible_playwright
|
||||
|
||||
The product gives each seed a distinct, internally self-consistent fingerprint: a
|
||||
different GPU, canvas hash, audio context, font set and screen, all derived together
|
||||
so they agree with each other. Switching seeds is what a cookie clear is trying and
|
||||
failing to be.
|
||||
|
||||
The launch is the standard two-line change, and the object you get back is a real
|
||||
Playwright `Browser` with every method intact:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
# Seed A: one self-consistent machine
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
# canvas, WebGL, fonts, audio all derived from seed 42
|
||||
|
||||
# Seed B: a genuinely different machine, not the same one with cookies wiped
|
||||
with InvisiblePlaywright(seed=1337) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
# different canvas hash, different renderer, different fonts
|
||||
```
|
||||
|
||||
Two different seeds produce two different fingerprints. The same seed produces the
|
||||
same one every run, which is the property that makes a failing run reproducible
|
||||
instead of a guess:
|
||||
|
||||
```python
|
||||
# Same seed, same identity, every run - the opposite of "clear and hope"
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
# identical canvas hash and renderer to any other seed=42 run
|
||||
```
|
||||
|
||||
If you want an identity to persist across separate sessions on purpose, that is a
|
||||
profile decision rather than a cookie one: see [persistent profiles](persistent-profiles.md)
|
||||
for keeping the same seed and storage across runs, and [cross-platform canvas and WebGL consistency](canvas-webgl-cross-platform-consistency.md)
|
||||
for why the drawn pixels have to match the reported hardware on every OS you deploy to.
|
||||
|
||||
## The honest caveat: this is the fingerprint layer only
|
||||
|
||||
A distinct, self-consistent fingerprint is what makes invisible_playwright read as a
|
||||
genuine Firefox driven by a real person, and it is why it passes most fingerprint, TLS
|
||||
and driver-layer checks. It is not a claim that everything about you rotates when the
|
||||
seed does.
|
||||
|
||||
Two things are tracked independently of both cookies and fingerprint, and the reader
|
||||
supplies the answers to them:
|
||||
|
||||
- **Your IP and its reputation.** A brand-new fingerprint arriving from the same
|
||||
datacenter address as the last hundred requests is still that address. The exit is
|
||||
yours to choose, and a clean one matters as much as the browser does.
|
||||
- **Account and behaviour state.** Per-account quotas, rate limits, session age and the
|
||||
rhythm of what you do are counted against the account and the address, not the
|
||||
fingerprint. Change the seed all you like, a burst of identical requests at machine
|
||||
speed still reads as a burst. Human pacing is yours to supply.
|
||||
|
||||
So the accurate statement is: changing the fingerprint changes the fingerprint. It
|
||||
helps a lot with the layer that reconstructs identity from canvas and TLS, and it does
|
||||
nothing on its own for the layer that watches your address and your behaviour. Both
|
||||
have to be right, and they are separate jobs.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Clearing cookies removes the identifier the site stored on your side. Fingerprinting
|
||||
was designed for exactly the world where people clear cookies, so it stores nothing on
|
||||
your side and recomputes the identity from canvas, WebGL, fonts, audio and TLS every
|
||||
time. The only way to look like a different visitor is to change those values together,
|
||||
which a cookie clear cannot do and a per-seed fingerprint can. Just remember that this
|
||||
is the fingerprint layer alone: your IP and your account behaviour are tracked on their
|
||||
own, and they need their own clean inputs.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Does clearing cookies stop fingerprinting?** No. Cookies are stored and deletable,
|
||||
the fingerprint is recomputed from your browser's properties every visit, so a clear
|
||||
leaves it unchanged.
|
||||
|
||||
**Does incognito or a private window give me a new fingerprint?** No. Private mode
|
||||
clears storage, not the canvas, WebGL, font, audio and TLS values the fingerprint is
|
||||
built from. Same machine, same fingerprint.
|
||||
|
||||
**Then how do I actually change my fingerprint?** By changing the underlying values in
|
||||
a self-consistent way. In invisible_playwright that is a different seed, which redraws
|
||||
the GPU, canvas, fonts, audio and screen together so they still agree.
|
||||
|
||||
**If I clear cookies in a loop, do I look like many visitors?** No. Every iteration
|
||||
presents the same fingerprint, so you look like one visitor repeatedly clearing
|
||||
cookies, which is its own pattern.
|
||||
|
||||
**Does a new fingerprint fix a blocked IP?** No. The address and its reputation are
|
||||
tracked independently of both cookies and fingerprint. A clean exit is a separate
|
||||
requirement you supply yourself.
|
||||
|
||||
**Will a per-seed fingerprint make me undetectable?** No, and be wary of anything that
|
||||
says it will. It makes the fingerprint, TLS and driver layer read as a real Firefox,
|
||||
which is most checks but not all of them. Behaviour, pacing and IP are still on you.
|
||||
|
||||
## Sources
|
||||
|
||||
- This project's fingerprint generator, which derives canvas, WebGL, font, audio and
|
||||
screen values together from a single seed so a new identity is internally consistent.
|
||||
- The public detection suites named across this set, read for which components feed
|
||||
the identifier and which of them a storage clear leaves untouched.
|
||||
- The release gates that separate the fingerprint layer from IP and behaviour, so a
|
||||
clean fingerprint is never mistaken for a clean session.
|
||||
|
||||
**See also:** [the FingerprintJS visitor ID](fingerprintjs-visitor-id.md) for what the
|
||||
hash is actually made of, [persistent profiles](persistent-profiles.md) for keeping one
|
||||
identity on purpose, and [the JA3/JA4 TLS fingerprint](ja3-ja4-tls-fingerprint.md) for
|
||||
the layer that no amount of cookie clearing or JavaScript ever reaches.
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. Every session gets a
|
||||
distinct, self-consistent fingerprint from its seed, which is the thing a cookie clear
|
||||
was always trying and failing to be.*
|
||||
@@ -0,0 +1,195 @@
|
||||
---
|
||||
title: "Does Playwright Change My Browser Fingerprint?"
|
||||
description: "Stock Playwright does not randomize your fingerprint - it inherits the host browser's real values, which is how a Linux server leaks past a spoofed Windows user agent."
|
||||
parent: "The Automation Layer"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 23
|
||||
---
|
||||
|
||||
|
||||
# Does Playwright Change My Browser Fingerprint?
|
||||
|
||||
Short version: no. Stock Playwright launches a browser and hands you whatever that
|
||||
browser reports on the machine it runs on. It does not randomize the fingerprint, it
|
||||
does not repair it, and it does not make it look like anything other than what it is.
|
||||
That surprises people who expected the automation layer to also be a disguise layer,
|
||||
and the surprise usually arrives as a block on a server that worked fine on a laptop.
|
||||
|
||||
This page is what Playwright does and does not touch, the specific trap that catches
|
||||
server deployments, and where a seed-derived identity replaces the values you inherit.
|
||||
|
||||
## What Playwright actually does to the fingerprint
|
||||
|
||||
Playwright drives a browser. It does not synthesize one. When you call
|
||||
[`p.firefox.launch()`](https://playwright.dev/python/docs/api/class-browsertype#browser-type-launch),
|
||||
the fingerprint you present is the real fingerprint of the real
|
||||
Firefox on the real host: its GPU string comes from the host's graphics stack, its
|
||||
font list from the host's installed fonts, its `navigator.platform` from the host OS,
|
||||
its screen metrics from the host display, its audio characteristics from the host
|
||||
audio device.
|
||||
|
||||
Playwright's job is the driver channel and the automation surface. It exposes a few
|
||||
[context knobs](https://playwright.dev/python/docs/api/class-browser#browser-new-context) -
|
||||
`user_agent`, `locale`, `timezone_id`, `viewport` - but those are
|
||||
overrides you type in, not a coherent identity. Set a `user_agent` and you have
|
||||
changed one string; every other value the page can read still comes from the machine.
|
||||
That is the gap this whole page is about.
|
||||
|
||||
So the honest answer to the title is: Playwright inherits, it does not invent. If you
|
||||
want a different machine, you have to supply one.
|
||||
|
||||
## The server-OS mismatch trap
|
||||
|
||||
Here is the exact failure, because it is the one that ships.
|
||||
|
||||
You develop on a Windows or Mac laptop, everything passes, you deploy to a Linux
|
||||
server. Now the browser reports Linux fonts, a datacenter or software GPU renderer,
|
||||
and a Linux `navigator.platform`. Then, because a lot of guides say to, you set a
|
||||
Windows `user_agent` to "look normal".
|
||||
|
||||
You have just built a contradiction. A consistency detector does not care that any
|
||||
single value is plausible. It cares whether values that must agree, do.
|
||||
[CreepJS is built specifically to catch that](creepjs-explained.md): a user agent
|
||||
claiming Windows, sitting on top of a font set that only exists on Linux, next to a
|
||||
GPU string that only exists in a datacenter. Each field is fine alone. Together they
|
||||
describe a machine that cannot exist, and that is a cleaner signal than any single bad
|
||||
value would have been.
|
||||
|
||||
None of these are automation flags. They are "this is a Linux server wearing a Windows
|
||||
costume" flags, and [they survive every JavaScript stealth plugin ever written](playwright-docker-detection.md)
|
||||
because the fonts, the GPU and the platform are not in JavaScript's gift to change.
|
||||
The [font list mismatch alone](headless-fonts-differ.md) is a one-line check on the
|
||||
detector's side.
|
||||
|
||||
## What a seed-derived identity changes
|
||||
|
||||
invisible_playwright replaces the inherited values with a generated identity, and the
|
||||
word that matters is *coherent*. From one seed it derives every surface together -
|
||||
fonts, screen, device pixel ratio, canvas, WebGL vendor and renderer, audio, timezone,
|
||||
platform - so they describe a single believable Windows machine instead of the host it
|
||||
actually runs on. The Linux server underneath stops showing through, because the page
|
||||
never reads the Linux values.
|
||||
|
||||
Two properties follow from deriving everything from one seed:
|
||||
|
||||
- **Consistency.** The user agent, the fonts, the GPU string and the platform are drawn
|
||||
as one machine, so a cross-field detector finds agreement instead of a costume. This
|
||||
is the same principle as
|
||||
[keeping canvas and WebGL consistent across platforms](canvas-webgl-cross-platform-consistency.md):
|
||||
the surfaces have to corroborate each other, not just each look normal in isolation.
|
||||
- **Reproducibility.** The same seed yields the same identity every run. A
|
||||
[FingerprintJS visitor ID](fingerprintjs-visitor-id.md) is a hash over many
|
||||
components; feed it the same seed twice and you get the same ID, which is what lets
|
||||
you replay a failing run exactly instead of hoping the next random draw reproduces it.
|
||||
|
||||
The default (no seed) still gives every session a distinct coherent identity. Passing a
|
||||
seed just pins which one.
|
||||
|
||||
## A runnable example
|
||||
|
||||
Switching from stock Playwright is a two-line change, and after that every standard
|
||||
Playwright method works unchanged, because the object you get back is a real Playwright
|
||||
`Browser`.
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
# same seed -> same coherent Windows identity, every run
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
# navigator.platform, fonts, GPU, canvas, timezone all describe
|
||||
# ONE machine - not the Linux host this happens to run on
|
||||
print(page.evaluate("navigator.platform"))
|
||||
```
|
||||
|
||||
Run that on your laptop and on a Linux server and the reported platform, fonts and GPU
|
||||
match, because they come from the seed and not from the host. Log the seed if you did
|
||||
not pass one, and you can reproduce the run later:
|
||||
|
||||
```python
|
||||
sf = InvisiblePlaywright()
|
||||
with sf as browser:
|
||||
print("seed =", sf.seed) # replay this exact machine later
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
```
|
||||
|
||||
Async is the same shape with `from invisible_playwright.async_api import InvisiblePlaywright`
|
||||
and `await` on the page calls. There is no wrapped subset of the API to learn;
|
||||
see [the quickstart](quickstart.md) for the sync-versus-async pair side by side.
|
||||
|
||||
## The honest caveat: fingerprint is not everything
|
||||
|
||||
A coherent fingerprint fixes exactly one class of problem: the browser now reads as a
|
||||
genuine Firefox on a consistent Windows machine, at the fingerprint, TLS and driver
|
||||
layers. That is why it passes most detection checks that inspect what the browser *is*.
|
||||
|
||||
It does not fix what the browser *does*, and it does not fix where it connects from.
|
||||
A perfect, seed-stable Windows identity coming out of a datacenter IP that a thousand
|
||||
other clients are using this minute is still a datacenter IP. A perfect identity that
|
||||
fills a form in eighty milliseconds and clicks without the pointer ever passing through
|
||||
the space between two coordinates is still behaving like a script. The fingerprint is
|
||||
not a disguise for a bad exit or robotic timing, and anyone who tells you a browser
|
||||
alone makes you "undetectable" is selling the overclaim.
|
||||
|
||||
You supply the other two layers: a clean exit (see the
|
||||
[proxy and timezone notes in configuration](configuration.md), where the browser
|
||||
timezone auto-derives from the egress IP so those two stop contradicting each other),
|
||||
and human pacing. The tool makes the machine coherent. The IP and the behaviour are
|
||||
yours to get right.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Playwright does not change your fingerprint - it inherits the host's, which is exactly
|
||||
why a laptop-tested script fails on a Linux server the moment you paint a Windows user
|
||||
agent over a Linux machine. A seed-derived identity closes that gap by generating every
|
||||
surface together, so the fields corroborate one another instead of exposing the host,
|
||||
and the same seed reproduces the same machine for debugging. Pair it with a clean exit
|
||||
and human timing and it does the job it is built for. Treat it as a substitute for
|
||||
those and it will not, and no honest tool claims otherwise.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Does Playwright randomize the fingerprint?** No. It launches a browser and you
|
||||
inherit that browser's real values on the host it runs on.
|
||||
|
||||
**Why does my scraper work locally but get blocked on a server?** Because the server
|
||||
reports Linux fonts, a datacenter GPU and a Linux platform, which contradict the Windows
|
||||
user agent you set. Consistency detectors read that mismatch directly.
|
||||
|
||||
**Does setting `user_agent` in Playwright change my fingerprint?** It changes one
|
||||
string. The fonts, GPU, platform, screen and audio still come from the machine, so a
|
||||
lone user-agent override usually creates a contradiction rather than hiding anything.
|
||||
|
||||
**What does a seed do?** It derives one coherent identity - fonts, screen, canvas,
|
||||
WebGL, timezone - all describing the same Windows machine, and the same seed reproduces
|
||||
it every run.
|
||||
|
||||
**Will a coherent fingerprint make me undetectable?** No. It helps with the fingerprint,
|
||||
TLS and driver layers. It does nothing for a bad IP, per-account limits, rate limits or
|
||||
robotic timing, and you have to supply those yourself.
|
||||
|
||||
**Is invisible_playwright still real Playwright?** Yes. The `browser` object is a real
|
||||
Playwright `Browser`; every documented method works unchanged.
|
||||
|
||||
## Sources
|
||||
|
||||
- Playwright's own [launch](https://playwright.dev/python/docs/api/class-browsertype#browser-type-launch)
|
||||
and [context](https://playwright.dev/python/docs/api/class-browser#browser-new-context) API,
|
||||
read for what it does and does not override.
|
||||
- This project's fingerprint generator, which derives every surface from one seed, and
|
||||
the release gates that compare a generated identity field by field against a stock
|
||||
Firefox on the same machine.
|
||||
- The public consistency detectors named across this doc set, read from their own source
|
||||
rather than from a rendered verdict.
|
||||
|
||||
**See also:** [what CreepJS actually checks](creepjs-explained.md),
|
||||
[why a container gives itself away regardless of the stealth layer](playwright-docker-detection.md),
|
||||
and [keeping canvas and WebGL consistent across platforms](canvas-webgl-cross-platform-consistency.md).
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The server-OS mismatch in
|
||||
this page is a mistake I shipped before I built the thing that fixes it.*
|
||||
@@ -0,0 +1,201 @@
|
||||
---
|
||||
title: "Does Playwright Get Detected on the First Request?"
|
||||
description: "Yes, detection can happen before JavaScript runs: the TLS handshake and HTTP/2 settings form a fingerprint a Playwright script can contradict on request zero."
|
||||
parent: "The Automation Layer"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 27
|
||||
---
|
||||
|
||||
|
||||
# Does Playwright Get Detected on the First Request?
|
||||
|
||||
Yes, it can, and the surprising part is that it can happen before a single line
|
||||
of your page's JavaScript runs. People picture detection as something that
|
||||
inspects `navigator.webdriver` or reads a canvas hash after the page loads. Those
|
||||
are real, but they are late. The first thing a server sees from you is not a
|
||||
DOM, it is a TLS handshake and the opening frames of an HTTP/2 connection, and
|
||||
those carry a fingerprint of their own.
|
||||
|
||||
If that network fingerprint says one client while your `User-Agent` header says
|
||||
Firefox, the two disagree on request zero, before any script has a chance to
|
||||
tidy anything up. This page is about that gap, why a real patched browser does
|
||||
not have it, and the honest limits of what "no gap" buys you.
|
||||
|
||||
## What the server sees before your JavaScript runs
|
||||
|
||||
A page load is not one event, it is a sequence, and the browser has already
|
||||
described itself twice before your code executes.
|
||||
|
||||
First is the TLS handshake. The [ClientHello](https://datatracker.ietf.org/doc/html/rfc8446) message lists the cipher suites
|
||||
the client offers, the extensions it sends, the elliptic curves it supports and
|
||||
the order of all of it. That ordering is not random and it is not the same
|
||||
across clients: a given browser build produces a characteristic shape, and
|
||||
hashing that shape is what JA3 and JA4 do. [The full mechanics of how a
|
||||
handshake becomes a fingerprint](ja3-ja4-tls-fingerprint.md) are a page of their
|
||||
own, but the short version is that the network stack has a signature and the
|
||||
signature is legible.
|
||||
|
||||
Second, once the encrypted connection is up, HTTP/2 opens with a `SETTINGS`
|
||||
frame and a set of window and priority values. The exact numbers, and the order
|
||||
they arrive in, differ between engines and between an engine and a generic HTTP
|
||||
library that merely speaks the protocol. [HTTP/2 settings are a fingerprint in
|
||||
the same way](http2-fingerprint-detection.md): distinctive, sent up front, and
|
||||
impossible to edit from inside the page because the page does not exist yet.
|
||||
|
||||
Both of these are decided by whatever actually made the connection. Not by a
|
||||
header you set. Not by a property you patched. The transport layer answers for
|
||||
itself.
|
||||
|
||||
## Why the mismatch is the tell, not the fingerprint itself
|
||||
|
||||
A JA3 hash on its own is not incriminating. Plenty of legitimate clients have
|
||||
unusual handshakes. What gets flagged is a contradiction: a handshake that
|
||||
belongs to one client sitting underneath a `User-Agent` header that names a
|
||||
different one.
|
||||
|
||||
This is the same failure that shows up everywhere else in fingerprinting. A
|
||||
detector rarely asks "is this value rare". It asks "do two values that must
|
||||
agree, agree". Here the two values are the network fingerprint and the claimed
|
||||
browser. If a request presents a TLS signature that a generic HTTP client
|
||||
produces, and the header says it is Firefox on Windows, that is not a subtle
|
||||
statistical wobble. It is a flat contradiction, visible on the first packet,
|
||||
with no page interaction required. [The mismatch between a TLS fingerprint and
|
||||
the User-Agent](tls-fingerprint-user-agent-mismatch.md) is one of the cleanest
|
||||
signals a server has, precisely because the two sources are independent and hard
|
||||
to fake in lockstep.
|
||||
|
||||
This is why bolt-on stealth is fragile at the network layer. You can override
|
||||
every JavaScript property you like, and the handshake still comes from whatever
|
||||
library or headless build actually opened the socket. The disguise is applied
|
||||
above the layer where the contradiction lives.
|
||||
|
||||
## Why a real patched Firefox has no gap here
|
||||
|
||||
invisible_playwright takes the approach that avoids the mismatch by construction:
|
||||
it drives a real Firefox, patched at the C++ level, using stock Playwright. The
|
||||
handshake is not spoofed to look like Firefox. It is Firefox's handshake, because
|
||||
the process performing it is Firefox.
|
||||
|
||||
That distinction is the whole point. When the TLS `ClientHello` goes out, it is
|
||||
emitted by a genuine Gecko network stack, so the JA3 and JA4 it produces are the
|
||||
ones a real Firefox of that version produces. When HTTP/2 opens, the `SETTINGS`
|
||||
frame carries the values that engine actually uses. The `User-Agent` header then
|
||||
names Firefox and is telling the truth, so there is nothing for a request-zero
|
||||
comparison to catch. There is no second client hiding under the first, because
|
||||
there is only one client.
|
||||
|
||||
Switching to it is a two-line change, and the network behaviour comes along for
|
||||
free because it was never something you were configuring:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
# The TLS handshake and HTTP/2 frames on this request are a real
|
||||
# Firefox's, and the User-Agent header matches because it is not a spoof.
|
||||
```
|
||||
|
||||
The `browser` here is a real Playwright `Browser`, so every method you already
|
||||
use works unchanged. The `seed` fixes the in-page fingerprint (GPU, canvas,
|
||||
audio, fonts) so a run is reproducible, but the network-layer identity does not
|
||||
depend on the seed at all: it is the same genuine Firefox handshake on every
|
||||
session, because that is what the process is.
|
||||
|
||||
If you want to confirm this rather than take it on faith, the honest method is a
|
||||
comparison. Capture the handshake from a session driven this way and from a stock
|
||||
Firefox on the same machine, and diff the JA3 or JA4. They should match, because
|
||||
it is the same engine. That is the same "compare, do not read a verdict"
|
||||
discipline that the [testing guide](how-to-test-bot-detection.md) argues for at
|
||||
every layer.
|
||||
|
||||
## The honest caveat: a matching handshake is table stakes
|
||||
|
||||
Here is the part that a slogan would skip. A correct TLS and HTTP/2 fingerprint
|
||||
means you do not fail the request-zero mismatch check. It does not mean you pass
|
||||
request zero.
|
||||
|
||||
The server judges the handshake and the IP that sent it at the same instant. A
|
||||
perfect Firefox `ClientHello` arriving from an address with a bad reputation, a
|
||||
datacenter range, or an exit that a thousand other clients are using this minute,
|
||||
is still a bad first impression. The network fingerprint being clean removes one
|
||||
signal; it does nothing about the address underneath it, and the address is
|
||||
evaluated on exactly the same first packet.
|
||||
|
||||
So the layer split is worth stating plainly. invisible_playwright is designed to
|
||||
look like a real browser driven by a real person, and that is why it clears the
|
||||
fingerprint, TLS and driver checks: those read as a genuine Firefox because it is
|
||||
one. What it does not do, and cannot do, is supply the things that are not
|
||||
browser properties:
|
||||
|
||||
- **IP reputation.** The engine sends the handshake; you choose what sends it.
|
||||
Route it through a clean, ideally residential exit. [Proxy configuration and
|
||||
the DNS handling that goes with it](configuration.md) is where that is set.
|
||||
- **Rate limits and per-account quotas.** A real browser making a thousand
|
||||
identical requests a minute is still a thousand requests a minute.
|
||||
- **Behaviour and timing.** After request zero, the session is judged on how it
|
||||
moves. Human pacing is your responsibility, and for agent workloads the pause
|
||||
shaped like model latency is [its own consideration](ai-browser-agents-stealth.md).
|
||||
|
||||
A matching handshake is necessary and not sufficient. It is the floor you have to
|
||||
be standing on before anything else you do matters, not the ceiling.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Detection on the first request is real, and it lives below JavaScript: the TLS
|
||||
handshake and HTTP/2 settings describe the client before the page loads, and a
|
||||
network fingerprint that contradicts the `User-Agent` is one of the earliest and
|
||||
cleanest signals a server has. The durable answer to it is not a better spoof but
|
||||
a real engine, which is why driving a genuine patched Firefox means the handshake
|
||||
matches the header by construction. Pair that with a clean exit and human pacing,
|
||||
and request zero stops being the place you get caught. Leave the exit dirty and it
|
||||
still is, no matter how perfect the handshake.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Can I be detected before my JavaScript runs?** Yes. The TLS handshake and the
|
||||
HTTP/2 `SETTINGS` frame are sent before the page loads and both carry a
|
||||
fingerprint, so a mismatch is visible on the first request.
|
||||
|
||||
**What is a JA3 or JA4 fingerprint?** A hash of the shape of the TLS
|
||||
`ClientHello`: the cipher suites, extensions and curves and the order they appear
|
||||
in. Different clients produce different shapes.
|
||||
|
||||
**Why does a matching handshake matter if the header already says Firefox?**
|
||||
Because the header is trivially set and the handshake is not. When they disagree,
|
||||
the handshake is believed and the header is treated as a lie.
|
||||
|
||||
**Can I fix the TLS fingerprint from JavaScript or a stealth plugin?** No. The
|
||||
handshake happens below the page, before any script runs. The only real fix is
|
||||
for the actual client to be the browser it claims to be.
|
||||
|
||||
**Does a real Firefox handshake mean I will not be blocked?** No. It clears the
|
||||
network-fingerprint mismatch, but the IP that sent the handshake is judged at the
|
||||
same moment, and reputation, rate limits and behaviour are all still yours to
|
||||
handle.
|
||||
|
||||
**Does the seed change the network fingerprint?** No. The seed fixes the in-page
|
||||
identity so runs are reproducible; the TLS and HTTP/2 fingerprint is the genuine
|
||||
engine's and is the same regardless.
|
||||
|
||||
## Sources
|
||||
|
||||
- The TLS 1.3 and HTTP/2 specifications for what the `ClientHello` and `SETTINGS`
|
||||
frames actually contain, and the public JA3 and JA4 definitions for how those
|
||||
are hashed into a fingerprint.
|
||||
- This project's own comparison method: capturing a handshake from a session and
|
||||
from a stock Firefox on the same machine and diffing the result, rather than
|
||||
trusting a verdict.
|
||||
|
||||
**See also:** [JA3 and JA4 TLS fingerprints](ja3-ja4-tls-fingerprint.md) for the
|
||||
handshake mechanics, [the TLS-versus-User-Agent mismatch](tls-fingerprint-user-agent-mismatch.md)
|
||||
for why the contradiction is decisive, and [HTTP/2 fingerprint detection](http2-fingerprint-detection.md)
|
||||
for the layer just above it.
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The handshake is
|
||||
real because the browser is real; the exit and the pacing are still yours to get
|
||||
right.*
|
||||
@@ -0,0 +1,233 @@
|
||||
---
|
||||
title: "Does Playwright Leave Traces a Website Can See?"
|
||||
description: "Playwright leaves some traces a page can read, some it cannot. Which are page-visible, why the control WebSocket is not, and how patched Firefox reads ordinary."
|
||||
parent: "The Automation Layer"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 22
|
||||
---
|
||||
|
||||
|
||||
# Does Playwright Leave Traces a Website Can See?
|
||||
|
||||
Short version: Playwright leaves traces, but only some of them are readable by the
|
||||
page you are visiting. The distinction matters more than the list, because most of the
|
||||
famous "Playwright tells" are things the page can see in its own document, and the part
|
||||
people worry about most - the connection the driver uses to control the browser - is not
|
||||
one of them.
|
||||
|
||||
This page splits automation traces into two piles, page-visible and off-page, shows a
|
||||
DOM check you can run yourself, explains why Chromium-based tooling and Firefox differ on
|
||||
one specific tell, and states plainly where a clean document still is not enough.
|
||||
|
||||
## Two kinds of trace: what the page can read, and what it cannot
|
||||
|
||||
A running automation session has two very different surfaces.
|
||||
|
||||
**Off-page.** The driver talks to the browser over a control channel: a local
|
||||
WebSocket or pipe that carries the commands your script issues (navigate, click, read
|
||||
this element). That channel lives between your process and the browser process. The page
|
||||
being automated has no handle to it, cannot open it, and cannot enumerate it. It is
|
||||
server-side relative to the document, in the same sense a debugger attached to a process
|
||||
is invisible to the code running inside.
|
||||
|
||||
**Page-visible.** Everything the automation writes into the document or the global
|
||||
scope. If a tool sets a property on `navigator`, defines a global, or injects a helper
|
||||
object into `window`, then any script the page runs can read it back with one line. This
|
||||
is the pile that detectors actually query, because it is the only pile they can reach
|
||||
from JavaScript.
|
||||
|
||||
The useful question is therefore never "does Playwright leave traces" but "which pile is
|
||||
this trace in". A trace in the first pile is not something a page can test for. A trace
|
||||
in the second pile is a one-line check, and that is where the work is.
|
||||
|
||||
## The control channel: a trace, but not one the page can see
|
||||
|
||||
The WebSocket (or pipe) is real. If you inspect your own machine while a session runs,
|
||||
it is right there. But it is off-page, and that has a concrete consequence: a website
|
||||
cannot detect automation by looking for the driver connection, because nothing in the
|
||||
document reaches across that boundary.
|
||||
|
||||
This is why "close the DevTools port" style advice misses the point for in-page
|
||||
detection. Whether the transport is a Chrome DevTools Protocol socket, a WebDriver BiDi
|
||||
session, or Firefox's own Juggler protocol, the page sees the same thing either way:
|
||||
nothing. The differences between those transports show up in other places -
|
||||
[the protocol a tool speaks changes what artifacts land in the page](bidi-vs-cdp-detection.md) -
|
||||
but the raw existence of a control socket is not a page-readable signal.
|
||||
|
||||
What the page reads is the residue the driver leaves behind in the document. That is the
|
||||
next pile.
|
||||
|
||||
## The traces a page CAN see
|
||||
|
||||
Three families, in rough order of how often they appear:
|
||||
|
||||
- **A webdriver flag.** The [WebDriver specification](https://www.w3.org/TR/webdriver2/)
|
||||
requires a conforming browser to expose `navigator.webdriver` as `true` while a session
|
||||
is under automation control. That is a page-visible boolean by design, and a stock
|
||||
automated browser reports it honestly. Patching it in a page script trades one tell for
|
||||
another, because a clean browser reports `undefined` and not `false` - the
|
||||
[full reason setting it to false is worse than leaving it alone](navigator-webdriver-explained.md)
|
||||
is its own page.
|
||||
- **Automation globals.** Some stacks leave a named object on `window` so their in-page
|
||||
code has somewhere to keep state. Anything on the global object is enumerable, so a
|
||||
named global is a named tell.
|
||||
- **Injected document properties.** On Chromium-based tooling driven through
|
||||
ChromeDriver, the driver keeps working state on the document under `cdc_` / `$cdc`
|
||||
property names. Their presence is a one-line automation test, and
|
||||
[renaming them in the binary does not remove the surface](cdc-variable-explained.md),
|
||||
it only changes its shape.
|
||||
|
||||
All three are page-visible because they live in the document or the global scope. None of
|
||||
them is the control channel. Fixing them is a matter of not writing them into the page in
|
||||
the first place, which is a design decision, not a runtime patch.
|
||||
|
||||
## Chromium injects cdc_ into the document; Firefox through Juggler does not
|
||||
|
||||
Chromium-based tooling writes `cdc_`-prefixed properties into the page; Firefox driven
|
||||
through Juggler writes none, because its driver never has to touch the document at all.
|
||||
|
||||
ChromeDriver needs to run its own JavaScript inside the page to do its job, and it keeps
|
||||
state on the page's own objects under `cdc_`-prefixed names. That is a page-visible
|
||||
artifact of how that particular driver works.
|
||||
|
||||
Firefox driven through its own Juggler protocol does not use ChromeDriver, so `cdc_`
|
||||
simply does not exist there. That is a fact about the protocol, not a claim of virtue:
|
||||
Firefox's automation state lives in privileged execution contexts the page cannot
|
||||
enumerate, so the driver does not have to write into the document to function. The
|
||||
`cdc_` family of checks returns nothing on a Firefox session for a structural reason.
|
||||
|
||||
That structural point is only half the story, though, because a stock Firefox under
|
||||
automation still sets the webdriver flag to `true`. So "no `cdc_`" does not mean "looks
|
||||
like a person" on its own. What closes the remaining gap is where the value is decided.
|
||||
On the patched Firefox this project ships, the webdriver flag is cleared and the
|
||||
fingerprint is normalized inside the engine, before it ships, so the document a site
|
||||
inspects reports the same values a normal build reports, through the same native code
|
||||
path. There is no in-page override for a detector to catch, because there is no override.
|
||||
The wider comparison of the two engines lives in
|
||||
[Firefox versus Chromium for anti-detect work](firefox-vs-chromium-antidetect.md).
|
||||
|
||||
## Check the document yourself
|
||||
|
||||
Do not take any of this on trust. Enumerate the document and the global scope in your own
|
||||
session and read what is there. With the real API the launch is two lines and the check
|
||||
is one `page.evaluate`:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
|
||||
report = page.evaluate("""() => ({
|
||||
webdriver: navigator.webdriver,
|
||||
cdc_on_document: Object.getOwnPropertyNames(document)
|
||||
.filter(k => k.startsWith('cdc_') || k.startsWith('$cdc')),
|
||||
suspicious_globals: Object.getOwnPropertyNames(window)
|
||||
.filter(k => /^(cdc_|\\$cdc|__playwright|__driver|__webdriver)/.test(k)),
|
||||
})""")
|
||||
|
||||
print(report)
|
||||
```
|
||||
|
||||
On this patched Firefox, `webdriver` comes back `undefined` (not `false`), and both
|
||||
lists come back empty: no `cdc_` on the document, no automation global on `window`. The
|
||||
same check on a stock ChromeDriver session is where you see the `cdc_` entries appear.
|
||||
Passing `seed=42` just means the run is reproducible, so you can re-run the exact same
|
||||
identity and compare - the
|
||||
[wider method for testing detection](how-to-test-bot-detection.md) is to compare against
|
||||
a stock browser field by field rather than reading a single verdict.
|
||||
|
||||
Note what this check does not include: the control-channel WebSocket. There is no
|
||||
expression you can write in `page.evaluate` that finds it, because it is off-page. That
|
||||
absence is the point of this whole page.
|
||||
|
||||
## What this fixes, and what it honestly does not
|
||||
|
||||
Clearing the page-visible traces is what makes invisible_playwright pass most in-document
|
||||
detection: the automation flag, the injected globals, and the fingerprint (GPU, audio,
|
||||
fonts, screen, roughly 400 fields) all read as a genuine Firefox, because they are
|
||||
produced by a genuine, if patched, Firefox. That is the demonstrable part, and the DOM
|
||||
check above is how you confirm it for yourself.
|
||||
|
||||
"No page-visible traces" is not the same as "invisible", and it is worth being blunt
|
||||
about the difference:
|
||||
|
||||
- **The network layer.** The TLS handshake and HTTP/2 settings are decided before any
|
||||
page script runs, and [an in-page test cannot see them](ja3-ja4-tls-fingerprint.md),
|
||||
which cuts both ways: a clean document does not fix a handshake that contradicts the
|
||||
user agent. The patched engine's handshake is a real Firefox handshake, so this
|
||||
particular mismatch is not introduced, but the point stands that this surface is
|
||||
outside the document.
|
||||
- **IP reputation.** A consistent browser on a datacenter address is still on a
|
||||
datacenter address. That is not a browser property, and no amount of fingerprint work
|
||||
changes it. You supply a clean exit, and the browser stays consistent with it.
|
||||
- **Per-account quotas and rate limits.** If an account or a source address makes more
|
||||
requests than a person plausibly would, that is measured server-side and is invisible
|
||||
to any document check.
|
||||
- **Behaviour and timing.** Pointer motion, typing rhythm, and pacing are watched by
|
||||
some sites regardless of how clean the document is. This project drives real mouse
|
||||
motion, but the cadence of your script is yours to make human.
|
||||
|
||||
So the honest framing: invisible_playwright is built to look like a real browser driven
|
||||
by a real person, which is why it clears the page-visible driver and fingerprint layer.
|
||||
It does not, on its own, fix your IP, your account limits, or your pacing. Those are the
|
||||
reader's to supply - a clean proxy and human timing - and a page that reads as ordinary
|
||||
plus a session that behaves ordinarily is the combination that actually holds.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Playwright leaves traces, but sort them before you worry about them. The control channel
|
||||
is a real trace and the page cannot see it, so it is not a detection vector from the
|
||||
document. The webdriver flag, automation globals, and Chromium's `cdc_` injection are
|
||||
page-visible, and those are the ones detectors query. Firefox through Juggler carries no
|
||||
`cdc_` for a structural reason, and a Firefox patched in the engine additionally clears
|
||||
the webdriver flag and normalizes the fingerprint, so the document reads as an ordinary
|
||||
browser. Confirm that with the one-line DOM check rather than believing the paragraph.
|
||||
Then remember that a clean document is a necessary condition, not a sufficient one: the
|
||||
network, the address, the account, and the behaviour are still yours to get right.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Does Playwright leave traces a website can detect?** Some yes, some no. Automation
|
||||
globals, a webdriver flag, and (on Chromium tooling) `cdc_` properties are page-visible.
|
||||
The driver's control WebSocket is off-page and a document cannot see it.
|
||||
|
||||
**Can a website see the WebSocket Playwright uses to control the browser?** No. That
|
||||
channel is between your process and the browser process. Nothing in the page has a handle
|
||||
to it, so it is not an in-page detection signal.
|
||||
|
||||
**Does Firefox have the `cdc_` variables Chrome does?** No. Those come from ChromeDriver.
|
||||
Firefox driven through its Juggler protocol keeps driver state off the page, so a `cdc_`
|
||||
scan returns nothing on a Firefox session.
|
||||
|
||||
**Is `navigator.webdriver` always true under automation?** On a stock automated browser,
|
||||
yes, because the spec requires it. On the patched Firefox this project ships it is cleared
|
||||
in the engine, so it reports `undefined` like a normal browser, not `false`.
|
||||
|
||||
**If the document is clean, am I undetectable?** No. A clean document does nothing about
|
||||
IP reputation, per-account quotas, rate limits, the TLS handshake, or your timing. Those
|
||||
are separate surfaces you have to handle yourself.
|
||||
|
||||
**How do I check what my own session exposes?** Enumerate `window` and `document` in a
|
||||
live session with `page.evaluate` and read `navigator.webdriver`, as in the example
|
||||
above, then compare the result against a stock browser on the same machine.
|
||||
|
||||
## Sources
|
||||
|
||||
- This project's own sessions, enumerating `window` and `document` on a live
|
||||
Playwright-driven Firefox rather than trusting a description of one.
|
||||
- The public detection suites (CreepJS, BotD, sannysoft, FingerprintJS, BrowserLeaks),
|
||||
each read from its own source for what it collects from the document.
|
||||
- The Playwright, [WebDriver BiDi](https://www.w3.org/TR/webdriver-bidi/), and Juggler
|
||||
protocol behaviour for where driver state lives relative to the page.
|
||||
|
||||
**See also:** [the ChromeDriver cdc_ variable](cdc-variable-explained.md),
|
||||
[why navigator.webdriver is not the tell you think it is](navigator-webdriver-explained.md),
|
||||
and [how to test whether your browser is detected](how-to-test-bot-detection.md).
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The DOM check above is one
|
||||
I run against a real session before repeating any claim about what a page can see.*
|
||||