From ed13bf3bbb3ab09ac526d3b70263c1479305809a Mon Sep 17 00:00:00 2001 From: Jimmy Vo Date: Fri, 14 Mar 2025 11:48:05 -0400 Subject: [PATCH] Revert "Add phishing detection content script." This reverts commit ce64d3435a00f6b58921d66294eccc4a73992cb0. --- apps/browser/src/manifest.v3.json | 6 --- ...ger-phishing-detection-script-injection.ts | 20 -------- .../services/phishing-detection.service.ts | 48 +------------------ apps/browser/webpack.config.js | 2 - 4 files changed, 1 insertion(+), 75 deletions(-) delete mode 100644 apps/browser/src/phishing-detection/trigger-phishing-detection-script-injection.ts diff --git a/apps/browser/src/manifest.v3.json b/apps/browser/src/manifest.v3.json index af4f271427e..1e2ac1812ca 100644 --- a/apps/browser/src/manifest.v3.json +++ b/apps/browser/src/manifest.v3.json @@ -30,12 +30,6 @@ "matches": ["*://*/*", "file:///*"], "exclude_matches": ["*://*/*.xml*", "file:///*.xml*"], "run_at": "document_start" - }, - { - "js": ["content/trigger-phishing-detection-script-injection.js"], - "matches": ["*://*/*", "file:///*"], - "exclude_matches": ["*://*/*.xml*", "file:///*.xml*"], - "run_at": "document_start" } ], "background": { diff --git a/apps/browser/src/phishing-detection/trigger-phishing-detection-script-injection.ts b/apps/browser/src/phishing-detection/trigger-phishing-detection-script-injection.ts deleted file mode 100644 index 81248e7668a..00000000000 --- a/apps/browser/src/phishing-detection/trigger-phishing-detection-script-injection.ts +++ /dev/null @@ -1,20 +0,0 @@ -// eslint-disable-next-line no-restricted-imports -import { PhishingDetectionService } from "src/platform/services/phishing-detection.service"; - -if (document.readyState === "loading") { - document.addEventListener("DOMContentLoaded", loadPhishingDetectionContent); -} else { - void loadPhishingDetectionContent(); -} - -async function loadPhishingDetectionContent() { - const activeUrl = await PhishingDetectionService.getActiveUrl(); - - const isPhishingDomain = PhishingDetectionService.checkUrl(activeUrl); - - if (isPhishingDomain) { - PhishingDetectionService.notifyUser(activeUrl); - } -} - -console.log("Phishing Detection Service loaded."); diff --git a/apps/browser/src/platform/services/phishing-detection.service.ts b/apps/browser/src/platform/services/phishing-detection.service.ts index 184fb0627ec..01bcb2d874a 100644 --- a/apps/browser/src/platform/services/phishing-detection.service.ts +++ b/apps/browser/src/platform/services/phishing-detection.service.ts @@ -29,53 +29,7 @@ export class PhishingDetectionService { } // @TODO: WIP. We can have a pop-up or send a notification to other services. - static notifyUser(url: string) { - const phishingDivId = "phishing-notification-bar"; - const message = `${url} is a known phishing site`; - - const wrapper = document.createElement("div"); - wrapper.id = phishingDivId; - wrapper.classList.add("inner-wrapper"); - wrapper.style.position = "fixed"; - wrapper.style.top = "20px"; - wrapper.style.right = "20px"; - wrapper.style.zIndex = "10000"; - wrapper.style.backgroundColor = "#fff"; - wrapper.style.padding = "15px"; - wrapper.style.border = "1px solid #ccc"; - wrapper.style.borderRadius = "5px"; - wrapper.style.boxShadow = "0 2px 10px rgba(0,0,0,0.2)"; - - const messageElement = document.createElement("div"); - messageElement.id = "change-text"; - messageElement.classList.add("notification-body"); - messageElement.textContent = message; - - const exitButton = document.createElement("button"); - exitButton.type = "button"; - exitButton.id = "change-exit"; - exitButton.classList.add("primary"); - exitButton.textContent = "Exit the page"; - - exitButton.onclick = () => { - const barEl = document.getElementById(phishingDivId); - if (barEl != null) { - barEl.parentElement.removeChild(barEl); - } - }; - - wrapper.appendChild(messageElement); - wrapper.appendChild(exitButton); - - document.body.appendChild(wrapper); - - setTimeout(() => { - console.log("Jimmy inject 7"); - if (document.body.contains(wrapper)) { - document.body.removeChild(wrapper); - } - }, 10000); - } + static notifyUser(url: string) {} /* This listener will check the URL when the tab has finished loading. diff --git a/apps/browser/webpack.config.js b/apps/browser/webpack.config.js index 7b99984117c..ff5331ae459 100644 --- a/apps/browser/webpack.config.js +++ b/apps/browser/webpack.config.js @@ -191,8 +191,6 @@ const mainConfig = { "popup/main": "./src/popup/main.ts", "content/trigger-autofill-script-injection": "./src/autofill/content/trigger-autofill-script-injection.ts", - "content/trigger-phishing-detection-script-injection": - "./src/phishing-detection/trigger-phishing-detection-script-injection.ts", "content/bootstrap-autofill": "./src/autofill/content/bootstrap-autofill.ts", "content/bootstrap-autofill-overlay": "./src/autofill/content/bootstrap-autofill-overlay.ts", "content/bootstrap-autofill-overlay-menu":