The default bug view has changed. See this FAQ.

Prevent extensions from changing security headers without a separate permission

NEW
Unassigned
(Needinfo from 2 people)

Status

()

Toolkit
WebExtensions: Request Handling
P3
normal
10 months ago
2 months ago

People

(Reporter: kmag, Unassigned, NeedInfo)

Tracking

(Blocks: 1 bug)

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [webRequest][design-decision-needed]triaged)

(Reporter)

Description

10 months ago
I was looking into a bug about the Black Menu for Google extension when I noticed that it contained this code:

https://gist.github.com/kmaglione/bcf500aa6748b069049e8005a230c188

This basically makes it possible for anyone to make cross-domain requests to a huge swath of Google sites, lies to Google about the origin of the requests in the process, and removes restrictions on embedding sites into frames.

Ordinary extensions should not need to change security headers like this, and they *especially* shouldn't need to make changes such as allowing "*" as an origin in CORS headers.

There may be security extensions which do need to change these kinds of headers, though, so I think we should probably allow it via a special permission of some sort, but we shouldn't make it easy for people to do this needlessly.
(Reporter)

Comment 1

10 months ago
I guess I re-read that. It only allows cross-origin access to https://translate.google.com/translate_a/single*, and lies about the request's origin to https://accounts.google.com/ListAccounts?listPages=1&source=ChromiumBrowser&json=standard. But that only makes things very slightly better, and the other issues are still there.

Updated

10 months ago
Blocks: 1253374

Updated

10 months ago
Whiteboard: [webRequest] → [webRequest][design-decision-neeed]triaged

Updated

5 months ago
Component: WebExtensions: Untriaged → WebExtensions: Request Handling
Flags: needinfo?(dveditz)
Priority: -- → P3

Updated

4 months ago
Whiteboard: [webRequest][design-decision-neeed]triaged → [webRequest][design-decision-needed]triaged

Comment 2

2 months ago
To be discussed at Jan 10 WebExtensions triage meeting. 

Agenda: https://docs.google.com/document/d/18K97o1juaHSeYEkes1iMz8AayjuVkUuIK844ErGaa-c/edit#

Updated

2 months ago
Flags: needinfo?(g.maone)

Comment 3

2 months ago
What we want to do is preventing extensions from relaxing security restrictions already set by "security headers".

Certainly some extensions (case in point, NoScript) might legitimately need to *tighten* existing policies, e.g. by setting CSP headers (still, this wouldn't require *modifying* or *deleting* existing ones) which is currently the best hack we've got to implement selective embedded script blocking from WebExtensions.

Anyway, in the general case, deciding what headers are fine to be touched and how (delete/modify/add) might be quite difficult, and we do need a list of these headers and a summary of their properties, no matter if we decide to completely ban "dangerous" actions or to put them behind a scary "This extension wants to change the security policies of web pages" kind of permission.

I can see :dveditz is already needinfo-ed, adding :ekr to help better understand what to call "Security headers" and for any other wisdom they could share about this issue.
Flags: needinfo?(g.maone) → needinfo?(ekr)

Comment 4

2 months ago
After some test runs on my NoScript WebExtension prototype I must retreat about my statement that it "wouldn't require *modifying* or *deleting* existing" CSP headers.

Actually, since HTTP headers are cached, when a NoScript "Allow..." command is issued, the directive used to enforce NoScript permissions needs to explicitly be edited out from whatever cached CSP header value we've got (I use a random delimiter to ensure that I don't interfere with preset policies).

So, at least for CSP, either I need a special API or I do need a permission to *edit* (not just add) CSP headers.
You need to log in before you can comment on or make changes to this bug.