Skip to content

fix(fingerprint-generator): guard generated viewport dimensions#548

Closed
tine1117 wants to merge 1 commit into
apify:masterfrom
tine1117:tine1117-guard-invalid-generated-viewports
Closed

fix(fingerprint-generator): guard generated viewport dimensions#548
tine1117 wants to merge 1 commit into
apify:masterfrom
tine1117:tine1117-guard-invalid-generated-viewports

Conversation

@tine1117
Copy link
Copy Markdown

Fixes #6.

The generated fingerprint network can still return screen records with zero viewport fields such as innerWidth, innerHeight, clientWidth, and clientHeight. Those values are easy to flag because they do not match a real browser viewport.

This change adds a small guard at fingerprint generation time:

  • normalize zero viewport fields from the surrounding screen dimensions when the generated record is otherwise usable
  • skip generated screens that still violate basic client <= inner <= outer viewport invariants
  • cover the Chrome 100/macOS generation path and the zero-viewport normalization case with regression tests

This complements #544. That PR tightens future training records; this one protects the runtime generator from the current published network output as well.

Validation:

  • corepack pnpm vitest run test/fingerprint-generator/generation.test.ts --reporter verbose
  • corepack pnpm exec prettier packages/fingerprint-generator/src/fingerprint-generator.ts test/fingerprint-generator/generation.test.ts --check
  • git diff --check
  • Git Bash: npm exec --yes pnpm@10.33.4 -- build

Note: full pnpm lint is not clean on the current checkout because repo-wide Prettier reports existing formatting differences in untouched files. The two changed files pass Prettier directly.

@algora-pbc /claim #6

@tine1117 tine1117 changed the title Guard generated viewport dimensions fix(fingerprint-generator): guard generated viewport dimensions May 20, 2026
Copy link
Copy Markdown
Member

@barjin barjin left a comment

Choose a reason for hiding this comment

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

As mentioned under #544 , the right solution is to fix the fingerprint collection script.

Closing this PR now. Thank you for your contribution anyway!

@barjin barjin closed this May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show results masking fingerprint when test in pixelscan

4 participants