1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-10 05:30:01 +00:00

Revert "Add phishing detection content script."

This reverts commit ce64d3435a.
This commit is contained in:
Jimmy Vo
2025-03-14 11:48:05 -04:00
parent ce64d3435a
commit ed13bf3bbb
4 changed files with 1 additions and 75 deletions

View File

@@ -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": {

View File

@@ -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.");

View File

@@ -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.

View File

@@ -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":