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

Unified Diff: components/data_reduction_proxy/browser/data_reduction_proxy_tamper_detect.h

Issue 338483002: Chrome Participated Tamper Detect (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address Bolian's comments Created 6 years, 6 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
Index: components/data_reduction_proxy/browser/data_reduction_proxy_tamper_detect.h
diff --git a/components/data_reduction_proxy/browser/data_reduction_proxy_tamper_detect.h b/components/data_reduction_proxy/browser/data_reduction_proxy_tamper_detect.h
new file mode 100644
index 0000000000000000000000000000000000000000..0034322f9da6f0df705969e22b1d7e07b031d266
--- /dev/null
+++ b/components/data_reduction_proxy/browser/data_reduction_proxy_tamper_detect.h
@@ -0,0 +1,63 @@
+// Copyright 2014 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 COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_TAMPER_DETECT_H_
+#define COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_TAMPER_DETECT_H_
+
+#include "net/http/http_response_headers.h"
+
+namespace data_reduction_proxy {
+
+// Exported for unittest
+// Check whether values of data reduction proxy's header Chrome-Proxy
+// have been tampered or not.
+// It takes two parameters as input,
+// 1. fingerprint received from data reduction proxy
+// 2. the response, a pointer to HttpResponseHeaders
+// Returns true if it has been tampered.
+bool CheckHeaderChromeProxy(const std::string,
bolian 2014/06/27 00:49:02 const std::string& here and others.
xingx 2014/06/27 16:34:37 Done.
+ const net::HttpResponseHeaders*);
+
+// Exported for unittest.
+// Check whether there are proxies/middleboxes between Chrome
+// and data reduction proxy. Concretely, it checks whether there are other
+// proxies/middleboxes' name after data reduction proxy's name in Via header.
+// It takes two parameters as input,
+// 1. fingerprint received from data reduction proxy
+// 2. the response, a pointer to HttpResponseHeaders
+// Returns true if there are.
+bool CheckHeaderVia(const std::string, const net::HttpResponseHeaders*);
+
+// Exported for unittest.
+// Check whether the values of a predefined list of headers have been tampered.
+// It takes two parameters as input,
+// 1. fingerprint received from data reduction proxy
+// 2. the response, a pointer to HttpResponseHeaders
+// Returns true if tamper detected for these headers.
+bool CheckHeaderOtherHeaders(const std::string,
+ const net::HttpResponseHeaders*);
+
+// Exported for unittest.
+// Check whether the Content-Length value is different from what
+// data reduction proxy sees. This is an indicator that the response body
+// have been modified.
+// It takes two parameters as input,
+// 1. fingerprint received from data reduction proxy
+// 2. the response, a pointer to HttpResponseHeaders
+// Returns true if different Content-Length value is observed.
+bool CheckHeaderContentLength(const std::string,
+ const net::HttpResponseHeaders*);
+
+// The main function for detecting tamper.
+// It takes two parameters as input,
+// 1. a pointer to HttpResponseHeaders,
+// 2. a boolean variable indicates whether the connection
+// between Chrome and data reduction proxy is on HTTPS or not.
+// For such response, the function checks whether there is a tamper detect
+// request from data reduction proxy, if so, it checks whether there are
+// tampers and report the results to UMA.
+void CheckResponseFingerprint(const net::HttpResponseHeaders*, const bool);
+
+} // namespace data_reduction_proxy
+#endif // COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_TAMPER_DETECT_H_

Powered by Google App Engine
This is Rietveld 408576698