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.
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.
To be discussed at Jan 10 WebExtensions triage meeting. Agenda: https://docs.google.com/document/d/18K97o1juaHSeYEkes1iMz8AayjuVkUuIK844ErGaa-c/edit#
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.
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.