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

Unified Diff: net/http/http_security_headers.cc

Issue 1211933005: Initial (partial) implementation of HPKP violation reporting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: style fixes, comments Created 5 years, 6 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_security_headers.h ('k') | net/http/http_security_headers_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_security_headers.cc
diff --git a/net/http/http_security_headers.cc b/net/http/http_security_headers.cc
index e8e3a476829b2fdeb4b2accf622df88fdb769c6d..083f856a5e8fd2796646695ed24c7adb7271a8f4 100644
--- a/net/http/http_security_headers.cc
+++ b/net/http/http_security_headers.cc
@@ -273,14 +273,17 @@ bool ParseHSTSHeader(const std::string& value,
}
}
-// "Public-Key-Pins" ":"
+// "Public-Key-Pins[-Report-Only]" ":"
// "max-age" "=" delta-seconds ";"
// "pin-" algo "=" base64 [ ";" ... ]
+// [ ";" "includeSubdomains" ]
+// [ ";" "report-uri" "=" uri-reference ]
bool ParseHPKPHeader(const std::string& value,
const HashValueVector& chain_hashes,
base::TimeDelta* max_age,
bool* include_subdomains,
- HashValueVector* hashes) {
+ HashValueVector* hashes,
+ std::string* report_uri) {
bool parsed_max_age = false;
bool include_subdomains_candidate = false;
uint32 max_age_candidate = 0;
@@ -311,6 +314,14 @@ bool ParseHPKPHeader(const std::string& value,
return false;
} else if (base::LowerCaseEqualsASCII(equals.first, "includesubdomains")) {
include_subdomains_candidate = true;
+ } else if (base::LowerCaseEqualsASCII(equals.first, "report-uri")) {
+ // report-uris are always quoted.
+ if (!HttpUtil::IsQuote(equals.second[0]))
+ return false;
+
+ *report_uri = HttpUtil::Unquote(equals.second);
+ if (report_uri->empty())
+ return false;
} else {
// Silently ignore unknown directives for forward compatibility.
}
« no previous file with comments | « net/http/http_security_headers.h ('k') | net/http/http_security_headers_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698