Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to Set a Whitelist of Domains for a Segment JavaScript source WriteKey to Prevent Misuse? #1059

Closed
naviangie opened this issue Apr 2, 2024 · 1 comment

Comments

@naviangie
Copy link

I'm concerned about the potential for the writeKey to be extracted and misused by third parties on unauthorized domains.

Is there a way to configure a whitelist of domains through any settings in the analytics service, which would only allow my writeKey to be used from specific, authorized domains I designate?

@silesky
Copy link
Contributor

silesky commented Apr 2, 2024

Hey @naviangie.

Sorry, segment does not support anything like that AFAIK (an origin whitelist, or some writekey-by-writekey custom CORS headers).

The best you might be able do is revoke a write key if, say, your website is being cloned via a phishing website. This might be hacky, but it would be possible use edge functions or destination filters to just drop the event based on what's included in the page URL. You can also contact support for more help on finding a bespoke solution -- they would know more about the options.

Of course, the request body can always be crafted in a deceptive way, so there's no guarantee that the origin is valid. I responded to an issue here around why the write key is 'public' FYI:
#1050 (comment)

@silesky silesky closed this as not planned Won't fix, can't repro, duplicate, stale Apr 18, 2024
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

No branches or pull requests

2 participants