Skip to content
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

request: separate extension permissions from site permissions #7

Closed
Kilian opened this issue Jun 8, 2021 · 5 comments
Closed

request: separate extension permissions from site permissions #7

Kilian opened this issue Jun 8, 2021 · 5 comments
Labels
enhancement Enhancement or change to an existing feature topic: csp Related to content security policy enforcement

Comments

@Kilian
Copy link

Kilian commented Jun 8, 2021

This might be already on the table but I couldn't find it explicitly mentioned in the charter.

A large majority of extensions opt to rip out CSP headers completely[1]. They have to do this because extension scripts (like content scripts) are subject to CSP headers and so can be prevented from running by any website.

Browsers being user agents, I feel that extension permissions should not be influenced by website security headers. Conversely, I also do not think website security headers should have to be sacrificed for extension compatibility. I would like to see this community group come up with a model that preserves a websites security settings on one level, but allow extension content scripts to run as well.

[1] https://therecord.media/thousands-of-chrome-extensions-are-tampering-with-security-headers/

@nir-walkme
Copy link

I agree

@twschiller
Copy link

A related header is the X-Frame-Options header: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options which a server can use to prevent iframing.

Currently a browser extension author has to request the webRequest permission and modify the responses. This is also subject to the limitation that only one extension can modify the server response

References:

@Jack-Works
Copy link

According to CSP specification https://www.w3.org/TR/CSP3/#extensions,

Policy enforced on a resource SHOULD NOT interfere with the operation of user-agent features like addons, extensions, or bookmarklets. These kinds of features generally advance the user’s priority over page authors, as espoused in [HTML-DESIGN].

Moreover, applying CSP to these kinds of features produces a substantial amount of noise in violation reports, significantly reducing their value to developers.

Chrome, for example, excludes the chrome-extension: scheme from CSP checks, and does some work to ensure that extension-driven injections are allowed, regardless of a page’s policy.

@dotproto
Copy link
Member

dotproto commented Jul 8, 2021

While I agree that the browser extension platform should take steps to provide extension developers with alternatives that don't compromise the security features of the web platform, I'd like to caution against hyperbole. "A large majority of extensions" do not, in fact, "opt to rip out CSP headers completely."

Taking a closer look at the preprint paper the authors examined 186,434 extensions from the Chrome Web Store. Through runtime analysis of a subset of these items, the authors found that 2,485 "tamper with at least one security header considered for this study." While that was "approximately 76% of all the extensions … analyzed at this stage", it represents only approx. 1.33% of the total extension pool they analyzed.

I would like to see this community group come up with a model that preserves a websites security settings on one level, but allow extension content scripts to run as well.

For clarity, what do you mean by "allow extension content scripts to run as well"? I may be mistaken, but I believe all browsers participating in this group can inject content scripts in a page without relaxing CSP or other security headers. That said, I believe DOM-injected scripts (extension scripts running in the page's world) and web accessible resources (e.g. images) likely need other accommodations. Please correct me if I'm off base here.

According to CSP specification https://www.w3.org/TR/CSP3/#extensions,

Chrome, for example, excludes the chrome-extension: scheme from CSP checks, and does some work to ensure that extension-driven injections are allowed, regardless of a page’s policy.

The last quotation from the CSP spec is no longer accurate. Beginning in Chrome 85, content scripts are limited by the host page's CSP restrictions, but background contexts are not. This change was introduced for security reasons related to process boundaries. Additional details can be found in this chromium-extensions thread and in the chromium explainer.

@dotproto dotproto added topic: csp Related to content security policy enforcement enhancement Enhancement or change to an existing feature labels Aug 5, 2021
@dotproto
Copy link
Member

Closing this issue due to lack lack of interaction since my last comment. We have other, issues that better target specific aspects of extension permissions and script execution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement or change to an existing feature topic: csp Related to content security policy enforcement
Projects
None yet
Development

No branches or pull requests

5 participants