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

Unified Diff: net/http/http_security_headers.cc

Issue 847043004: Require HPKP pins to be quoted. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | « no previous file | 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 8d0c1465307f8adb5da5eb61907e2a0b8b2d9da6..373d0b896caf83c1d03ee23c09452ed253fc7a00 100644
--- a/net/http/http_security_headers.cc
+++ b/net/http/http_security_headers.cc
@@ -118,12 +118,15 @@ StringPair Split(const std::string& source, char delimiter) {
bool ParseAndAppendPin(const std::string& value,
HashValueTag tag,
HashValueVector* hashes) {
- std::string unquoted = HttpUtil::Unquote(value);
- std::string decoded;
+ // Pins are always quoted.
+ if (value.empty() || !HttpUtil::IsQuote(value[0]))
+ return false;
+ std::string unquoted = HttpUtil::Unquote(value);
if (unquoted.empty())
return false;
+ std::string decoded;
if (!base::Base64Decode(unquoted, &decoded))
return false;
« no previous file with comments | « no previous file | net/http/http_security_headers_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698