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

Side by Side Diff: chrome/browser/ssl/chrome_fraudulent_certificate_reporter.cc

Issue 1267383002: Allow preloaded pins to contain report URIs; remove special-case reporting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase fixup Created 5 years, 4 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
(Empty)
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.
4
5 #include "chrome/browser/ssl/chrome_fraudulent_certificate_reporter.h"
6
7 #include "base/profiler/scoped_tracker.h"
8 #include "chrome/browser/net/certificate_error_reporter.h"
9 #include "chrome/browser/ssl/certificate_error_report.h"
10 #include "net/ssl/ssl_info.h"
11 #include "net/url_request/certificate_report_sender.h"
12 #include "net/url_request/url_request_context.h"
13 #include "url/gurl.h"
14
15 namespace {
16
17 // TODO(palmer): Switch to HTTPS when the error handling delegate is more
18 // sophisticated. Ultimately we plan to attempt the report on many transports.
19 const char kFraudulentCertificateUploadEndpoint[] =
20 "http://clients3.google.com/log_cert_error";
21
22 } // namespace
23
24 ChromeFraudulentCertificateReporter::ChromeFraudulentCertificateReporter(
25 net::URLRequestContext* request_context)
26 : certificate_reporter_(new chrome_browser_net::CertificateErrorReporter(
27 request_context,
28 GURL(kFraudulentCertificateUploadEndpoint),
29 net::CertificateReportSender::DO_NOT_SEND_COOKIES)) {}
30
31 ChromeFraudulentCertificateReporter::ChromeFraudulentCertificateReporter(
32 scoped_ptr<chrome_browser_net::CertificateErrorReporter>
33 certificate_reporter)
34 : certificate_reporter_(certificate_reporter.Pass()) {
35 }
36
37 ChromeFraudulentCertificateReporter::~ChromeFraudulentCertificateReporter() {
38 }
39
40 void ChromeFraudulentCertificateReporter::SendReport(
41 const std::string& hostname,
42 const net::SSLInfo& ssl_info) {
43 // Do silent/automatic reporting ONLY for Google properties. For other
44 // domains (when that is supported), Chrome will ask for user permission.
45 if (!net::TransportSecurityState::IsGooglePinnedProperty(hostname))
46 return;
47
48 CertificateErrorReport report(hostname, ssl_info);
49 std::string serialized_report;
50 if (!report.Serialize(&serialized_report)) {
51 LOG(ERROR) << "Failed to serialize pinning violation report.";
52 return;
53 }
54
55 certificate_reporter_->SendPinningViolationReport(serialized_report);
56 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698