From 4bb31b8f744ff936ef1330c53107f0048d79e5fc Mon Sep 17 00:00:00 2001 From: Jimmy Vo Date: Thu, 10 Apr 2025 16:32:53 -0400 Subject: [PATCH] [PM-19814] Add phishing detection feature flag. --- .../browser/src/background/main.background.ts | 23 ++++++++++++++----- .../services/phishing-detection.service.ts | 2 ++ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/apps/browser/src/background/main.background.ts b/apps/browser/src/background/main.background.ts index 572e45a8063..a46b5daef74 100644 --- a/apps/browser/src/background/main.background.ts +++ b/apps/browser/src/background/main.background.ts @@ -1310,12 +1310,23 @@ export default class MainBackground { this.inlineMenuFieldQualificationService = new InlineMenuFieldQualificationService(); - PhishingDetectionService.initialize( - this.auditService, - this.logService, - this.storageService, - this.taskSchedulerService, - ); + this.configService + .getFeatureFlag(FeatureFlag.PhishingDetection) + .then((enabled) => { + if (enabled) { + PhishingDetectionService.initialize( + this.auditService, + this.logService, + this.storageService, + this.taskSchedulerService, + ); + } else { + this.logService.info("phishing detection feature flag is disabled."); + } + }) + .catch((error) => + this.logService.error("Failed to check phishing detection feature flag", error), + ); } async bootstrap() { diff --git a/apps/browser/src/platform/services/phishing-detection.service.ts b/apps/browser/src/platform/services/phishing-detection.service.ts index 9c72a68ea66..2711dfdab88 100644 --- a/apps/browser/src/platform/services/phishing-detection.service.ts +++ b/apps/browser/src/platform/services/phishing-detection.service.ts @@ -54,6 +54,8 @@ export class PhishingDetectionService { // Set up periodic updates every 24 hours this.setupPeriodicUpdates(); + + PhishingDetectionService.logService.info("Phishing detection feature is initialized."); } private static setupPeriodicUpdates() {