Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(734)

Issue 2764993002: CSP: group policies in didAddContentSecurityPolicy. (Closed)

Created:
3 years, 9 months ago by arthursonzogni
Modified:
3 years, 8 months ago
Reviewers:
clamy, Mike West, alexmos
CC:
blink-reviews, blink-reviews-api_chromium.org, blink-reviews-frames_chromium.org, chromium-reviews, creis+watch_chromium.org, darin-cc_chromium.org, dglazkov+blink, jam, kinuko+watch, mlamouri+watch-content_chromium.org, nasko+codewatch_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

CSP: group policies in didAddContentSecurityPolicy. This CL makes chrome sends one IPC in ContentSecurityPolicy::reportAccumulatedHeaders instead of one IPC per CSP headers. In addition, in didAddContentSecurityPolicy, the CSP header is no more sent since it is already included in the parsed policy. BUG=none CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation Review-Url: https://codereview.chromium.org/2764993002 Cr-Commit-Position: refs/heads/master@{#460060} Committed: https://chromium.googlesource.com/chromium/src/+/662aa65677aabd2ee107e76a6928574cd167bc75

Patch Set 1 : CSP send policies in didAddContentSecurityPolicy one by one. #

Total comments: 4

Patch Set 2 : Group the IPC instead of splitting them. (browser -> renderer) #

Total comments: 1

Patch Set 3 : Group the IPC (renderer -> browser) #

Patch Set 4 : Rebase #

Patch Set 5 : Nit. #

Total comments: 11

Patch Set 6 : Rebase. #

Patch Set 7 : Addressed comments @alexmos #

Patch Set 8 : Rebase. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+143 lines, -150 lines) Patch
M content/browser/frame_host/frame_tree_node.h View 1 2 3 4 5 6 7 1 chunk +3 lines, -3 lines 0 comments Download
M content/browser/frame_host/frame_tree_node.cc View 1 2 3 4 5 6 7 1 chunk +6 lines, -4 lines 0 comments Download
M content/browser/frame_host/render_frame_host_impl.h View 1 2 3 2 chunks +2 lines, -7 lines 0 comments Download
M content/browser/frame_host/render_frame_host_impl.cc View 1 2 3 4 5 6 7 2 chunks +8 lines, -6 lines 0 comments Download
M content/browser/frame_host/render_frame_host_manager.h View 1 2 1 chunk +3 lines, -2 lines 0 comments Download
M content/browser/frame_host/render_frame_host_manager.cc View 1 2 3 4 5 6 7 1 chunk +4 lines, -4 lines 0 comments Download
M content/common/BUILD.gn View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download
M content/common/content_security_policy/content_security_policy.h View 1 1 chunk +3 lines, -7 lines 0 comments Download
M content/common/content_security_policy/content_security_policy.cc View 1 4 chunks +11 lines, -13 lines 0 comments Download
M content/common/content_security_policy/content_security_policy_unittest.cc View 1 5 chunks +16 lines, -17 lines 0 comments Download
M content/common/content_security_policy/csp_context_unittest.cc View 1 1 chunk +4 lines, -4 lines 0 comments Download
M content/common/content_security_policy_header.h View 1 2 chunks +8 lines, -1 line 0 comments Download
A content/common/content_security_policy_header.cc View 1 1 chunk +20 lines, -0 lines 0 comments Download
M content/common/frame_messages.h View 1 2 3 4 5 6 7 3 chunks +5 lines, -8 lines 0 comments Download
M content/renderer/content_security_policy_util.cc View 1 2 3 4 5 6 7 1 chunk +4 lines, -5 lines 0 comments Download
M content/renderer/render_frame_impl.h View 1 2 3 4 5 6 7 1 chunk +2 lines, -5 lines 0 comments Download
M content/renderer/render_frame_impl.cc View 1 2 3 4 5 6 7 1 chunk +4 lines, -12 lines 0 comments Download
M content/renderer/render_frame_proxy.h View 1 2 3 1 chunk +2 lines, -1 line 0 comments Download
M content/renderer/render_frame_proxy.cc View 1 2 3 3 chunks +10 lines, -9 lines 0 comments Download
M third_party/WebKit/Source/core/frame/LocalFrameClient.h View 1 2 3 4 5 6 7 1 chunk +6 lines, -8 lines 0 comments Download
M third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp View 1 2 3 4 5 6 7 2 chunks +13 lines, -14 lines 0 comments Download
M third_party/WebKit/Source/web/LocalFrameClientImpl.h View 1 2 3 4 5 6 7 1 chunk +2 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/web/LocalFrameClientImpl.cpp View 1 2 3 4 5 6 7 1 chunk +4 lines, -10 lines 0 comments Download
M third_party/WebKit/public/web/WebFrameClient.h View 1 2 3 4 5 6 7 1 chunk +2 lines, -5 lines 0 comments Download

Messages

Total messages: 57 (43 generated)
arthursonzogni
Hi Mike and Camille, Please take a look. Thanks!
3 years, 9 months ago (2017-03-22 09:18:28 UTC) #9
Mike West
https://codereview.chromium.org/2764993002/diff/20001/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp File third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp (right): https://codereview.chromium.org/2764993002/diff/20001/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp#newcode330 third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp:330: policy->exposeForNavigationalChecks()); It seems like doing the opposite might be ...
3 years, 9 months ago (2017-03-22 09:45:53 UTC) #11
arthursonzogni
Thanks! In the next patch, I will merge all the IPCs into one. https://codereview.chromium.org/2764993002/diff/20001/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp File ...
3 years, 9 months ago (2017-03-22 10:27:09 UTC) #12
Mike West
I'd like to see us reduce the number of IPCs. Will landing this CL get ...
3 years, 9 months ago (2017-03-22 11:58:05 UTC) #13
arthursonzogni
On 2017/03/22 11:58:05, Mike West wrote: > I'd like to see us reduce the number ...
3 years, 9 months ago (2017-03-22 15:27:15 UTC) #20
Mike West
On 2017/03/22 at 15:27:15, arthursonzogni wrote: > On 2017/03/22 11:58:05, Mike West wrote: > > ...
3 years, 9 months ago (2017-03-23 08:43:07 UTC) #23
arthursonzogni
> > If we really want to reduce the number of IPC sent, we should ...
3 years, 9 months ago (2017-03-23 09:00:40 UTC) #24
arthursonzogni
Hi Alex, Please take a look. Thanks! Can you check the content/* part? It is ...
3 years, 9 months ago (2017-03-24 13:33:37 UTC) #39
alexmos
https://codereview.chromium.org/2764993002/diff/140001/content/browser/frame_host/render_frame_host_impl.cc File content/browser/frame_host/render_frame_host_impl.cc (right): https://codereview.chromium.org/2764993002/diff/140001/content/browser/frame_host/render_frame_host_impl.cc#newcode1935 content/browser/frame_host/render_frame_host_impl.cc:1935: headers.push_back(policy.header); Sanity check: your old comment on RFHI::OnDidAddContentSecurityPolicy mentioned ...
3 years, 9 months ago (2017-03-25 01:46:27 UTC) #40
arthursonzogni
Thanks! Some answers below: https://codereview.chromium.org/2764993002/diff/140001/content/browser/frame_host/render_frame_host_impl.cc File content/browser/frame_host/render_frame_host_impl.cc (right): https://codereview.chromium.org/2764993002/diff/140001/content/browser/frame_host/render_frame_host_impl.cc#newcode1935 content/browser/frame_host/render_frame_host_impl.cc:1935: headers.push_back(policy.header); On 2017/03/25 01:46:27, alexmos ...
3 years, 9 months ago (2017-03-27 12:03:52 UTC) #45
alexmos
LGTM, thanks! https://codereview.chromium.org/2764993002/diff/140001/content/browser/frame_host/render_frame_host_impl.cc File content/browser/frame_host/render_frame_host_impl.cc (right): https://codereview.chromium.org/2764993002/diff/140001/content/browser/frame_host/render_frame_host_impl.cc#newcode1935 content/browser/frame_host/render_frame_host_impl.cc:1935: headers.push_back(policy.header); On 2017/03/27 12:03:52, arthursonzogni wrote: > ...
3 years, 9 months ago (2017-03-27 18:27:22 UTC) #46
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2764993002/200001
3 years, 8 months ago (2017-03-28 10:57:44 UTC) #53
commit-bot: I haz the power
Committed patchset #8 (id:200001) as https://chromium.googlesource.com/chromium/src/+/662aa65677aabd2ee107e76a6928574cd167bc75
3 years, 8 months ago (2017-03-28 11:11:21 UTC) #56
arthursonzogni
3 years, 8 months ago (2017-03-28 11:12:21 UTC) #57
Message was sent while issue was closed.
Thanks for the reviews!

https://codereview.chromium.org/2764993002/diff/140001/content/renderer/rende...
File content/renderer/render_frame_proxy.cc (right):

https://codereview.chromium.org/2764993002/diff/140001/content/renderer/rende...
content/renderer/render_frame_proxy.cc:354: const
std::vector<ContentSecurityPolicyHeader>& headers) {
On 2017/03/27 18:27:22, alexmos wrote:
> On 2017/03/27 12:03:52, arthursonzogni wrote:
> > On 2017/03/25 01:46:27, alexmos wrote:
> > > Is anything stopping us now from sending over the real policies to the
> > proxies,
> > > instead of reparsing policies from the headers?  That would be a nice
> cleanup
> > to
> > > do in a followup. 
> > 
> > We need this when PlzNavigate is disabled and OOPIF enabled. The
browser-side
> > enforcement of the CSP works only with PlzNavigate.
> > 
> > I think that as soon as PlzNavigate is shipped, we will be able to remove
the
> > replication of the CSP among the remote frame. That would be a nice cleanup.
> > Alternatively, it would be possible to enable the browser-side enforcement
of
> > the CSP when PlzNavigate is disabled. FYI, I am currently blocked on making
> this
> > patch:
> > https://codereview.chromium.org/2698623006/
> > working without PlzNavigate.
> > 
> > 
> 
> I agree we still need this for OOPIF without PlzNavigate, I was just thinking
> whether FrameMsg_AddContentSecurityPolicies could pass not
> ContentSecurityPolicyHeaders, but rather a vector of
> content::ContentSecurityPolicy.  With the former, we end up reparsing the same
> policy multiple times in each OOPIF renderer, and with the latter we'd avoid
> that.  Back when we did the CSP header replication, we didn't have
> content::ContentSecurityPolicy, but now we do.  But that'll probably involve
> modifying FrameReplicationState as well, and you're probably right that it's
> just easier to wait for PlzNavigate to ship and remove this altogether.

Yes, I think it would be possible to convert back the
content::ContentSecurityPolicy to the blink::CSPDirectiveList if we wanted to,
such that it isn't need to parse the header again.
I don't know. Let's say we will do nothing for the moment and wait for the CSP
replication not to be needed anymore and removed.

Powered by Google App Engine
This is Rietveld 408576698