javascript - 可以保护 Web 应用程序免受浏览器扩展的影响吗?
问题描述
似乎有大量浏览器扩展表现出恶意行为。此外,即使是有效的扩展也可能会受到安全漏洞的影响,从而使其表现出恶意。
避免此问题的一种方法是使用 NWJS、Electron 或类似平台打包您的 Web 应用程序。这具有消除扩展生态系统的优势,但也存在许多缺点(安装过程、更多的资源消耗、增加的劳动力等)。
有人辩称,“最终用户受到损害是用户的责任,而不是网站的错”。虽然这是一个很好的观点,但我们这些负责管理敏感数据的软件的人仍然有责任保护。
在编写将访问敏感数据的 Web 应用程序时,是否可以采取任何措施来防止浏览器扩展?
编辑:这个问题的任何创造性解决方案都会很棒。或者,也欢迎确认的否定。从这个问题延伸出来的一些想法:
- 可以保护窗口对象或以某种方式将其设为私有吗?
- 在页面之前加载的扩展的 JavaScript 是否有任何限制可以用于 Web 应用程序的优势?
- 配套扩展是否可以检测到其他扩展,然后向 Web 应用程序传达运行不安全的信息?或者至少通知用户滥用的可能性?
- 扩展后台脚本是否也注入到 iframe 和通过调用 window.open 创建的子窗口中?也许 Web 应用程序会用窗口对象的不同安全副本替换窗口对象。
- 是否有一些聪明的方法来检测页面上是否运行了第三方代码?JavaScript 环境的一种“散列”?
解决方案
There's a (primitive) solution to detect user extensions installed on the browser, from there I guess you can deny the access to your web application until the user uninstalls these extensions. It consists in a small database of assets (icons), if the javascript can find these assets, it means the extension is installed.
CONS: You can't detect if the extensions are running, therefore if the user disables them that won't be detected and you will still get a positive.
The code is in this link:
Can a Website detect what browser extensions are being used?
Post with users feeding this database with more assets:
https://blog.jeremiahgrossman.com/2006/08/i-know-what-youve-got-firefox.html
推荐阅读
- python - 如何将列表中的项目插入 QlistWidget?
- reactjs - 如何将上下文绑定到 React 功能组件
- javascript - 如何在 LocalStorage 中保存 reactjs 状态对象?
- python - 如何获得 websocket 连接的输出?
- excel - 使用目录中最近 10 个最新文件夹的列表填充组合框
- java - 如何解决 java.lang.IllegalArgumentException:找不到命名参数 [enteredValue],期待 Hibernate 5.4.15 Final 中的 [] 之一?
- assembly - ATMEL 汇编器 .DB 抱怨“未对齐”
- reactjs - “数字”类型的参数不能分配给“字符串”类型的参数,给出错误
- node.js - NodeJS 打包和解包作为缓冲区比 JSON 慢
- node.js - firebase 可调用节点函数