-
Notifications
You must be signed in to change notification settings - Fork 165
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
What is the expected interaction of [SecureContext] with mixins? #118
Comments
My reading of the spec is that |
Now arguable it's a specification bug to have a method that returns such an object in a non-secure context. But nothing prevents someone from writing such a spec, really... |
So in the #433, I'm voluntarily conservative with mixin's exposure sets. That is, mixin members inherit the host interface's "exposure set" unless they (or the mixin or partial mixin they're defined on) have an "own exposure set", in which case the mixin member's "exposure set" is the intersection of the two. It seems we should do the same for [SecureContext]. That is, if they're included in a host interface which is itself annotated with [SecureContext], then none of the mixin members should be exposed, regardless of whether or not the mixin itself, or any of its members has a [SecureContext] extended attribute. |
That seems like a bug of sorts in IDL? I would expect it to work like [Exposed] (and also inherit in the same way as that does). |
Specifically, this is currently valid IDL, I believe:
or at least I see nothing in https://heycam.github.io/webidl/#Exposed that would prevent it. That said, at least Gecko's binding generator includes checks not present in the IDL spec. Given the above input, it fails IDL validation with:
basically to keep people from doing stupid stuff. It might make sense to add that sort of check to IDL, of course. That said, there is no way to prevent this solely via IDL. Consider this example:
|
Yeah, it's the same problem for [Exposed]. Seems like |
I am pretty opposed to any dynamic checks here. I would be ok with static IDL-validity checks (that would not catch the "object" case, granted). |
Created a separate issue to handle objects implementing non-exposed interfaces to just float around (#449). Going back to your initial question: "What is the expected interaction of [SecureContext] with mixins?" Here's my proposal: If a mixin is included in an interface which is itself annotated with [SecureContext], then none of the mixin members should be exposed, regardless of whether or not the mixin itself, or any of its members has a [SecureContext] extended attribute. As noted in #118 (comment), this is also what I'm proposing to do with [Exposed] and matches the existing behavior or partials (I'm generally treating mixins as named partials). Would that work for you, @bzbarsky? |
In a non-secure context, right? That seems reasonable to me. |
Yes. |
* Obsolete use of [NoInterfaceObject] extended attribute as mixins. * Add new interface mixin and partial interface mixin constructs. * Replace implements statement by includes statement which only accepts mixins on its rhs. * Remove supplemental interface and related concepts altogether. * Add generic members dfn. * Add table to clarify which members each construct accepts. * Refactor default toJSON operation, and [Exposed] and [SecureContext] algorithms accordingly. Closes whatwg#118. * Prevent operation overloading across mixins and interfaces. Closes whatwg#261. Closes whatwg#363. Closes whatwg#164. Closes https://www.w3.org/Bugs/Public/show_bug.cgi?id=26452. Closes https://www.w3.org/Bugs/Public/show_bug.cgi?id=25495.
* Obsolete use of [NoInterfaceObject] extended attribute as mixins. * Add new interface mixin and partial interface mixin constructs. * Replace implements statement by includes statement which only accepts mixins on its rhs. * Remove supplemental interface and related concepts altogether. * Add generic members dfn. * Add table to clarify which members each construct accepts. * Refactor default toJSON operation, and [Exposed] and [SecureContext] algorithms accordingly. Closes whatwg#118. * Prevent operation overloading across mixins and interfaces. Closes whatwg#261. Closes whatwg#363. Closes whatwg#164. Closes https://www.w3.org/Bugs/Public/show_bug.cgi?id=26452. Closes https://www.w3.org/Bugs/Public/show_bug.cgi?id=25495.
* Obsolete use of [NoInterfaceObject] extended attribute as mixins. * Add new interface mixin and partial interface mixin constructs. * Replace implements statement by includes statement which only accepts mixins on its rhs. * Remove supplemental interface and related concepts altogether. * Add generic members dfn. * Add table to clarify which members each construct accepts. * Refactor default toJSON operation, and [Exposed] and [SecureContext] algorithms accordingly. Closes whatwg#118. * Prevent operation overloading across mixins and interfaces. Closes whatwg#261. Closes whatwg#363. Closes whatwg#164. Closes https://www.w3.org/Bugs/Public/show_bug.cgi?id=26452. Closes https://www.w3.org/Bugs/Public/show_bug.cgi?id=25495.
* Obsolete use of [NoInterfaceObject] extended attribute as mixins. * Add new interface mixin and partial interface mixin constructs. * Replace implements statement by includes statement which only accepts mixins on its rhs. * Remove supplemental interface and related concepts altogether. * Add generic members dfn. * Add table to clarify which members each construct accepts. * Refactor default toJSON operation, and [Exposed] and [SecureContext] algorithms accordingly. Closes whatwg#118. * Prevent operation overloading across mixins and interfaces. Closes whatwg#261. Closes whatwg#363. Closes whatwg#164. Closes https://www.w3.org/Bugs/Public/show_bug.cgi?id=26452. Closes https://www.w3.org/Bugs/Public/show_bug.cgi?id=25495.
* Obsolete use of [NoInterfaceObject] extended attribute as mixins. * Add new interface mixin and partial interface mixin constructs. * Replace implements statement by includes statement which only accepts mixins on its rhs. * Remove supplemental interface and related concepts altogether. * Add generic members dfn. * Add table to clarify which members each construct accepts. * Refactor default toJSON operation, and [Exposed] and [SecureContext] algorithms accordingly. Closes whatwg#118. * Prevent operation overloading across mixins and interfaces. Closes whatwg#261. Closes whatwg#363. Closes whatwg#164. Closes https://www.w3.org/Bugs/Public/show_bug.cgi?id=26452. Closes https://www.w3.org/Bugs/Public/show_bug.cgi?id=25495.
Consider this IDL:
Is the
foo
method available onA
objects in non-secure contexts? Per the current spec text, I'm pretty sure it is, right? That's probably OK, but may be worth an example in the spec.@mikewest
The text was updated successfully, but these errors were encountered: