Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: lib/csp.js

Issue 29377728: Issue 4866 - Add the child-src CSP directive back again for now (Closed)
Left Patch Set: Created March 1, 2017, 10:32 a.m.
Right Patch Set: Keep frame-src too, just in case Created March 1, 2017, 2:38 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 16 matching lines...) Expand all
27 let match = defaultMatcher.matchesAny("", RegExpFilter.typeMap.WEBSOCKET, 27 let match = defaultMatcher.matchesAny("", RegExpFilter.typeMap.WEBSOCKET,
28 hostname, false, null, true); 28 hostname, false, null, true);
29 if (match instanceof BlockingFilter) 29 if (match instanceof BlockingFilter)
30 { 30 {
31 details.responseHeaders.push({ 31 details.responseHeaders.push({
32 name: "Content-Security-Policy", 32 name: "Content-Security-Policy",
33 // We're blocking WebSockets here by adding a connect-src restriction 33 // We're blocking WebSockets here by adding a connect-src restriction
34 // since the Chrome extension API does not allow us to intercept them. 34 // since the Chrome extension API does not allow us to intercept them.
35 // https://bugs.chromium.org/p/chromium/issues/detail?id=129353 35 // https://bugs.chromium.org/p/chromium/issues/detail?id=129353
36 // 36 //
37 // We also need the child-src and object-src restrictions since CSPs are 37 // We also need the frame-src and object-src restrictions since CSPs are
38 // not inherited from the parent for documents with data: and blob: URLs. 38 // not inherited from the parent for documents with data: and blob: URLs.
39 // https://bugs.chromium.org/p/chromium/issues/detail?id=513860 39 // https://bugs.chromium.org/p/chromium/issues/detail?id=513860
40 // 40 //
41 // We must use the deprecated child-src directive instead of the 41 // We must use the deprecated child-src directive instead of worker-src
42 // combination of frame-src and worker-src directives since worker-src 42 // since that's not supported yet (as of Chrome 56.)
43 // is not yet supported (as of Chrome 56.)
44 // 43 //
45 // "http:" also includes "https:" implictly. 44 // "http:" also includes "https:" implictly.
46 // https://www.chromestatus.com/feature/6653486812889088 45 // https://www.chromestatus.com/feature/6653486812889088
47 value: "connect-src http:; child-src http:; object-src http:" 46 value: "connect-src http:; child-src http:; frame-src http:; object-src ht tp:"
Wladimir Palant 2017/03/01 13:17:58 1.12.4 was using both frame-src and child-src. For
kzar 2017/03/01 14:41:18 Done.
48 }); 47 });
49 return {responseHeaders: details.responseHeaders}; 48 return {responseHeaders: details.responseHeaders};
50 } 49 }
51 }, { 50 }, {
52 urls: ["http://*/*", "https://*/*"], 51 urls: ["http://*/*", "https://*/*"],
53 // We must also intercept script requests since otherwise Web Workers can 52 // We must also intercept script requests since otherwise Web Workers can
54 // be abused to execute scripts for which our Content Security Policy 53 // be abused to execute scripts for which our Content Security Policy
55 // won't be injected. 54 // won't be injected.
56 // https://github.com/gorhill/uBO-Extra/issues/19 55 // https://github.com/gorhill/uBO-Extra/issues/19
57 types: ["main_frame", "sub_frame", "script"] 56 types: ["main_frame", "sub_frame", "script"]
58 }, ["blocking", "responseHeaders"]); 57 }, ["blocking", "responseHeaders"]);
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld