-
Notifications
You must be signed in to change notification settings - Fork 558
[SDK] Feature: Adds location to platform headers #7462
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -228,6 +228,10 @@ export function getPlatformHeaders() { | |
...(bundleId ? { "x-bundle-id": bundleId } : {}), | ||
}); | ||
|
||
if (typeof window !== "undefined") { | ||
previousPlatform.push(["x-sdk-location", window.location.href]); | ||
} | ||
Comment on lines
+231
to
+233
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion
Because 🤖 Prompt for AI Agents
Potential PII/Security leakage by transmitting full URL (
-previousPlatform.push(["x-sdk-location", window.location.href]);
+// Safer: strip search params & hashes, or redact known sensitive keys
+const location = new URL(window.location.href);
+location.search = "";
+location.hash = "";
+previousPlatform.push(["x-sdk-location", location.toString()]); At minimum, consider: 🤖 Prompt for AI Agents
|
||
|
||
return previousPlatform; | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this feels a bit odd no? also make sure to handle location undefined as well for some platforms. RN actually can have a window but no location i think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is it odd?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think it fits better as a param to the tracking event rather than a header to all requests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we just add it to the trackPayEvent / trackConnectEvent for now?