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

Unified Diff: net/http/http_proxy_client_socket.cc

Issue 769043003: Sanitize headers in Proxy Authentication Required responses (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix net_unittests Created 6 years 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: net/http/http_proxy_client_socket.cc
diff --git a/net/http/http_proxy_client_socket.cc b/net/http/http_proxy_client_socket.cc
index 515301cf08c1f1b5c9ebb5451c913d434161d993..a7fd7fc8295ae985321c52284311a672c75f4b71 100644
--- a/net/http/http_proxy_client_socket.cc
+++ b/net/http/http_proxy_client_socket.cc
@@ -483,25 +483,31 @@ int HttpProxyClientSocket::DoReadHeadersComplete(int result) {
// sanitize the response. This still allows a rogue HTTPS proxy to
// redirect an HTTPS site load to a similar-looking site, but no longer
// allows it to impersonate the site the user requested.
- if (is_https_proxy_ && SanitizeProxyRedirect(&response_, request_.url)) {
+ if (!is_https_proxy_ || !SanitizeProxyRedirect(&response_)) {
+ // We're not using an HTTPS proxy, or we couldn't sanitize the redirect.
Ryan Sleevi 2014/12/08 22:04:39 nit: "Pronouns in Comments considered harmful" - h
Deprecated (see juliatuttle) 2014/12/09 15:31:15 Done.
+ LogBlockedTunnelResponse();
+ return ERR_TUNNEL_CONNECTION_FAILED;
+ }
+
+ {
bool is_connection_reused = http_stream_parser_->IsConnectionReused();
redirect_has_load_timing_info_ =
transport_->GetLoadTimingInfo(
is_connection_reused, &redirect_load_timing_info_);
- transport_.reset();
- http_stream_parser_.reset();
- return ERR_HTTPS_PROXY_TUNNEL_RESPONSE;
}
-
- // We're not using an HTTPS proxy, or we couldn't sanitize the redirect.
- LogBlockedTunnelResponse();
- return ERR_TUNNEL_CONNECTION_FAILED;
+ transport_.reset();
+ http_stream_parser_.reset();
+ return ERR_HTTPS_PROXY_TUNNEL_RESPONSE;
Ryan Hamilton 2014/12/08 22:51:59 I think you've tried to make use of an early-retur
Deprecated (see juliatuttle) 2014/12/09 15:31:15 What's wrong with the {}s? They're to prevent "jum
Ryan Hamilton 2014/12/10 22:09:21 They look ugly :>
Ryan Hamilton 2014/12/19 21:26:58 ping.
Deprecated (see juliatuttle) 2014/12/19 21:50:46 Done.
case 407: // Proxy Authentication Required
// We need this status code to allow proxy authentication. Our
// authentication code is smart enough to avoid being tricked by an
// active network attacker.
// The next state is intentionally not set as it should be STATE_NONE;
+ if (!SanitizeProxyAuth(&response_)) {
+ LogBlockedTunnelResponse();
+ return ERR_TUNNEL_CONNECTION_FAILED;
+ }
return HandleProxyAuthChallenge(auth_.get(), &response_, net_log_);
default:

Powered by Google App Engine
This is Rietveld 408576698