Implement CSP child-src directive #949

Closed
opened 6 years ago by wolfbeast · 7 comments
wolfbeast commented 6 years ago (Migrated from github.com)

Even though this CSP 1.1 directive is deprecated in the CSP standard (right after introducing it!) and as such we never implemented it (well, very briefly in our JS implementation) because people want to use worker-src instead for workers, we should probably for web compatibility implement child-src to fix CSP-restricted use of web workers that now fall back to script-src when child-src is used (e.g. dropbox).
We can alias worker-src (currently only implemented in Chrome) to child-src, mostly (just needs the frame-src functionality of it disabled in that case).

Implementation ref on BMO: https://bugzilla.mozilla.org/show_bug.cgi?id=1045891 (FF45)

Even though this CSP 1.1 directive is deprecated in the CSP standard (right after introducing it!) and as such we never implemented it (well, very briefly in our JS implementation) because people want to use `worker-src` instead for workers, we should probably for web compatibility implement `child-src` to fix CSP-restricted use of web workers that now fall back to `script-src` when `child-src` is used (e.g. dropbox). We can alias `worker-src` (currently only implemented in Chrome) to `child-src`, mostly (just needs the `frame-src` functionality of it disabled in that case). Implementation ref on BMO: https://bugzilla.mozilla.org/show_bug.cgi?id=1045891 (FF45)
wolfbeast commented 6 years ago (Migrated from github.com)

I'll see if I can make a quick implementation of this; we don't have to go through the lengths of the BMO bug since we don't use service workers, so it can be simpler.

I'll see if I can make a quick implementation of this; we don't have to go through the lengths of the BMO bug since we don't use service workers, so it can be simpler.
wolfbeast commented 6 years ago (Migrated from github.com)

No, refactoring happened here too. Unknown why, but seems deliberate to make things difficult.

No, refactoring happened here too. Unknown why, but seems deliberate to make things difficult.
mattatobin commented 6 years ago (Migrated from github.com)

Can't we have child-src back and alias worker-src to it?

Can't we have child-src back and alias worker-src to it?
wolfbeast commented 6 years ago (Migrated from github.com)

Isn't that what I already said?

Isn't that what I already said?
wolfbeast commented 6 years ago (Migrated from github.com)

If you mean "can't we have child-src back" the way it was already implemented before: no, we can't. our previous platform used a JS-based CSP parser. That was a lot easier to maintain than the C++ variant we have inherited in the platform re-base now with Tycho.

If you mean "can't we have child-src back" the way it was already implemented before: no, we can't. our previous platform used a JS-based CSP parser. That was a lot easier to maintain than the C++ variant we have inherited in the platform re-base now with Tycho.
wolfbeast commented 6 years ago (Migrated from github.com)

I've looked into the reasons why they converted this to C++, and it's been for a project that turned out to be a bust anyway: Firefox OS (because, surprise surprise, their target crap phones were slow as tar doing this in JS).
We should consider reinstating the old CSP parser in JS by rolling back the changes made in https://bugzilla.mozilla.org/show_bug.cgi?id=994782 and disabling the C++ back-end, then using a more maintainable version of the CSP parser in JS to change/add/remove directives as-needed and as they are changed in this spec mess.

I've looked into the reasons why they converted this to C++, and it's been for a project that turned out to be a bust anyway: Firefox OS (because, surprise surprise, their target crap phones were slow as tar doing this in JS). We should consider reinstating the old CSP parser in JS by rolling back the changes made in https://bugzilla.mozilla.org/show_bug.cgi?id=994782 and disabling the C++ back-end, then using a more maintainable version of the CSP parser in JS to change/add/remove directives as-needed and as they are changed in this spec mess.
wolfbeast commented 5 years ago (Migrated from github.com)

We'll have this solved in a UXP-based Pale Moon. Closing.

We'll have this solved in a UXP-based Pale Moon. Closing.
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: MoonchildProductions/Pale-Moon#949
Loading…
There is no content yet.