-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal: extend the manifest file so that extensions can extend the permissions API #271
Comments
I'm not entirely sure I follow what you are proposing. Can you give some code examples? This is the right place for this. |
The end goal here is for the permissions policy to be accessible to extensions to affect the behavior of the allow attribute. This is useful for having extension based wallets being able to imitate this logic would be useful for web compatibility of SPAs in web3 across a variety of wallets. As for how that's achieve I have an idea in mind (expose the permissions API to extensions so they can hook into it and add additional permissions), but I'm not necessarily certain it's the best way to approach the problem. Specifically, I'd like for this case to be achievable by extensions:
Right now, Brave wallet does this via checking the state of the permissions API which allows our wallet to detect this and inject the provider if the user consents to it. If the permission is not granted then the provider wouldn't be injected since there's a 3rd party iframe. For more details on the logic here's the docs of how we handle this: https://wallet-docs.brave.com/provider-availability/ Here's code where our implementation was refactored a bit to enable this for both ethereum and solana wallets. brave/brave-core#12945 |
This sounds very niche and probably irrelevant to most browsers. One possible way to implement this would be to extend |
The feature request here is difficult to understand for people without prior context. Could you try to be more explicit about what you'd like to see? The request here asks for "extend the permission API", but that is very vague and not well defined. While the description definitely suggests the desire to query the status, it is not clear whether you're also looking for a way to modify the policy for existing documents. An example of such a use case (modifying policies rather than interpreting them) has been voiced in https://bugzilla.mozilla.org/show_bug.cgi?id=1771352. While extensions could potentially be a vehicle to extend the permission policy, I think that we need to be very careful here. This is a web platform API, and if extensions are able to register arbitrary identifiers, there is a chance of conflicts with (future) standard keywords, or even conflicts with different extensions trying to claim a keyword. I have no interest in pursuing this feature request until there is an informed decision (approval) from the owners of this feature. |
Yup, it's similar to what you've essentially described @bershanskiy. Basically something like this added to the manifest.json
Which would allow an extension to be able to register a string (via the So for example, with the permissions API it would work in the following way if an extension registers a permission. Ask -> If a website uses the
Agreed there definitely needs to be carefully consideration here. In some cases these conflicts may be useful (e.g. it would be useful for wallets in web3 to register under the same permission so that web pages don't need to actively track every wallet created and ask for access), however in many others it may be harmful. Especially in the case where a malicious extension registers intentionally under a separate permission to trick the user into granting access that a user wouldn't want to if they were properly informed. To me this seems like the trickiest part of this, but if done right it allows for the extension model to align much better with the Principle of Least Privileges than what we have today. |
I've recently been looking at the Permissions API in the context of extensions being able to extend them. One use case that's come up recently is that cryptocurrency wallets have an interest in being able to leverage the permissions API to be able to allow the user to determine with the wallet provider should be injected into a window.
For example, in Brave's cryptocurrency wallet, we have the ability to extend the Permissions API directly to prevent the wallet from being injected in third party iframes unless the user explicitly allows the permission and the main window uses the
allow
attribute set by this policy. However, because most other wallets are not built directly into the browser and instead are just extensions they aren't able to leverage these additional permissions. Because of this difference there arises web compatibility considerations where some wallets like Opera and Brave can support these capabilities, but many others cannot.Ideally, it would be best to be able to allow the permissions API to be extensible by extensions as well such that they can register the native APIs as well as the
allow
attribute. While the main focus of my request is related to cryptocurrency wallets, I can imagine this being used by various other extensions as well. For example, it's well known that due to the way that password managers inject their JS objects into the window they open up additional attack vectors if the website has a XSS vulnerability to syphon passwords from the password manager. However, if a password manager is able to leverage the permissions API to limit where the objects are injected.With this in mind, I've got two main questions:
The text was updated successfully, but these errors were encountered: