Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/ssl/ssl_manager.h" | 5 #include "content/browser/ssl/ssl_manager.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "base/supports_user_data.h" | 12 #include "base/supports_user_data.h" |
| 13 #include "content/browser/frame_host/navigation_entry_impl.h" | 13 #include "content/browser/frame_host/navigation_entry_impl.h" |
| 14 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 14 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
| 15 #include "content/browser/loader/resource_request_info_impl.h" | 15 #include "content/browser/loader/resource_request_info_impl.h" |
| 16 #include "content/browser/ssl/ssl_cert_error_handler.h" | 16 #include "content/browser/ssl/ssl_cert_error_handler.h" |
| 17 #include "content/browser/ssl/ssl_policy.h" | 17 #include "content/browser/ssl/ssl_policy.h" |
| 18 #include "content/browser/ssl/ssl_request_info.h" | |
| 19 #include "content/browser/web_contents/web_contents_impl.h" | 18 #include "content/browser/web_contents/web_contents_impl.h" |
| 20 #include "content/common/ssl_status_serialization.h" | 19 #include "content/common/ssl_status_serialization.h" |
| 21 #include "content/public/browser/browser_context.h" | 20 #include "content/public/browser/browser_context.h" |
| 22 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
| 23 #include "content/public/browser/load_from_memory_cache_details.h" | 22 #include "content/public/browser/load_from_memory_cache_details.h" |
| 24 #include "content/public/browser/navigation_details.h" | 23 #include "content/public/browser/navigation_details.h" |
| 25 #include "content/public/browser/resource_request_details.h" | 24 #include "content/public/browser/resource_request_details.h" |
| 26 #include "content/public/common/ssl_status.h" | 25 #include "content/public/common/ssl_status.h" |
| 27 #include "net/url_request/url_request.h" | 26 #include "net/url_request/url_request.h" |
| 28 | 27 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 137 | 136 |
| 138 void SSLManager::DidRunInsecureContent(const GURL& security_origin) { | 137 void SSLManager::DidRunInsecureContent(const GURL& security_origin) { |
| 139 NavigationEntryImpl* navigation_entry = controller_->GetLastCommittedEntry(); | 138 NavigationEntryImpl* navigation_entry = controller_->GetLastCommittedEntry(); |
| 140 policy()->DidRunInsecureContent(navigation_entry, security_origin); | 139 policy()->DidRunInsecureContent(navigation_entry, security_origin); |
| 141 UpdateEntry(navigation_entry); | 140 UpdateEntry(navigation_entry); |
| 142 } | 141 } |
| 143 | 142 |
| 144 void SSLManager::DidLoadFromMemoryCache( | 143 void SSLManager::DidLoadFromMemoryCache( |
| 145 const LoadFromMemoryCacheDetails& details) { | 144 const LoadFromMemoryCacheDetails& details) { |
| 146 // Simulate loading this resource through the usual path. | 145 // Simulate loading this resource through the usual path. |
| 147 // Note that we specify SUB_RESOURCE as the resource type as WebCore only | 146 policy()->OnRequestStarted(details.url, details.cert_id, details.cert_status); |
| 148 // caches sub-resources. | |
| 149 // This resource must have been loaded with no filtering because filtered | |
| 150 // resouces aren't cachable. | |
|
felt
2016/08/04 17:16:09
I'm puzzled by this part. Someone, at some point,
estark
2016/08/04 17:25:04
My guess is that this dates back to, oh, 2009 or s
felt
2016/08/04 17:26:24
AHhh yes, that history makes sense.
| |
| 151 scoped_refptr<SSLRequestInfo> info(new SSLRequestInfo( | |
| 152 details.url, | |
| 153 RESOURCE_TYPE_SUB_RESOURCE, | |
| 154 details.cert_id, | |
| 155 details.cert_status)); | |
| 156 | |
| 157 // Simulate loading this resource through the usual path. | |
| 158 policy()->OnRequestStarted(info.get()); | |
|
felt
2016/08/04 17:16:09
jww: Is it correct that DidLoadFromMemoryCache is
jww
2016/08/04 18:18:10
It seems very possible that this would happen. We
| |
| 159 } | 147 } |
| 160 | 148 |
| 161 void SSLManager::DidStartResourceResponse( | 149 void SSLManager::DidStartResourceResponse( |
| 162 const ResourceRequestDetails& details) { | 150 const ResourceRequestDetails& details) { |
| 163 scoped_refptr<SSLRequestInfo> info(new SSLRequestInfo( | |
| 164 details.url, | |
| 165 details.resource_type, | |
| 166 details.ssl_cert_id, | |
| 167 details.ssl_cert_status)); | |
| 168 | |
| 169 // Notify our policy that we started a resource request. Ideally, the | 151 // Notify our policy that we started a resource request. Ideally, the |
| 170 // policy should have the ability to cancel the request, but we can't do | 152 // policy should have the ability to cancel the request, but we can't do |
| 171 // that yet. | 153 // that yet. |
| 172 policy()->OnRequestStarted(info.get()); | 154 policy()->OnRequestStarted(details.url, details.ssl_cert_id, |
| 155 details.ssl_cert_status); | |
| 173 } | 156 } |
| 174 | 157 |
| 175 void SSLManager::DidReceiveResourceRedirect( | 158 void SSLManager::DidReceiveResourceRedirect( |
| 176 const ResourceRedirectDetails& details) { | 159 const ResourceRedirectDetails& details) { |
| 177 // TODO(abarth): Make sure our redirect behavior is correct. If we ever see a | 160 // TODO(abarth): Make sure our redirect behavior is correct. If we ever see a |
| 178 // non-HTTPS resource in the redirect chain, we want to trigger | 161 // non-HTTPS resource in the redirect chain, we want to trigger |
| 179 // insecure content, even if the redirect chain goes back to | 162 // insecure content, even if the redirect chain goes back to |
| 180 // HTTPS. This is because the network attacker can redirect the | 163 // HTTPS. This is because the network attacker can redirect the |
| 181 // HTTP request to https://attacker.com/payload.js. | 164 // HTTP request to https://attacker.com/payload.js. |
| 182 } | 165 } |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 195 NotifyDidChangeVisibleSSLState(); | 178 NotifyDidChangeVisibleSSLState(); |
| 196 } | 179 } |
| 197 | 180 |
| 198 void SSLManager::NotifyDidChangeVisibleSSLState() { | 181 void SSLManager::NotifyDidChangeVisibleSSLState() { |
| 199 WebContentsImpl* contents = | 182 WebContentsImpl* contents = |
| 200 static_cast<WebContentsImpl*>(controller_->delegate()->GetWebContents()); | 183 static_cast<WebContentsImpl*>(controller_->delegate()->GetWebContents()); |
| 201 contents->DidChangeVisibleSSLState(); | 184 contents->DidChangeVisibleSSLState(); |
| 202 } | 185 } |
| 203 | 186 |
| 204 } // namespace content | 187 } // namespace content |
| OLD | NEW |