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

Side by Side Diff: content/browser/frame_host/frame_tree_node.h

Issue 2655463006: PlzNavigate: Enforce 'frame-src' CSP on the browser. (Closed)
Patch Set: Fix tests. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ 5 #ifndef CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_
6 #define CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ 6 #define CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "content/browser/frame_host/frame_tree_node_blame_context.h" 16 #include "content/browser/frame_host/frame_tree_node_blame_context.h"
17 #include "content/browser/frame_host/render_frame_host_impl.h" 17 #include "content/browser/frame_host/render_frame_host_impl.h"
18 #include "content/browser/frame_host/render_frame_host_manager.h" 18 #include "content/browser/frame_host/render_frame_host_manager.h"
19 #include "content/common/content_export.h" 19 #include "content/common/content_export.h"
20 #include "content/common/content_security_policy/csp_policy.h" 20 #include "content/common/content_security_policy/csp_context.h"
21 #include "content/common/frame_owner_properties.h" 21 #include "content/common/frame_owner_properties.h"
22 #include "content/common/frame_replication_state.h" 22 #include "content/common/frame_replication_state.h"
23 #include "third_party/WebKit/public/platform/WebInsecureRequestPolicy.h" 23 #include "third_party/WebKit/public/platform/WebInsecureRequestPolicy.h"
24 #include "url/gurl.h" 24 #include "url/gurl.h"
25 #include "url/origin.h" 25 #include "url/origin.h"
26 26
27 namespace content { 27 namespace content {
28 28
29 class FrameTree; 29 class FrameTree;
30 class NavigationRequest; 30 class NavigationRequest;
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 // Add CSP header to replication state, notify proxies about the update and 171 // Add CSP header to replication state, notify proxies about the update and
172 // enforce it on the browser. 172 // enforce it on the browser.
173 void AddContentSecurityPolicy(const ContentSecurityPolicyHeader& header, 173 void AddContentSecurityPolicy(const ContentSecurityPolicyHeader& header,
174 const std::vector<CSPPolicy>& policies); 174 const std::vector<CSPPolicy>& policies);
175 175
176 // Discards previous CSP headers and notifies proxies about the update. 176 // Discards previous CSP headers and notifies proxies about the update.
177 // Typically invoked after committing navigation to a new document (since the 177 // Typically invoked after committing navigation to a new document (since the
178 // new document comes with a fresh set of CSP http headers). 178 // new document comes with a fresh set of CSP http headers).
179 void ResetContentSecurityPolicy(); 179 void ResetContentSecurityPolicy();
180 180
181 const std::vector<CSPPolicy>& ContentSecurityPolicies() const {
nasko 2017/02/11 00:01:23 This should be hacker_case(), as it is a simple ac
arthursonzogni 2017/02/13 16:33:20 Okay, I didn't know about this coding style rule.
182 return csp_policies_;
183 }
184
185 // Return the Content-Security-Policy context associated to this frame.
186 // Never null.
187 CSPContext* ContentSecurityPolicyContext() { return csp_context_.get(); }
nasko 2017/02/11 00:01:23 Same here, hacker_case().
arthursonzogni 2017/02/13 16:33:20 Done.
188
181 // Sets the current insecure request policy, and notifies proxies about the 189 // Sets the current insecure request policy, and notifies proxies about the
182 // update. 190 // update.
183 void SetInsecureRequestPolicy(blink::WebInsecureRequestPolicy policy); 191 void SetInsecureRequestPolicy(blink::WebInsecureRequestPolicy policy);
184 192
185 // Returns the currently active sandbox flags for this frame. This includes 193 // Returns the currently active sandbox flags for this frame. This includes
186 // flags inherited from parent frames and the currently active flags from the 194 // flags inherited from parent frames and the currently active flags from the
187 // <iframe> element hosting this frame. This does not include flags that 195 // <iframe> element hosting this frame. This does not include flags that
188 // have been updated in an <iframe> element but have not taken effect yet; 196 // have been updated in an <iframe> element but have not taken effect yet;
189 // use pending_sandbox_flags() for those. 197 // use pending_sandbox_flags() for those.
190 blink::WebSandboxFlags effective_sandbox_flags() const { 198 blink::WebSandboxFlags effective_sandbox_flags() const {
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 base::TimeTicks last_focus_time_; 407 base::TimeTicks last_focus_time_;
400 408
401 // A helper for tracing the snapshots of this FrameTreeNode and attributing 409 // A helper for tracing the snapshots of this FrameTreeNode and attributing
402 // browser process activities to this node (when possible). It is unrelated 410 // browser process activities to this node (when possible). It is unrelated
403 // to the core logic of FrameTreeNode. 411 // to the core logic of FrameTreeNode.
404 FrameTreeNodeBlameContext blame_context_; 412 FrameTreeNodeBlameContext blame_context_;
405 413
406 // A set of Content-Security-Policies to enforce on the browser-side. 414 // A set of Content-Security-Policies to enforce on the browser-side.
407 std::vector<CSPPolicy> csp_policies_; 415 std::vector<CSPPolicy> csp_policies_;
408 416
417 // Used to check if a frame is allowed to navigate to an URL according to a
418 // set of content-security-policy.
419 std::unique_ptr<CSPContext> csp_context_;
alexmos 2017/02/10 22:59:53 I'm wondering whether it'd be better to associate
clamy 2017/02/13 13:23:28 Can the frame navigate while the RFH is in pending
alexmos 2017/02/14 05:44:28 Yes, I wasn't sure how much was disallowed in unlo
nasko 2017/02/15 21:28:44 I also think that the CSP is better off associated
420
409 DISALLOW_COPY_AND_ASSIGN(FrameTreeNode); 421 DISALLOW_COPY_AND_ASSIGN(FrameTreeNode);
410 }; 422 };
411 423
412 } // namespace content 424 } // namespace content
413 425
414 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ 426 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698