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

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 sleevi's nit Created 5 years, 11 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 | « net/http/http_network_transaction_unittest.cc ('k') | net/http/proxy_client_socket.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..97945d919341e45be655f4e0ebc9f5a5ff89fce0 100644
--- a/net/http/http_proxy_client_socket.cc
+++ b/net/http/http_proxy_client_socket.cc
@@ -483,25 +483,27 @@ 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)) {
- 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;
+ if (!is_https_proxy_ || !SanitizeProxyRedirect(&response_)) {
+ LogBlockedTunnelResponse();
+ return ERR_TUNNEL_CONNECTION_FAILED;
}
- // We're not using an HTTPS proxy, or we couldn't sanitize the redirect.
- LogBlockedTunnelResponse();
- return ERR_TUNNEL_CONNECTION_FAILED;
+ redirect_has_load_timing_info_ = transport_->GetLoadTimingInfo(
+ http_stream_parser_->IsConnectionReused(),
+ &redirect_load_timing_info_);
+ transport_.reset();
+ http_stream_parser_.reset();
+ return ERR_HTTPS_PROXY_TUNNEL_RESPONSE;
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:
« no previous file with comments | « net/http/http_network_transaction_unittest.cc ('k') | net/http/proxy_client_socket.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698