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

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: Created 6 years, 2 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 | « 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..3f654e8c70da41b1d1e163d3efd2ef497ba8daba 100644
--- a/extensions/browser/api/cast_channel/cast_socket.cc
+++ b/extensions/browser/api/cast_channel/cast_socket.cc
@@ -163,6 +163,26 @@ bool CastSocket::ExtractPeerCert(std::string* cert) {
logger_->LogSocketEvent(channel_id_, proto::SSL_INFO_OBTAINED);
+ // we need to check that the peer cert (which is self-signed) doesn't have an
mark a. foltz 2014/11/01 20:17:34 Please write a function in either cast_auth_util.c
dougsteed 2014/11/03 21:06:11 I set out to do this as you suggested, but it seem
+ // excessive life-time (i.e. no more than 48 hrs).
+ net::X509Certificate::OSCertHandles no_intermediates;
+ scoped_refptr<net::X509Certificate> peer_cert =
+ net::X509Certificate::CreateFromHandle(ssl_info.cert->os_cert_handle(),
+ no_intermediates);
+
+ base::Time expiry = peer_cert->valid_expiry();
+ if (expiry.is_null()) {
+ return false;
+ }
+
+ base::Time should_have_expired_by =
+ base::Time::Now() + base::TimeDelta::FromDays(2);
mark a. foltz 2014/11/01 20:17:34 This is not really a security feature as the syste
dougsteed 2014/11/03 21:06:11 Yes, we know this is not a strong security check,
+
+ if (expiry > should_have_expired_by) {
+ LOG(ERROR) << "Peer cert has excessive lifetime. notAfter=" << expiry;
+ 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