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

Unified Diff: net/url_request/url_request_http_job.cc

Issue 1059303002: Don't process HSTS/HPKP headers when host is an IP address (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add tests for HPKP/HSTS headers on IPs Created 5 years, 9 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: net/url_request/url_request_http_job.cc
diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc
index 1a60ac4f52cb6e13fbc7bde9810114eba65787aa..890620a9d5bf1f3590b9d631ec8fa8179e174f5f 100644
--- a/net/url_request/url_request_http_job.cc
+++ b/net/url_request/url_request_http_job.cc
@@ -794,6 +794,10 @@ void URLRequestHttpJob::ProcessStrictTransportSecurityHeader() {
!security_state)
return;
+ // Don't accept HSTS headers when the hostname is an IP address.
+ if (request_info_.url.HostIsIPAddress())
+ return;
+
// http://tools.ietf.org/html/draft-ietf-websec-strict-transport-sec:
//
// If a UA receives more than one STS header field in a HTTP response
@@ -817,6 +821,10 @@ void URLRequestHttpJob::ProcessPublicKeyPinsHeader() {
!security_state)
return;
+ // Don't accept HSTS headers when the hostname is an IP address.
+ if (request_info_.url.HostIsIPAddress())
+ return;
+
// http://tools.ietf.org/html/draft-ietf-websec-key-pinning:
//
// If a UA receives more than one PKP header field in an HTTP

Powered by Google App Engine
This is Rietveld 408576698