feat: add device fingerprinting to referral anti-abuse system#362
Open
decentraland-bot wants to merge 4 commits intomainfrom
Open
feat: add device fingerprinting to referral anti-abuse system#362decentraland-bot wants to merge 4 commits intomainfrom
decentraland-bot wants to merge 4 commits intomainfrom
Conversation
- Add deviceFingerprint utility that generates a SHA-256 hash from stable browser properties (canvas, WebGL, screen, timezone, hardware) - Send fingerprint as x-device-fingerprint header on referral creation - Header is optional/backward-compatible: omitted if fingerprint is empty - Add comprehensive tests for both the utility and the hook Relates to decentraland/social-service-ea#400
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
- Restructure tests using describe/when/and context-building pattern - Use lowercase describe sentences with 'when' for top-level contexts - Use 'should' prefix for it blocks describing expectations - Build context in nested describes with beforeEach setup - Move jest.clearAllMocks to afterEach instead of beforeEach - Properly separate identity-available vs identity-unavailable scenarios
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
src/shared/utils/deviceFingerprint.ts) that generates a SHA-256 hash from stable browser properties (canvas rendering, WebGL renderer, screen dimensions, timezone, hardware concurrency)useTrackReferralhook to compute and send the fingerprint as anx-device-fingerprintheader on referral creation/update requestsHow It Works
The fingerprint is computed client-side from browser characteristics that remain stable across VPN/proxy changes:
These are hashed with SHA-256 into a hex string and sent as a request header. The backend (
social-service-ea) will read this header and apply aREFERRAL_MAX_DEVICE_MATCHESlimit per referrer, similar to the existing IP-based check.Why
IP-only detection is easily bypassed with VPN rotation. A user switching IPs will still produce the same device fingerprint, catching abuse that the current system misses.
Changes
src/shared/utils/deviceFingerprint.ts— New utilitysrc/shared/utils/deviceFingerprint.spec.ts— Tests for the utilitysrc/hooks/useTrackReferral.ts— Updated to include fingerprint headersrc/hooks/useTrackReferral.spec.ts— New comprehensive tests for the hookTesting
Related
social-service-eato readx-device-fingerprintheader and enforce device match limits🤖 Created via Slack with Claude
Requested by Braian Mellor via Slack