From e69ca8915ec31a8234a31beb6402108bc6cf925a Mon Sep 17 00:00:00 2001 From: Hetu Nandu Date: Fri, 30 Aug 2024 17:22:07 +0530 Subject: [PATCH] fix: Intercom setting anonymous user a common user id (#36017) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description Avoids setting the `user_id` field in intercom when the user is not logged in Fixes https://github.com/appsmithorg/appsmith-ee/issues/5003 ## Automation /ok-to-test tags="@tag.Sanity" ### :mag: Cypress test results > [!IMPORTANT] > 🟣 🟣 🟣 Your tests are running. > Tests running at: > Commit: 1eaad316f8da84f0e99b92842f1dddc177d252c5 > Workflow: `PR Automation test suite` > Tags: `@tag.Sanity` > Spec: `` >
Fri, 30 Aug 2024 11:26:34 UTC ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No ## Summary by CodeRabbit - **New Features** - Enhanced user information handling for improved privacy in the application. - Anonymous users will no longer have their usernames processed, ensuring greater data protection. - **Bug Fixes** - Refined logic for extracting user information to prevent exposure of sensitive data. - **Documentation** - Updated comments and documentation to reflect changes in user data handling and privacy measures. --- app/client/src/utils/bootIntercom.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/client/src/utils/bootIntercom.ts b/app/client/src/utils/bootIntercom.ts index 34e65c6d251..e742f1d39b3 100644 --- a/app/client/src/utils/bootIntercom.ts +++ b/app/client/src/utils/bootIntercom.ts @@ -1,4 +1,4 @@ -import type { User } from "constants/userConstants"; +import { ANONYMOUS_USERNAME, type User } from "constants/userConstants"; import { getAppsmithConfigs } from "ee/configs"; import { sha256 } from "js-sha256"; import { getLicenseKey } from "ee/utils/licenseHelpers"; @@ -7,9 +7,12 @@ const { appVersion, cloudHosting, intercomAppID } = getAppsmithConfigs(); export default function bootIntercom(user?: User) { if (intercomAppID && window.Intercom) { - let { email, username } = user || {}; - let name; - if (!cloudHosting) { + let name: string | undefined = user?.name; + let email: string | undefined = user?.email; + let username = + user?.username === ANONYMOUS_USERNAME ? undefined : user?.username; + if (!cloudHosting && username) { + // We are hiding their information when self-hosted username = sha256(username || ""); // keep email undefined so that users are prompted to enter it when they reach out on intercom email = undefined;