-
Notifications
You must be signed in to change notification settings - Fork 53
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
Model temporary permissions better #86
Comments
I don't agree that this is the model .... the permissions store is keyed by origin, not by session. So the current spec is only the global store from your description. |
Yeah, sorry for the lack of clarity. I'm trying to figure out the model we ought to put in the spec. The model that's currently in the spec is wrong. |
Unfortunately, the poor terminology used in this spec casts doubt over any consensus achieved so far. My advice would be to shore up the existing language and terminology first, to salvage consensus, before attempting to add additional complexity to this. Clear up the existing definitions in the document to reflect that they are persistent permissions as written, so that we have a minimum shared basis on what has been agreed to so far. |
I see browsers doing 3 distinct things with a series of calls to
I'd like to specify algorithms in each capability for updating its permission storage, and have that work for all of the above behaviors. Right now, the spec asks each capability to define a "permission request algorithm", which shows any necessary prompt and if the user accepts updates the stored permission data. You can see an example of this in With My current guess at the right way to structure that is to define «update the permission storage storage for It's possible this is all over-complicated. I thought of having the storage for each capability just hold a set of "things", so that "add thing-1" could add it to multiple permission stores if the UA wants, and "remove all things matching this predicate" could do the same. However, I don't think that works well: if the user grants |
Origin-wide storage handles case (1), and realm/settings-object/tab-specific storage handles case (2), but I didn't address case (3). I think there we put an object-capability in each realm that controls whether it's allowed to access the capability. e.g. each call to watchPosition would result in a separate object-capability for geolocation. Then we write that the UA MAY neuter object-capabilities when the user says to or when a permission is revoked. |
What do we think the benefits will be of defining storage behaviors in detail in the spec, especially if there are 3 different cases that vary across UA? I actually think that in the long run UAs will have more variations. As an alternative, what if the permission store was a UA-defined black box that returned whatever the UA wanted for any particular request? Edit: One disadvantage of including this in the spec is that the size and the complexity of the spec are increased substantially. |
The benefit in my mind is that page authors will know what to expect when they do certain things, instead of having to rely on outside-of-the-spec documentation. e.g. two consecutive calls to That said, it's true we're not guaranteeing anything. At most we're specifying likelihoods here, and that's not the usual domain of specifications. @annevk and @alvestrand, since you're trying to use this infrastructure in other specs, what do you think of @raymeskhoury' suggestion? |
I don't think that works. While we should allow some freedom what becomes part of the key, we shouldn't allow all the things. E.g., if I have two tabs open for a given URL, those need to have access to the same permissions. There need to be some reasonable guarantees to developers, otherwise the whole system is meaningless. And we need to make it clear that origin is at least part of that key, to preserve the same-origin policy. Furthermore, we need to define which origin that is and where it's obtained from, again, to preserve the same-origin policy and guarantee some consistency across user agents. |
Thanks @annevk. I definitely agree with you that from a web developers perspective guarantees are good. However in this case, different browsers have different opinions, so it's hard to guarantee the way things should work in detail. I'm a bit worried that by defining in detail how persistent permissions work, temporary permissions work, etc. (which aren't used consistently across browsers) that the spec will become hard to follow and potentially overspecified in subtle ways.
But this isn't necessarily true for some browser with some permissions (e.g. camera/mic on FF) and this is the intended behavior.
Maybe it's good to define and agree on what these guarantees are at a high level first? This might allow us to simplify what's put into the spec. This is probably hitting on some of the same things as the discussion in #83. |
If the permission is granted just once, it's not stored. It'll always be "prompt". I think that's consistent. |
Right. If persistent permission is Introducing granularity below origin (except potentially double-keyed with iframe origin) seems like a mistake to me. I propose we expand our states instead. See #93 (comment). |
We have 3 possible outcomes when a user grants permission to access a feature:
Safari's the example where "two tabs open for a given URL" can have different granted permissions. We do still have the guarantee that two newly-opened tabs on the same origin would start with the same granted permissions. Is that enough to be worth specifying? |
@jyasskin thanks for the summary. Two questions: Is |
@jyasskin seems to me that your tuple is consistent with the current spec as long as we say that the current spec specifies the "state:" part of the tuple only - except that you have the 'state: granted' as a new value of the state variable. This is the same thing I tried in #63, but later decided not to ask for. I think. |
@alvestrand Could you elaborate a bit? I don't understand "'state: granted' as a new value of the state variable": 'granted' is an existing value for PermissionState, which is the type of the state attribute. The current editors' draft does only define the |
@jyasskin I meant a new value of the https://w3c.github.io/permissions/#enumdef-permissionstate enum, which is part of the dictionary. I regard the tuple as the underlying abstraction and the dictionary as the WebIDL implementation; sorry if I sounded confused. |
@jyasskin I think you're reading too much into what looks to me like Safari merely caching this state in-session (Hitting Safari's only exposure of site-specific settings that I could find were under Preferences/Security/Plug-in Settings..., where I can control things like Flash per website (origin, I suspect). Seems fairly regular. |
Hitting 'Run' in a jsfiddle must create a new Realm. A cache is storage, and this one has user-visible effects, so we can't just ignore it in the spec. "Remember this choice for a day" is persistent storage (with a scheduled revocation, which is just as allowed as manual revocation), matching both Chrome's and Firefox's persistent models, which are both origin-level storage. That doesn't make Safari's temporary model the same as Firefox's. |
I think another way to frame this discussion is: "what are the permissible ways to scope a permission decision?". There are many dimensions to scoping a decision, e.g.
Each browser scopes the decision differently in most of these dimensions. To me there's not an approach that is clearly best or has consensus. Part of which approach is best depends on the UI for permission management in the browser. The only restriction that is clear and has consensus in my mind is that a decision shouldn't be scoped more broadly than the origin of the requesting document. It seemed complicated to try to model all the other reasonable possibilities in the spec which is one reason I felt hesitant about it. |
I see @jyasskin 's point now, which is that temporary settings (what I'd like to call My apologies if mixing in browser-user-facing UX is not helpful. I understand that site developers may have different needs from browser-users, and might not even care whether access is permanent or temporary, but I'm thinking it can't hurt, and it seems to solve the "inconsistency bug" @mounirlamouri brought up at least, by giving us unambiguous return values. |
#95 is an attempt to improve the storage system to handle temporary permissions. It doesn't say anything at all about what |
I think #97 got this. Please reopen if you disagree. |
Right now, we have a single permission store that has basically one entry per permission per origin. This isn't rich enough to model UAs that can grant permission during the lifetime of a single tab. So, what model should we have instead?
I believe the basic cross-browser idea is that each environment settings object (tab visiting a particular page) has some grants and denials for various permissions ("local storage"). Each origin (roughly) also has some grants and denials stored in the browser as a whole ("global storage"). It may also be possible in some cases to continue using an object-capability (a
MediaStream
or series ofwatchPosition
callbacks) even though no permission is stored even locally.So the question is how to specify all of this flexibility.
The text was updated successfully, but these errors were encountered: