其他 Chrome 个扩展可以读取我的扩展写入的日志消息吗?

Can other Chrome extensions read the log messages written by my extension?

我已经为 Google Chrome 编写了一个扩展,它通过 console.log 将一些内容写入其后台页面的控制台。任何其他扩展程序都可以访问我在那里写入的数据吗?或者它对它们安全吗?

我猜答案是 "no other extension can access this, only your extension (and the user)";但是我找不到权威的来源。

使用默认标志,浏览器将拒绝(静默)访问 chrome-extension:// 页面给其他 extensions/apps public API。

有一些标志可以覆盖它(例如 silent-debugger-extension-api 带有 chrome.debugger API 的标志),但它需要用户采取行动(或可以改变Chrome 启动器参数)。

此外,还有私人 API 允许 Chrome Apps & Extensions Developer Tool 等功能运行,但作为私人 API 只有 Google 列入白名单的应用程序才能访问。

最后,只要 DevTools 打开,extensions that extend DevTools 就可以通过用恶意副本替换 console 对象来转移控制台输出。这不太可能,我还没有测试过,但理论上是可能的。