Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

fix(telemetry): add ORDER BY for deterministic results and filter free email providers

Devin AIab7a993f7fe9
diff --git a/backend/src/services/org/org-dal.ts b/backend/src/services/org/org-dal.ts
index cf47982002..c1c7111e25 100644
--- a/backend/src/services/org/org-dal.ts
+++ b/backend/src/services/org/org-dal.ts
@@ -464,6 +464,7 @@ export const orgDALFactory = (db: TDbClient) => {
.where({ isGhost: false })
.whereNotNull(`${TableName.Users}.email`)
.select(db.ref("email").withSchema(TableName.Users))
+ .orderBy(`${TableName.Membership}.createdAt`, "asc")
.first();
return row?.email ?? null;
diff --git a/backend/src/services/telemetry/telemetry-service.ts b/backend/src/services/telemetry/telemetry-service.ts
index 33fb884744..f8b19d8bf6 100644
--- a/backend/src/services/telemetry/telemetry-service.ts
+++ b/backend/src/services/telemetry/telemetry-service.ts
@@ -38,6 +38,27 @@ const AGGREGATION_BREAKDOWN_DIMENSIONS: Partial<Record<PostHogEventTypes, string
[PostHogEventTypes.PkiSyncExecuted]: ["destination"]
};
+// Common free/personal email providers excluded from org domain derivation
+const FREE_EMAIL_PROVIDERS = new Set([
+ "gmail.com",
+ "googlemail.com",
+ "outlook.com",
+ "hotmail.com",
+ "live.com",
+ "yahoo.com",
+ "icloud.com",
+ "me.com",
+ "mac.com",
+ "aol.com",
+ "protonmail.com",
+ "proton.me",
+ "mail.com",
+ "zoho.com",
+ "yandex.com",
+ "gmx.com",
+ "gmx.net"
+]);
+
// Bucket configuration
const TELEMETRY_BUCKET_COUNT = 30;
const TELEMETRY_BUCKET_NAMES = Array.from(
@@ -243,9 +264,9 @@ To opt into telemetry, you can set "TELEMETRY_ENABLED=true" within the environme
try {
const email = await orgDAL.findFirstOrgMemberEmail(orgId);
if (email) {
- const domain = email.split("@")[1];
- if (domain) {
- properties.domain = domain.toLowerCase();
+ const domain = email.split("@")[1]?.toLowerCase();
+ if (domain && !FREE_EMAIL_PROVIDERS.has(domain)) {
+ properties.domain = domain;
}
}
} catch (error) {