ExtensionMsg_UpdateTabSpecificPermissions is sent to *all* extension frames but only to the *main* frame of the tab |
|||
Issue description
When looking at ActiveTabPermissionGranter::GrantIfRequested I see that it tries to send ExtensionMsg_UpdateTabSpecificPermissions to a set of processes:
SendMessageToProcesses(
ProcessManager::Get(web_contents()->GetBrowserContext())
->GetRenderFrameHostsForExtension(extension->id()),
web_contents()->GeRenderProcessHost(), update_message);
I am a bit concerned that the messages is send to 1) *all* processes hosting a frame with |extension->id()|, but 2) *only* the main frame process of the active tab.
,
Sep 21 2017
Good questions! Starting with 1) - does this need to be sent to all extension frames. Honestly, I'm not 100% sure. There are certainly times that having the permission will affect things *outside* of that direct tab - for instance, the ability to use tabs.executeScript() or see the tab's URL in the tab object. However, both of these are actually determined on the browser side, so I'm not sure the renderer necessarily needs to know about them. For this one, I'd be curious if we can just do a quick "what breaks" test - stop sending the messages and see if tests fail. I'm probably forgetting something obvious. On to 2) - why don't we send this to all frames. The activeTab permission actually only applies to the top-level frame of a tab. This was a conscious decision at the time, because we didn't want granting an extension permission on any blog site to inadvertently grant access to facebook, google, and every other social network through those lovely "like it" iframes that are embedded. However, two notes: - It *should* probably apply at least to frames of the same origin, e.g. example.com embedding example.com. Right now, this will still work, because we won't isolate frames in another process that case, but that's kind of an architectural detail. - In the future, we might need to find a better solution for subframes, since we'd like to be pushing activeTab more strongly. So sending the message to all frames in the tab would probably be worthwhile. Overall, I'm not sure that the current behavior results in any buggy behavior, but I think it could benefit from being cleaned up.
,
Sep 22 2017
Assigning to myself to get it out of triage, but I don't anticipate tackling this soon (unless we discover this is a problem, rather than a beneficial refactor). Other folks, feel free to jump in.
,
Feb 8 2018
|
|||
►
Sign in to add a comment |
|||
Comment 1 by lukasza@chromium.org
, Sep 21 2017