Skip to content

Commit 10d6ae6

Browse files
authored
Merge pull request #728 from oliverdunk/site-access-request-rename
Update `addSiteAccessRequest` proposal to use `addHostAccessRequest` name
2 parents ead0663 + 2e7723e commit 10d6ae6

3 files changed

+36
-36
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# permissions.[add/remove]SiteAccessRequest() API
1+
# permissions.[add/remove]HostAccessRequest() API
22

33
## API Overview
44

@@ -9,69 +9,69 @@ Extensions can request host permissions via:
99
- Manifest declared `optional_host_permissions`, granted at runtime after a user gesture by `<browser>.permissions.request()`
1010
- Manifest declared `matches` for a `content_script`, granted at install time by default
1111

12-
In some browsers, users can withhold host permissions causing the extension to only have site access when the extension is invoked. For example, in Chrome a user can set an extension to run only "on click". When the extension is clicked, it gains site access to the tab's main frame origin (effectively acting like [`activeTab` permission](https://developer.chrome.com/docs/extensions/develop/concepts/activeTab#what-activeTab-allows).
12+
In some browsers, users can withhold host permissions causing the extension to only have host access when the extension is invoked. For example, in Chrome a user can set an extension to run only "on click". When the extension is clicked, it gains access to the tab's main frame origin (effectively acting like [`activeTab` permission](https://developer.chrome.com/docs/extensions/develop/concepts/activeTab#what-activeTab-allows).
1313

14-
Each browser may decide how it signals the user when an extension is requesting access (e.g through the extensions menu). However, there is no way for an extension to explicitly signal at runtime it’s requesting site access after it was withheld without a user gesture and a heavy-weight permission dialog.
14+
Each browser may decide how it signals the user when an extension is requesting access (e.g through the extensions menu). However, there is no way for an extension to explicitly signal at runtime it’s requesting host access after it was withheld without a user gesture and a heavy-weight permission dialog.
1515

1616

1717
### Objective
1818

19-
Allow the extension to show site access requests at runtime without any user gesture in a less-obtrusive way than with `permissions.request()`. This can be done with a new API that:
19+
Allow the extension to show host access requests at runtime without any user gesture in a less-obtrusive way than with `permissions.request()`. This can be done with a new API that:
2020

2121
- Applies to a specific tab or document id. Developers can specify inactive tabs (request will be shown by the browser when the user activated them).
2222
- Doesn’t need to be made inside the handler for a user action
2323
- Shows the request in the UI, handled differently by each browser. See more in [UI Elements and User-Visible Effects](#ui-elements-and-user-visible\-effects) section
24-
- When accepted, grants always access to the site’s top origin
24+
- When accepted, grants always access to the host
2525
- Resets the request on cross-origin navigation
2626

2727
#### Use Cases
2828

29-
An extension requested access to a site but the user withheld its access and forgot about it. Extension wants to signal it needs site access to execute without user action. For example, “shopping” extension wants to show site access when user navigates to “amazon.com” and access was withheld.
29+
An extension requested access to a host but the user withheld its access and forgot about it. Extension wants to signal it needs host access to execute without user action. For example, “shopping” extension wants to show host access when user navigates to “amazon.com” and access was withheld.
3030

3131
### Consumers
3232

33-
Extensions that want to signal the user when they need site access.
33+
Extensions that want to signal the user when they need host access.
3434

3535
## Implementation
3636

3737
### API Schema
3838

3939
```
40-
// Adds a site access request. Request will only be signaled to the user if
41-
// extension can be granted access to site in the request (i.e., one specified
40+
// Adds a host access request. Request will only be signaled to the user if
41+
// extension can be granted access to host in the request (i.e., one specified
4242
// in host_permissions, optional_host_permissions, a content script match
43-
// pattern, or an applicable activeTab site).
43+
// pattern, or an applicable activeTab host).
4444
// Resolves whether the request is valid.
45-
Promise<boolean> browser.permissions.addSiteAccessRequest({
46-
// The id of the tab where site access requests can be shown. If provided,
45+
Promise<boolean> browser.permissions.addHostAccessRequest({
46+
// The id of the tab where host access requests can be shown. If provided,
4747
// the request is shown on the specified tab and is removed when the tab
4848
// navigates to a new origin.
4949
// Chrome requires either this or `documentId` to be specified.
5050
number?: tabId,
51-
// The id of a document where site access requests can be shown. Must be
51+
// The id of a document where host access requests can be shown. Must be
5252
// the top-level document within a tab. If provided, the request is shown on
5353
// the tab of the specified document and is removed when the document
5454
// navigates to a new origin.
5555
// Chrome requires either this or `tabId` to be specified.
5656
string?: documentId,
57-
// The URL pattern where site access requests can be shown. If provided,
58-
// site access requests will only be shown on URLs that match this pattern.
57+
// The URL pattern where host access requests can be shown. If provided,
58+
// host access requests will only be shown on URLs that match this pattern.
5959
// Browsers may require different levels of specificity.
6060
string?: pattern,
6161
},
6262
callback?: function,
6363
);
6464
65-
// Removes a site access request, if existent.
65+
// Removes a host access request, if existent.
6666
// Resolves whther the request was removed.
67-
Promise<boolean> browser.permissions.removeSiteAccessRequest({
68-
// The id of the tab where site access request will be removed.
67+
Promise<boolean> browser.permissions.removeHostAccessRequest({
68+
// The id of the tab where host access request will be removed.
6969
// Chrome requires either this or `documentId` to be specified.
7070
number?: tabId,
71-
// The id of a document where site access request will be removed.
71+
// The id of a document where host access request will be removed.
7272
// Chrome requires either this or `tabId` to be specified.
7373
string?: documentId,
74-
// The URL pattern where site access request will be removed.
74+
// The URL pattern where host access request will be removed.
7575
string?: pattern,
7676
},
7777
callback?: function,
@@ -83,12 +83,12 @@ Note: We don’t support iframes since they are not included in the runtime host
8383
### New Permissions
8484
| Permission Added | Proposed Warning |
8585
| ---------------- | -------------------------------------------------------- |
86-
| N/A | Permissions API is used to “request declared optional permissions at run time rather than install time, so users understand why the permissions are needed and grant only those that are necessary” (according to documentation). The goal of this new method is for the extension to request site access, which is effectively a permission. We can adjust the description to not be restricted just to optional permissions. |
86+
| N/A | Permissions API is used to “request declared optional permissions at run time rather than install time, so users understand why the permissions are needed and grant only those that are necessary” (according to documentation). The goal of this new method is for the extension to request host access, which is effectively a permission. We can adjust the description to not be restricted just to optional permissions. |
8787

8888
#### Other Alternatives considered
8989

90-
- Action API is used to control the extension’s button in the browser’s toolbar. It’s exposed if the extension includes the "action" key in the manifest. This is troublesome since an extension could not have an action, but still want to show site access requests. We should not limit requests for extensions with actions
91-
- `permissions.addSiteAccessRequest()` resolves when request is accepted/rejected. An extension could be requesting site access and be granted site access through another mechanism (e.g changing site access in the extensions menu). We would either return a) true if we consider permissions granted through other mechanisms or b) false, because permission wasn't explicitely granted through the request. a) adds complexity and b) may cause confusion. Thus, we consider better to resolve whether the request is valid, and separately extension can listen whether permission is granted through `permissions.onAdded()`.
90+
- Action API is used to control the extension’s button in the browser’s toolbar. It’s exposed if the extension includes the "action" key in the manifest. This is troublesome since an extension could not have an action, but still want to show host access requests. We should not limit requests for extensions with actions
91+
- `permissions.addHostAccessRequest()` resolves when request is accepted/rejected. An extension could be requesting host access and be granted host access through another mechanism (e.g changing host access in the extensions menu). We would either return a) true if we consider permissions granted through other mechanisms or b) false, because permission wasn't explicitely granted through the request. a) adds complexity and b) may cause confusion. Thus, we consider better to resolve whether the request is valid, and separately extension can listen whether permission is granted through `permissions.onAdded()`.
9292

9393
### Manifest Changes
9494

@@ -102,11 +102,11 @@ None.
102102

103103
#### Persistence
104104

105-
Showing a site access request is never persisted.
105+
Showing a host access request is never persisted.
106106

107107
#### Alignment with Other Vendors and Action APIs
108108

109-
Each browser can decide how they want to signal the extension site access requests. Browsers may decide to ignore the request (e.g due to noisiness, or if an extension has no visible UI).
109+
Each browser can decide how they want to signal the extension host access requests. Browsers may decide to ignore the request (e.g due to noisiness, or if an extension has no visible UI).
110110
On Chrome’s side, we are exploring adding an ‘Allow’ chip in the extensions toolbar.
111111

112112
## User Experience
@@ -115,29 +115,29 @@ On Chrome’s side, we are exploring adding an ‘Allow’ chip in the extension
115115

116116
Each browser will handle the request as desired. On Chrome’s side, we are considering showing an ‘Allow’ button in the toolbar for these requests. On click, it would grant persistent access to the site’s origin (which can be again withheld by the user)
117117

118-
!["Site access request on Chrome toolbar"](./assets/permissions-requestSiteAccess-chrome-toolbar.png)
118+
!["Host access request on Chrome toolbar"](./assets/permissions-addHostAccessRequest-chrome-toolbar.png)
119119

120120
We would also provide a way for users to silence the requests for an extension through a setting in the extensions menu and in chrome://extensions.
121121

122-
!["Extensions menu on Chrome"](./assets/permissions-requestSiteAccess-chrome-menu.png)
122+
!["Extensions menu on Chrome"](./assets/permissions-addHostAccessRequest-chrome-menu.png)
123123

124124
#### Attribution
125-
The site access request will be attributed directly to the extension.
125+
The host access request will be attributed directly to the extension.
126126

127127
## Security and Privacy
128128

129129
### Exposed Sensitive Data
130130

131-
This API does not directly expose any sensitive data to the extension. However, it could lead to the extension gaining access to the site.
131+
This API does not directly expose any sensitive data to the extension. However, it could lead to the extension gaining access to the host.
132132

133133
### Abuse Scenarios
134134

135-
Extensions can enable site access requests on every tab, which could be annoying to the user.
135+
Extensions can enable host access requests on every tab, which could be annoying to the user.
136136

137137
#### Mitigations
138138
Attacks of annoyance are not in our threat model. Extensions can have annoying behaviors, but they risk uninstallation.
139139
On the browser side, we can place some restrictions to limit noisiness:
140-
- User can decide whether they want to see site access requests for an specific extension
140+
- User can decide whether they want to see host access requests for an specific extension
141141
- We can explore setting a max amount of times the request is shown when the user ignores it.
142142

143143
### Additional Security Considerations
@@ -147,17 +147,17 @@ None
147147

148148
### Existing Workarounds
149149

150-
Users can change an extension's site access. The only way for extensions to signal the user they want to regain access to the site is through `permissions.request()` flow which is noisy and requires a user gesture. Otherwise, they rely on the user realizing through the browser UI (e.g extensions menu).
150+
Users can change an extension's host access. The only way for extensions to signal the user they want to regain access to the host is through `permissions.request()` flow which is noisy and requires a user gesture. Otherwise, they rely on the user realizing through the browser UI (e.g extensions menu).
151151

152-
Extensions have no way to signal the user that they want access to the site, and rely on the user realizing through the browser UI (e.g extensions menu)
152+
Extensions have no way to signal the user that they want access to the host, and rely on the user realizing through the browser UI (e.g extensions menu)
153153

154154
### Other Alternatives Considered
155155

156156
Specifying URL patterns in the extension's manifest. We decided against that because:
157157
- This is designed to be a highly-contextual signal. The extension should do it only if they have strong believe they will provide value to the user on the given page. This should not be a passive, "hey, I think I can do something here", it should be a "hey, you, the user, probably want me to do something here".
158158
- We do not want extensions to simply show a request on every page, and specifying a list of patterns would lend itself to that behavior (even by not allowing broad match patterns).
159-
- It's too close to host permissions themselves. We suspect that the vast majority of extensions would just have the same field match as in their host permissions, since there is no more knowledge at manifest time about why the extension would run on a specific site.
160-
That being said, each browser a URL pattern can be specified in `permissions.addSiteAccessRequest`. Each browser can determine whether other parameters must be specified apart from the URL pattern.
159+
- It's too close to host permissions themselves. We suspect that the vast majority of extensions would just have the same field match as in their host permissions, since there is no more knowledge at manifest time about why the extension would run on a specific host.
160+
That being said, each browser a URL pattern can be specified in `permissions.addHostAccessRequest`. Each browser can determine whether other parameters must be specified apart from the URL pattern.
161161

162162
### Open Web API
163-
This is related to the extensions showing site access requests in the browser; it doesn't affect the web.
163+
This is related to the extensions showing host access requests in the browser; it doesn't affect the web.

0 commit comments

Comments
 (0)