Skip to content

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

Merged
vdusek merged 4 commits into
masterfrom
fix/fingerprint-screen-constraints
Aug 3, 2026
Merged

fix(fingerprints): enforce the user agent allow list so screen constraints are respected#2110
vdusek merged 4 commits into
masterfrom
fix/fingerprint-screen-constraints

Conversation

@vdusek

@vdusek vdusek commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

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

@vdusek vdusek added the t-tooling Issues with this label are in the ownership of the tooling team. label Aug 3, 2026
@vdusek vdusek self-assigned this Aug 3, 2026
@github-actions github-actions Bot added this to the 146th sprint - Tooling team milestone Aug 3, 2026
@github-actions github-actions Bot added the tested Temporary label used only programatically for some analytics. label Aug 3, 2026
@vdusek vdusek added the bug Something isn't working. label Aug 3, 2026
@vdusek vdusek changed the title fix: enforce the user agent allow list so screen constraints are respected fix(fingerprint suite): enforce the user agent allow list so screen constraints are respected Aug 3, 2026
@codecov

codecov Bot commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.18519% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.53%. Comparing base (463806f) to head (cf5557d).
⚠️ Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
...crawlee/fingerprint_suite/_browserforge_adapter.py 85.18% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2110      +/-   ##
==========================================
- Coverage   93.55%   93.53%   -0.02%     
==========================================
  Files         181      181              
  Lines       12590    12615      +25     
==========================================
+ Hits        11779    11800      +21     
- Misses        811      815       +4     
Flag Coverage Δ
unit 93.53% <85.18%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vdusek vdusek added the adhoc Ad-hoc unplanned task added during the sprint. label Aug 3, 2026
@vdusek
vdusek marked this pull request as ready for review August 3, 2026 09:07
@vdusek vdusek changed the title fix(fingerprint suite): enforce the user agent allow list so screen constraints are respected fix(fingerprint): enforce the user agent allow list so screen constraints are respected Aug 3, 2026
@vdusek vdusek changed the title fix(fingerprint): enforce the user agent allow list so screen constraints are respected fix(fingerprints): enforce the user agent allow list so screen constraints are respected Aug 3, 2026
@vdusek
vdusek requested review from Mantisus and janbuchar August 3, 2026 09:57

@Mantisus Mantisus left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread src/crawlee/fingerprint_suite/_browserforge_adapter.py Outdated
@vdusek
vdusek merged commit 017dd1c into master Aug 3, 2026
36 checks passed
@vdusek
vdusek deleted the fix/fingerprint-screen-constraints branch August 3, 2026 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. bug Something isn't working. t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Screen constraints are not respected with apify-fingerprint-datapoints 0.14.0

4 participants