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

Unified Diff: extensions/browser/api/cast_channel/cast_socket.cc

Issue 694123002: Limit lifetime of self-signed certificate used for TLS on Cast channel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simplify the change. No need to make a new X509Certificate object. Created 6 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/api/cast_channel/cast_socket.cc
diff --git a/extensions/browser/api/cast_channel/cast_socket.cc b/extensions/browser/api/cast_channel/cast_socket.cc
index 83994df6b1c413a28d43401689a4db0c8b973224..fc72453e51dbcf2b730c840f363a28e80721c093 100644
--- a/extensions/browser/api/cast_channel/cast_socket.cc
+++ b/extensions/browser/api/cast_channel/cast_socket.cc
@@ -163,6 +163,15 @@ bool CastSocket::ExtractPeerCert(std::string* cert) {
logger_->LogSocketEvent(channel_id_, proto::SSL_INFO_OBTAINED);
+ // we need to ensure that the peer cert (which is self-signed) doesn't have an
mark a. foltz 2014/11/21 00:14:53 Nit: Start sentence with "Ensure"
+ // excessive life-time (i.e. no more than 2 days).
+ base::Time expiry = ssl_info.cert->valid_expiry();
+ if (expiry.is_null() ||
+ expiry > base::Time::Now() + base::TimeDelta::FromDays(2)) {
mark a. foltz 2014/11/21 00:14:53 Please declare a constant for "2" for the maximum
+ LOG(ERROR) << "Peer cert has excessive lifetime. expiry=" << expiry;
mark a. foltz 2014/11/21 00:14:53 We'll want to log a socket event for an expired ce
Kevin Marshall 2014/11/21 00:41:13 Also log the IP endpoint.
+ return false;
+ }
+
bool result = net::X509Certificate::GetDEREncoded(
ssl_info.cert->os_cert_handle(), cert);
if (result) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698