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

Unified Diff: chrome/browser/renderer_host/safe_browsing_resource_throttle.cc

Issue 2005273002: Move MimeTypeResourceHandler before ThrottlingResourceHandler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 4 years, 3 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
Index: chrome/browser/renderer_host/safe_browsing_resource_throttle.cc
diff --git a/chrome/browser/renderer_host/safe_browsing_resource_throttle.cc b/chrome/browser/renderer_host/safe_browsing_resource_throttle.cc
index 548acd59ade44f89e187445793909f22894de5ce..88e689bb1cb09cd7fdac1fec9b573136571697fc 100644
--- a/chrome/browser/renderer_host/safe_browsing_resource_throttle.cc
+++ b/chrome/browser/renderer_host/safe_browsing_resource_throttle.cc
@@ -169,6 +169,24 @@ void SafeBrowsingResourceThrottle::WillProcessResponse(bool* defer) {
}
}
+bool SafeBrowsingResourceThrottle::MustProcessResponseBeforeReadingBody() {
+ // On Android, SafeBrowsing may only decide to cancel the request when the
+ // response has been received. Therefore, not part of it should be cached
mmenke 2016/09/02 19:22:05 nit: not -> no
clamy 2016/09/06 11:50:48 Done.
+ // until this ResourceThrottle has been able to check the response. This
+ // prevents the following scenario:
+ // 1) A request is made for foo.com which has been hacked.
+ // 2) The request is only canceled at WillProcessResponse stage, but part of
+ // it has been cached.
+ // 3) foo.com is no longer hacked and removed from the SafeBrowsing list.
+ // 4) The user requests foo.com, which is not on the SafeBrowsing list. This
+ // is deemed safe. However, the resource is actually served from cache,
+ // using the version that was previously stored.
+ // 5) This results in the user accessing an unsafe resource without being
+ // notified that it's dangerous.
+ // TODO(clamy): Add a browser test that checks this specific scenario.
+ return true;
+}
+
void SafeBrowsingResourceThrottle::WillRedirectRequest(
const net::RedirectInfo& redirect_info,
bool* defer) {

Powered by Google App Engine
This is Rietveld 408576698