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

Unified Diff: content/browser/frame_host/form_submission_throttle.h

Issue 2689653003: PlzNavigate: Enforce 'form-action' CSP on the browser-side. (Closed)
Patch Set: Rebase. Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/BUILD.gn ('k') | content/browser/frame_host/form_submission_throttle.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/frame_host/form_submission_throttle.h
diff --git a/content/browser/frame_host/form_submission_throttle.h b/content/browser/frame_host/form_submission_throttle.h
new file mode 100644
index 0000000000000000000000000000000000000000..2144d2a9c0ee53110bf99d8af84c5e280a1980d2
--- /dev/null
+++ b/content/browser/frame_host/form_submission_throttle.h
@@ -0,0 +1,41 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_FRAME_HOST_FORM_SUBMISSION_THROTTLE_H_
+#define CONTENT_BROWSER_FRAME_HOST_FORM_SUBMISSION_THROTTLE_H_
+
+#include <memory>
+#include <string>
+
+#include "base/macros.h"
+#include "content/public/browser/navigation_throttle.h"
+
+namespace content {
+class NavigationHandle;
+
+// A FormSubmissionThrottle is responsible for enforcing the 'form-action' CSP
+// directive, blocking requests which violate them.
+// It is enforcing it only if PlzNavigate is enabled. Blink is still enforcing
+// the 'form-action' directive on the renderer process.
+class CONTENT_EXPORT FormSubmissionThrottle : public NavigationThrottle {
+ public:
+ static std::unique_ptr<NavigationThrottle> MaybeCreateThrottleFor(
+ NavigationHandle* handle);
+
+ ~FormSubmissionThrottle() override;
+
+ NavigationThrottle::ThrottleCheckResult WillStartRequest() override;
+ NavigationThrottle::ThrottleCheckResult WillRedirectRequest() override;
+
+ private:
+ explicit FormSubmissionThrottle(NavigationHandle* handle);
+ NavigationThrottle::ThrottleCheckResult CheckContentSecurityPolicyFormAction(
+ bool is_redirect);
+
+ DISALLOW_COPY_AND_ASSIGN(FormSubmissionThrottle);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_FRAME_HOST_FORM_SUBMISSION_THROTTLE_H_
« no previous file with comments | « content/browser/BUILD.gn ('k') | content/browser/frame_host/form_submission_throttle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698