如何使用greasemonkey安全地存储密码?
我编写了一个 Greasemonkey 脚本,它提示用户存储登录名和密码,以避免一次又一次重新输入。
我知道 localStorage.setItem();存储密钥和值,但密码将以明文形式存储。那么,存储密码的最佳做法是什么?
有没有API可以将其存储在浏览器中?我需要能够恢复哈希(如果我需要哈希),因为脚本在网站上实现自动登录,并且我需要明确的密码才能执行此操作。
提前致谢。
I wrote a Greasemonkey script, it prompts users to store login and password to avoid the need of re-enter it again and again.
I know localStorage.setItem(); to store a key and a value, but the password will be stored as clear text. So, what is the best practice to store a password?
Is there any API to store it in the browser ? I need to be able to revert the hash (if I need to hash) because the script implement autologin on a website, and I need the clear password to do so.
Thanks by advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
GreaseMonkey 和 JS 不是合适的工具 - 在保证密码安全方面存在许多问题,其中一些问题在 JS 中无法真正解决(由于其浏览器沙箱限制)。
您可以使用 AES(或其他加密方案)对密码进行加密 - 有 AES JS 中的实现 JS< /a>.但是,它们比本机代码慢,并且您需要在需要密码的每个页面上输入 AES 密码(如果您将密码存储在某处,或者存储了一些令牌“密码是有效的”,您回到第一个方)。
由于 GM 旨在扩展页内 JavaScript,因此其安全性选项非常有限。如果您想安全地保存您的网络密码,我建议您使用某种浏览器扩展程序 - 现有的密码管理器有很多扩展程序。
GreaseMonkey and JS are not the right tools for this - there are numerous problems in keeping passwords secure, some of which aren't really solvable in JS (due to its browser sandbox limits).
You could encrypt the password(s) using AES (or some other encryption scheme) - there are AES implementations in JS. However, they are slower than native code, and you'd need to enter the AES passphrase on every page where the password(s) would be needed (if you stored the passphrase somewhere, or stored some token "passphrase was valid", you're back to square one).
As GM is intended for extending in-page JavaScript, its options in security are very limited. If you're trying to save your web passwords securely, I'd suggest some kind of browser extension - there are numerous for existing password managers.