feat: integrate FingerprintJS Pro visitor header for bot detection#2378
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a best-effort FingerprintJS Pro integration to Discovery so the client can attach a per-visitor identifier header to first-party ADS API requests (to support downstream bot-detection/traffic analysis) without impacting bootstrap or request execution if anything fails.
Changes:
- Added a new
fingerprint_coreutility that lazy-loads the FingerprintJS Pro CDN script, initializes the SDK, and cachesvisitorId. - Wired the utility into
discovery_bootstrap.configure()to (a) start loading the SDK whenfingerprintApiKeyis configured and (b) injectX-Fp-Visitor-Idon first-party API requests. - Added
fingerprintApiKeyto the default Discovery vars and added Mocha tests for the new utility.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/js/utils/fingerprint_core.js |
New utility to inject FingerprintJS Pro script and cache visitorId. |
src/js/mixins/discovery_bootstrap.js |
Loads FingerprintJS Pro at bootstrap and adds visitor header to first-party API requests. |
src/config/discovery.vars.js.default |
Adds fingerprintApiKey config knob (empty disables). |
test/mocha/js/utils/fingerprint_core.spec.js |
Adds unit tests covering load success/failure paths and caching behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Loads FingerprintJS Pro at app startup and attaches the resolved visitorId as X-Fp-Visitor-Id on all first-party ADS API requests. Enforcement is left to the backend. The integration is fully best-effort — any failure at any point resolves silently to a no-op with no impact on request flow or app bootstrap.
55a0ba5 to
eb42c64
Compare
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.
Uh oh!
There was an error while loading. Please reload this page.