Add a webstorePrivate API to show a permission prompt for delegated bundle installs
[chromium-blink-merge.git] / chrome / browser / net / certificate_error_reporter_unittest.cc
blob8641e5e471a2d14c22eb85a20472a3bf9151e930
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/net/certificate_error_reporter.h"
7 #include <set>
8 #include <string>
10 #include "base/bind.h"
11 #include "base/bind_helpers.h"
12 #include "base/macros.h"
13 #include "base/message_loop/message_loop.h"
14 #include "base/run_loop.h"
15 #include "base/thread_task_runner_handle.h"
16 #include "chrome/browser/net/encrypted_cert_logger.pb.h"
17 #include "chrome/common/chrome_paths.h"
18 #include "content/public/browser/browser_thread.h"
19 #include "crypto/curve25519.h"
20 #include "net/base/load_flags.h"
21 #include "net/base/network_delegate_impl.h"
22 #include "net/base/upload_bytes_element_reader.h"
23 #include "net/base/upload_data_stream.h"
24 #include "net/base/upload_element_reader.h"
25 #include "net/test/url_request/url_request_failed_job.h"
26 #include "net/test/url_request/url_request_mock_data_job.h"
27 #include "net/url_request/url_request_filter.h"
28 #include "net/url_request/url_request_test_util.h"
29 #include "testing/gtest/include/gtest/gtest.h"
31 using chrome_browser_net::CertificateErrorReporter;
32 using content::BrowserThread;
33 using net::CertStatus;
34 using net::CompletionCallback;
35 using net::NetworkDelegateImpl;
36 using net::TestURLRequestContext;
37 using net::URLRequest;
39 namespace {
41 const char kDummyReport[] = "test.mail.google.com";
42 const char kSecondDummyReport[] = "test2.mail.google.com";
43 const uint32 kServerPublicKeyVersion = 1;
45 void EnableUrlRequestMocks(bool enable) {
46 net::URLRequestFilter::GetInstance()->ClearHandlers();
47 if (!enable)
48 return;
50 net::URLRequestFailedJob::AddUrlHandler();
51 net::URLRequestMockDataJob::AddUrlHandler();
54 // Check that data uploaded in the request matches the test report
55 // data. The sent reports will be erased from |expect_reports|.
56 void CheckUploadData(URLRequest* request,
57 std::set<std::string>* expect_reports,
58 bool encrypted,
59 const uint8* server_private_key) {
60 const net::UploadDataStream* upload = request->get_upload();
61 ASSERT_TRUE(upload);
62 ASSERT_TRUE(upload->GetElementReaders());
63 EXPECT_EQ(1u, upload->GetElementReaders()->size());
65 const net::UploadBytesElementReader* reader =
66 (*upload->GetElementReaders())[0]->AsBytesReader();
67 ASSERT_TRUE(reader);
68 std::string upload_data(reader->bytes(), reader->length());
70 std::string uploaded_report;
71 #if defined(USE_OPENSSL)
72 if (encrypted) {
73 chrome_browser_net::EncryptedCertLoggerRequest encrypted_request;
74 ASSERT_TRUE(encrypted_request.ParseFromString(upload_data));
75 EXPECT_EQ(kServerPublicKeyVersion,
76 encrypted_request.server_public_key_version());
77 EXPECT_EQ(chrome_browser_net::EncryptedCertLoggerRequest::
78 AEAD_ECDH_AES_128_CTR_HMAC_SHA256,
79 encrypted_request.algorithm());
80 ASSERT_TRUE(CertificateErrorReporter::DecryptCertificateErrorReport(
81 server_private_key, encrypted_request, &uploaded_report));
82 } else {
83 uploaded_report = upload_data;
85 #else
86 uploaded_report = upload_data;
87 #endif
89 EXPECT_EQ(1u, expect_reports->count(uploaded_report));
90 expect_reports->erase(uploaded_report);
93 // A network delegate that lets tests check that a certificate error
94 // report was sent. It counts the number of requests and lets tests
95 // register a callback to run when the request is destroyed. It also
96 // checks that the uploaded data is as expected.
97 class TestCertificateErrorReporterNetworkDelegate : public NetworkDelegateImpl {
98 public:
99 TestCertificateErrorReporterNetworkDelegate()
100 : url_request_destroyed_callback_(base::Bind(&base::DoNothing)),
101 all_url_requests_destroyed_callback_(base::Bind(&base::DoNothing)),
102 num_requests_(0),
103 expect_cookies_(false),
104 expect_request_encrypted_(false) {
105 memset(server_private_key_, 1, sizeof(server_private_key_));
106 crypto::curve25519::ScalarBaseMult(server_private_key_, server_public_key_);
109 ~TestCertificateErrorReporterNetworkDelegate() override {}
111 void ExpectReport(const std::string& report) {
112 expect_reports_.insert(report);
115 void set_all_url_requests_destroyed_callback(
116 const base::Closure& all_url_requests_destroyed_callback) {
117 all_url_requests_destroyed_callback_ = all_url_requests_destroyed_callback;
120 void set_url_request_destroyed_callback(
121 const base::Closure& url_request_destroyed_callback) {
122 url_request_destroyed_callback_ = url_request_destroyed_callback;
125 void set_expect_url(const GURL& expect_url) { expect_url_ = expect_url; }
127 int num_requests() const { return num_requests_; }
129 // Sets whether cookies are expected to be sent on requests. If set to
130 // true, then |OnHeadersReceived| will expect a cookie
131 // "cookie_name=cookie_value".
132 void set_expect_cookies(bool expect_cookies) {
133 expect_cookies_ = expect_cookies;
136 void set_expect_request_encrypted(bool expect_request_encrypted) {
137 expect_request_encrypted_ = expect_request_encrypted;
140 // NetworkDelegateImpl implementation
141 int OnBeforeURLRequest(URLRequest* request,
142 const CompletionCallback& callback,
143 GURL* new_url) override {
144 num_requests_++;
145 EXPECT_EQ(expect_url_, request->url());
146 EXPECT_EQ("POST", request->method());
148 if (expect_cookies_) {
149 EXPECT_FALSE(request->load_flags() & net::LOAD_DO_NOT_SEND_COOKIES);
150 EXPECT_FALSE(request->load_flags() & net::LOAD_DO_NOT_SAVE_COOKIES);
151 } else {
152 EXPECT_TRUE(request->load_flags() & net::LOAD_DO_NOT_SEND_COOKIES);
153 EXPECT_TRUE(request->load_flags() & net::LOAD_DO_NOT_SAVE_COOKIES);
156 CheckUploadData(request, &expect_reports_, expect_request_encrypted_,
157 server_private_key_);
158 return net::OK;
161 void OnURLRequestDestroyed(URLRequest* request) override {
162 url_request_destroyed_callback_.Run();
163 if (expect_reports_.empty())
164 all_url_requests_destroyed_callback_.Run();
167 const uint8* server_public_key() { return server_public_key_; }
168 const uint8* server_private_key() { return server_private_key_; }
170 private:
171 base::Closure url_request_destroyed_callback_;
172 base::Closure all_url_requests_destroyed_callback_;
173 int num_requests_;
174 GURL expect_url_;
175 std::set<std::string> expect_reports_;
176 bool expect_cookies_;
177 bool expect_request_encrypted_;
179 uint8 server_public_key_[32];
180 uint8 server_private_key_[32];
182 DISALLOW_COPY_AND_ASSIGN(TestCertificateErrorReporterNetworkDelegate);
185 class CertificateErrorReporterTest : public ::testing::Test {
186 public:
187 CertificateErrorReporterTest() : context_(true) {
188 EnableUrlRequestMocks(true);
189 context_.set_network_delegate(&network_delegate_);
190 context_.Init();
193 ~CertificateErrorReporterTest() override { EnableUrlRequestMocks(false); }
195 TestCertificateErrorReporterNetworkDelegate* network_delegate() {
196 return &network_delegate_;
199 TestURLRequestContext* context() { return &context_; }
201 private:
202 base::MessageLoop message_loop_;
203 TestCertificateErrorReporterNetworkDelegate network_delegate_;
204 TestURLRequestContext context_;
207 void SendReport(CertificateErrorReporter* reporter,
208 TestCertificateErrorReporterNetworkDelegate* network_delegate,
209 const std::string& report,
210 const GURL& url,
211 int request_sequence_number,
212 CertificateErrorReporter::ReportType type) {
213 base::RunLoop run_loop;
214 network_delegate->set_url_request_destroyed_callback(run_loop.QuitClosure());
216 network_delegate->set_expect_url(url);
217 network_delegate->ExpectReport(report);
219 EXPECT_EQ(request_sequence_number, network_delegate->num_requests());
221 reporter->SendReport(type, report);
222 run_loop.Run();
224 EXPECT_EQ(request_sequence_number + 1, network_delegate->num_requests());
227 // Test that CertificateErrorReporter::SendReport creates a URLRequest
228 // for the endpoint and sends the expected data.
229 TEST_F(CertificateErrorReporterTest, PinningViolationSendReportSendsRequest) {
230 GURL url = net::URLRequestMockDataJob::GetMockHttpsUrl("dummy data", 1);
231 CertificateErrorReporter reporter(
232 context(), url, CertificateErrorReporter::DO_NOT_SEND_COOKIES);
233 SendReport(&reporter, network_delegate(), kDummyReport, url, 0,
234 CertificateErrorReporter::REPORT_TYPE_PINNING_VIOLATION);
237 TEST_F(CertificateErrorReporterTest, ExtendedReportingSendReportSendsRequest) {
238 // Data should not be encrypted when sent to an HTTPS URL.
239 GURL https_url = net::URLRequestMockDataJob::GetMockHttpsUrl("dummy data", 1);
240 CertificateErrorReporter https_reporter(
241 context(), https_url, CertificateErrorReporter::DO_NOT_SEND_COOKIES);
242 network_delegate()->set_expect_request_encrypted(false);
243 SendReport(&https_reporter, network_delegate(), kDummyReport, https_url, 0,
244 CertificateErrorReporter::REPORT_TYPE_EXTENDED_REPORTING);
246 // Data should be encrypted when sent to an HTTP URL.
247 if (CertificateErrorReporter::IsHttpUploadUrlSupported()) {
248 GURL http_url = net::URLRequestMockDataJob::GetMockHttpUrl("dummy data", 1);
249 CertificateErrorReporter http_reporter(
250 context(), http_url, CertificateErrorReporter::DO_NOT_SEND_COOKIES,
251 network_delegate()->server_public_key(), kServerPublicKeyVersion);
252 network_delegate()->set_expect_request_encrypted(true);
253 SendReport(&http_reporter, network_delegate(), kDummyReport, http_url, 1,
254 CertificateErrorReporter::REPORT_TYPE_EXTENDED_REPORTING);
258 TEST_F(CertificateErrorReporterTest, SendMultipleReportsSequentially) {
259 GURL url = net::URLRequestMockDataJob::GetMockHttpsUrl("dummy data", 1);
260 CertificateErrorReporter reporter(
261 context(), url, CertificateErrorReporter::DO_NOT_SEND_COOKIES);
262 SendReport(&reporter, network_delegate(), kDummyReport, url, 0,
263 CertificateErrorReporter::REPORT_TYPE_PINNING_VIOLATION);
264 SendReport(&reporter, network_delegate(), kDummyReport, url, 1,
265 CertificateErrorReporter::REPORT_TYPE_PINNING_VIOLATION);
268 TEST_F(CertificateErrorReporterTest, SendMultipleReportsSimultaneously) {
269 base::RunLoop run_loop;
270 network_delegate()->set_all_url_requests_destroyed_callback(
271 run_loop.QuitClosure());
273 GURL url = net::URLRequestMockDataJob::GetMockHttpsUrl("dummy data", 1);
274 network_delegate()->set_expect_url(url);
275 network_delegate()->ExpectReport(kDummyReport);
276 network_delegate()->ExpectReport(kSecondDummyReport);
278 CertificateErrorReporter reporter(
279 context(), url, CertificateErrorReporter::DO_NOT_SEND_COOKIES);
281 EXPECT_EQ(0, network_delegate()->num_requests());
283 reporter.SendReport(CertificateErrorReporter::REPORT_TYPE_PINNING_VIOLATION,
284 kDummyReport);
285 reporter.SendReport(CertificateErrorReporter::REPORT_TYPE_PINNING_VIOLATION,
286 kSecondDummyReport);
288 run_loop.Run();
290 EXPECT_EQ(2, network_delegate()->num_requests());
293 // Test that pending URLRequests get cleaned up when the reporter is
294 // deleted.
295 TEST_F(CertificateErrorReporterTest, PendingRequestGetsDeleted) {
296 base::RunLoop run_loop;
297 network_delegate()->set_url_request_destroyed_callback(
298 run_loop.QuitClosure());
300 GURL url = net::URLRequestFailedJob::GetMockHttpUrlWithFailurePhase(
301 net::URLRequestFailedJob::START, net::ERR_IO_PENDING);
302 network_delegate()->set_expect_url(url);
303 network_delegate()->ExpectReport(kDummyReport);
305 EXPECT_EQ(0, network_delegate()->num_requests());
307 scoped_ptr<CertificateErrorReporter> reporter(new CertificateErrorReporter(
308 context(), url, CertificateErrorReporter::DO_NOT_SEND_COOKIES));
309 reporter->SendReport(CertificateErrorReporter::REPORT_TYPE_PINNING_VIOLATION,
310 kDummyReport);
311 reporter.reset();
313 run_loop.Run();
315 EXPECT_EQ(1, network_delegate()->num_requests());
318 // Test that a request that returns an error gets cleaned up.
319 TEST_F(CertificateErrorReporterTest, ErroredRequestGetsDeleted) {
320 GURL url = net::URLRequestFailedJob::GetMockHttpsUrl(net::ERR_FAILED);
321 CertificateErrorReporter reporter(
322 context(), url, CertificateErrorReporter::DO_NOT_SEND_COOKIES);
323 SendReport(&reporter, network_delegate(), kDummyReport, url, 0,
324 CertificateErrorReporter::REPORT_TYPE_PINNING_VIOLATION);
327 // Test that cookies are sent or not sent according to the error
328 // reporter's cookies preference.
330 TEST_F(CertificateErrorReporterTest, SendCookiesPreference) {
331 GURL url = net::URLRequestMockDataJob::GetMockHttpsUrl("dummy data", 1);
332 CertificateErrorReporter reporter(context(), url,
333 CertificateErrorReporter::SEND_COOKIES);
335 network_delegate()->set_expect_cookies(true);
336 SendReport(&reporter, network_delegate(), kDummyReport, url, 0,
337 CertificateErrorReporter::REPORT_TYPE_PINNING_VIOLATION);
340 TEST_F(CertificateErrorReporterTest, DoNotSendCookiesPreference) {
341 GURL url = net::URLRequestMockDataJob::GetMockHttpsUrl("dummy data", 1);
342 CertificateErrorReporter reporter(
343 context(), url, CertificateErrorReporter::DO_NOT_SEND_COOKIES);
345 network_delegate()->set_expect_cookies(false);
346 SendReport(&reporter, network_delegate(), kDummyReport, url, 0,
347 CertificateErrorReporter::REPORT_TYPE_PINNING_VIOLATION);
350 #if defined(USE_OPENSSL)
351 // This test decrypts a "known gold" report. It's intentionally brittle
352 // in order to catch changes in report encryption that could cause the
353 // server to no longer be able to decrypt reports that it receives from
354 // Chrome.
355 TEST_F(CertificateErrorReporterTest, DecryptExampleReport) {
356 // This data should not be changed without also changing the
357 // corresponding server-side test.
358 const unsigned char kSerializedEncryptedReport[] = {
359 0x0A, 0xFB, 0x0C, 0xD5, 0x44, 0x21, 0x36, 0x4D, 0xFC, 0x29, 0x56, 0xBD,
360 0x47, 0x18, 0xB1, 0x6F, 0x97, 0xF1, 0xF0, 0x3C, 0x31, 0x31, 0x1D, 0xD7,
361 0xAB, 0x81, 0xCC, 0xBC, 0x56, 0x2B, 0xD4, 0x50, 0xF4, 0xF6, 0x28, 0x3A,
362 0x36, 0x8C, 0x4A, 0x67, 0x4E, 0xF2, 0x51, 0xA3, 0x7D, 0x02, 0xA8, 0x4D,
363 0xE9, 0xBE, 0x72, 0x5A, 0x8A, 0x62, 0xE0, 0x61, 0xA4, 0x87, 0x62, 0xBA,
364 0x6A, 0x5C, 0x4B, 0x07, 0x04, 0xE6, 0xCD, 0xE1, 0xD6, 0x12, 0x02, 0xC1,
365 0xF3, 0x5C, 0x7D, 0xFB, 0x61, 0xC3, 0x8D, 0xBE, 0x47, 0x50, 0xC4, 0xAC,
366 0x33, 0xA6, 0x2B, 0x6A, 0x4D, 0x5F, 0x22, 0x4B, 0x21, 0xAB, 0xFD, 0x66,
367 0x9C, 0xEF, 0x81, 0x06, 0xEB, 0xC0, 0x96, 0x87, 0x4E, 0xD6, 0x16, 0x5F,
368 0x0B, 0x2E, 0xF0, 0x3C, 0xA3, 0xBF, 0x75, 0x77, 0x3A, 0x91, 0xD2, 0xF5,
369 0xCC,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, 0x5E, 0xC3, 0x90, 0x3D, 0x7E, 0xD4, 0xEF, 0xCF, 0xD2, 0x38, 0x67,
488 0xBB, 0x1F, 0x58, 0xD4, 0x1B, 0xF2, 0xF0, 0x6A, 0x25, 0x68, 0x82, 0x19,
489 0x78, 0xB2, 0xC1, 0x34, 0x1D, 0xFA, 0xD5, 0x24, 0x1C, 0x81, 0x21, 0x74,
490 0xB1, 0xE8, 0x59, 0xD7, 0xA1, 0xB7, 0x61, 0xF5, 0x4F, 0x41, 0xEC, 0x27,
491 0xE5, 0x30, 0xC2, 0xFB, 0x69, 0xCC, 0x69, 0xF5, 0x0F, 0xF2, 0x0D, 0x2E,
492 0xDE, 0x43, 0xC5, 0xA2, 0xA6, 0x99, 0x1F, 0x00, 0x06, 0xD7, 0x93, 0xA5,
493 0xD7, 0xAD, 0xD0, 0x6A, 0x61, 0x37, 0xF4, 0xAA, 0xB8, 0xA9, 0x3B, 0x7E,
494 0xFC, 0xF7, 0x30, 0xE6, 0xA8, 0x75, 0x65, 0xBA, 0xDD, 0x1D, 0x30, 0x73,
495 0x04, 0x5A, 0x37, 0x64, 0xE3, 0x51, 0xFD, 0x36, 0x4D, 0xF1, 0x8F, 0x7E,
496 0x38, 0x18, 0xA0, 0x43, 0xE3, 0x9F, 0x03, 0x70, 0x53, 0x08, 0xF1, 0xE1,
497 0x13, 0x84, 0x7C, 0x5F, 0x1F, 0xDE, 0x10, 0x01, 0x1A, 0x20, 0xCC, 0x49,
498 0xFB, 0xD4, 0xE1, 0x04, 0x42, 0x0D, 0x2C, 0x41, 0x84, 0xDD, 0xFB, 0xC7,
499 0xA6, 0x2D, 0x00, 0xCC, 0xB5, 0x3B, 0x31, 0x2E, 0xB4, 0x30, 0xA5, 0x08,
500 0x1A, 0x7D, 0x19, 0x81, 0xF0, 0x4D, 0x20, 0x01};
502 chrome_browser_net::EncryptedCertLoggerRequest encrypted_request;
503 std::string decrypted_serialized_report;
504 ASSERT_TRUE(encrypted_request.ParseFromString(
505 std::string(reinterpret_cast<const char*>(kSerializedEncryptedReport),
506 sizeof(kSerializedEncryptedReport))));
507 ASSERT_TRUE(chrome_browser_net::CertificateErrorReporter::
508 DecryptCertificateErrorReport(
509 network_delegate()->server_private_key(),
510 encrypted_request, &decrypted_serialized_report));
512 #endif
514 } // namespace