Skip to content

Commit

Permalink
fix(shared): Disable telemetry collection from browser controlled via…
Browse files Browse the repository at this point in the history
… automation
  • Loading branch information
brkalow committed Dec 22, 2023
1 parent 4b85989 commit c7aba82
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/happy-dolls-taste.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@clerk/shared': patch
---

Disable telemetry collection when window.navigator.webdriver is defined, indicating traffic from an automation tool.
7 changes: 7 additions & 0 deletions packages/shared/src/telemetry/collector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,13 @@ export class TelemetryCollector {
return false;
}

// navigator.webdriver is a property generally set by headless browsers that are running in an automated testing environment.
// Data from these environments is not meaningful for us and has the potential to produce a large volume of events, so we disable
// collection in this case. (ref: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/webdriver)
if (typeof window !== 'undefined' && !!window?.navigator?.webdriver) {
return false;
}

return true;
}

Expand Down

0 comments on commit c7aba82

Please sign in to comment.