diff --git a/chrome/background.js b/chrome/background.js index 8aa8905..92aacd1 100644 --- a/chrome/background.js +++ b/chrome/background.js @@ -18,20 +18,20 @@ chrome.runtime.onMessage.addListener(function(message, sender) { if(message == 'disabled') { - chrome.browserAction.setIcon({path:"icons/icon-disabled-48.png"}); - //chrome.browserAction.setBadgeText({text: "-"}); - chrome.browserAction.setBadgeBackgroundColor({ color: [55, 55, 55, 255] }); + chrome.action.setIcon({path:"icons/icon-disabled-48.png"}); + // chrome.action.setBadgeText({text: "-"}); + chrome.action.setBadgeBackgroundColor({ color: [55, 55, 55, 255] }); } else if(message == 'enabled') { - chrome.browserAction.setIcon({path:"icons/icon-48.png"}); - chrome.browserAction.setBadgeText({text: ""}); + chrome.action.setIcon({path:"icons/icon-48.png"}); + chrome.action.setBadgeText({text: ""}); } else if(message == 'reenabled') { - chrome.browserAction.setIcon({path:"icons/icon-reenabled-48.png"}); - chrome.browserAction.setBadgeText({text: ""}); - chrome.browserAction.setBadgeBackgroundColor({ color: [255, 65, 54, 255] }); + chrome.action.setIcon({path:"icons/icon-reenabled-48.png"}); + chrome.action.setBadgeText({text: ""}); + chrome.action.setBadgeBackgroundColor({ color: [255, 65, 54, 255] }); } else if(isNaN(message) === false) { @@ -39,14 +39,14 @@ chrome.runtime.onMessage.addListener(function(message, sender) { if(message != "0") { - chrome.browserAction.setBadgeText({text: message, tabId: sender.tab.id}); - chrome.browserAction.setBadgeBackgroundColor({ color: [255, 65, 54, 255] }); - // Not a Chrome function and default is already white text - //chrome.browserAction.setBadgeTextColor({color: [255,255,255,255]}); + chrome.action.setBadgeText({text: message, tabId: sender.tab.id}); + chrome.action.setBadgeBackgroundColor({ color: [255, 65, 54, 255] }); + // Default is already white text + // chrome.action.setBadgeTextColor({color: [255,255,255,255]}); } else { - //chrome.browserAction.setBadgeText({text: "", tabId: sender.tab.id}); + chrome.action.setBadgeText({text: "", tabId: sender.tab.id}); } } diff --git a/chrome/content.js b/chrome/content.js index 0f59041..42dd6e3 100644 --- a/chrome/content.js +++ b/chrome/content.js @@ -604,7 +604,7 @@ function filter_css(selectors, selectorcss) // Update background.js with bagde count block_count++; } - chrome.extension.sendMessage(block_count.toString()); + chrome.runtime.sendMessage(block_count.toString()); } @@ -815,7 +815,7 @@ window.addEventListener("DOMContentLoaded", function() { (items.domainsettingsdb[domain] == DOMAIN_SETTINGS_DO_SCAN_NO_SANITIZE) ) { // Zero out badge - chrome.extension.sendMessage(block_count.toString()); + chrome.runtime.sendMessage(block_count.toString()); if(items.domainsettingsdb[domain] == DOMAIN_SETTINGS_DO_SCAN_NO_SANITIZE) diff --git a/chrome/manifest.json b/chrome/manifest.json index 2d662c1..204c4b6 100644 --- a/chrome/manifest.json +++ b/chrome/manifest.json @@ -1,18 +1,21 @@ { - "manifest_version": 2, + "manifest_version": 3, "name": "CSS Exfil Protection", "version": "1.1.0", "description": "Guard against CSS data exfiltration attacks.", - "content_security_policy": "script-src 'self'; object-src 'self'; style-src 'self'", + "content_security_policy": { + "script-src": "self", + "object-src": "self", + "style-src": "self" + }, "permissions": [ - "http://*/", - "https://*/", "storage", "tabs" ], + "host_permissions": [""], "homepage_url": "https://www.mike-gualtieri.com/css-exfil-vulnerability-tester", "icons": { @@ -23,7 +26,7 @@ "128": "icons/icon-128.png" }, - "browser_action": { + "action": { "default_icon": { "48": "icons/icon-48.png" }, @@ -31,8 +34,7 @@ }, "options_ui": { - "page": "popup.html", - "chrome_style": true + "page": "popup.html" }, "content_scripts": [{ @@ -43,7 +45,7 @@ }], "background": { - "scripts": ["background.js"] + "service_worker": "background.js" } }