SIGN IN SIGN UP

fix(fingerprints): enforce the user agent allow list so screen constraints are respected (#2110)

`ScreenOptions` were not respected - with `strict=True` fingerprint
generation failed, otherwise the screen
constraints were silently dropped and the fingerprint got a screen
outside of the requested range.

`browserforge` turns the screen constraints into an allow list of user
agents and passes it to the header
generator, but the generator only derives browser, operating system and
device from it and then samples the
user agent freely - so the result is often outside the list, and the
fingerprint network finds no consistent
sample. `apify-fingerprint-datapoints` 0.14.0 made that deterministic
for some inputs, hence the cap in #2107.

`PatchedHeaderGenerator` now enforces the allow list: a user agent
outside it pins the next attempt to an
allowed one with the same browser, operating system and device. If
nothing is interchangeable or the attempts
run out, the wider header is returned, so inputs that worked before keep
working.

Measured on 0.14.0, before -> after:

| Case | Before | After |
| --- | --- | --- |
| `strict` Firefox + Windows, screen `600-1800 x 400-1200` | 299/300
fail, 480 ms each | 0/500 fail, 90 ms each |
| Firefox + Android, screen `300-600 x 500-1200` | ~40% of screens out
of range | 0/2000 out of range |

Also drops the `apify-fingerprint-datapoints<0.14.0` caps from #2107.

`test_fingerprint_generator_respects_screen_options_without_strict`
covers the non-strict path; it and
`test_fingerprint_generator_all_options` fail on `master` with the
0.14.0 datapoints.

Closes: #2108

*✍️ Drafted by Claude Code*
V
Vlada Dusek committed
017dd1c86c636ddfb7f64bd91a22e345dcd4cd33
Parent: f23d27f
Committed by GitHub <noreply@github.com> on 8/3/2026, 3:22:23 PM