google-chrome-extension - Chrome 扩展 100% 无法检测到
问题描述
我正在开发一个特定站点绝对无法检测到的 Chrome 扩展程序。
只需检查一下,在 2020 年,如果我没有向页面中注入任何 DOM/JS/内容,并且 web_accessible_resources 未在 manifest.json 中定义,则网站无法检测扩展。
据我所知,Chrome 正在将“拒绝加载 ...”错误直接记录到 DevTools 控制台,绕过控制台。* api
测试代码,看看我是否可以挂钩 fetch 触发的“拒绝加载..”错误 - 看起来你不能。
<script>
const clog = console.log
console.log = function(x) {
clog('x: ',x)
}
const cerror = console.error
console.error = function(x) {
cerror('error: ',x)
}
window.fetch('chrome-extension://jifpbeccnghkjeaalbbjmodiffmgedin/options.js',{method: 'get'})
.then(response => response.text()).then(body => console.log(body))
.catch(err => console.log(err))
</script>
我认为 frame->addMessageToConsole 的策略代码使用绕过了控制台。* API
if (!is_empty_origin && !is_own_resource &&
!is_dev_tools && !transition_allowed && !is_error_page) {
std::string message = base::StringPrintf(
"Denying load of %s. Resources must be listed in the "
"web_accessible_resources manifest key in order to be loaded by "
"pages outside the extension.",
resource_url.spec().c_str());
frame->addMessageToConsole(
blink::WebConsoleMessage(blink::WebConsoleMessage::LevelError,
blink::WebString::fromUTF8(message)));
return false;
}
解决方案
推荐阅读
- haskell - 如何在 GHCi 中配置 Vi 模式?
- c# - 如何使用单独的路径初始化 StorageFolder 类型的变量?
- node.js - 在通过 multer 上传图像之前验证表单数据
- node.js - 如果请求被重定向,如何登录
- oauth - Shopify 访问令牌重定向我而不是给我令牌
- powershell - PRTG Vsphere 快照脚本
- mapbox-gl-js - Mapbox GL JS:如何在圆点内绘制水平分隔符
- apache-kafka - 可能导致“org.apache.kafka.common.errors.TimeoutException:60000 毫秒后更新元数据失败”的不同原因有哪些?
- c# - 使用 insert into select 将源列添加到输出子句
- css - 运行 React 和 Bootstrap 的 CSS 使卡片具有相同的高度