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

Unified Diff: net/http/http_security_headers_unittest.cc

Issue 86043003: net: don't duplicate HPKP hashes when parsing the header. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_security_headers_unittest.cc
diff --git a/net/http/http_security_headers_unittest.cc b/net/http/http_security_headers_unittest.cc
index 0cc81b57eb88128f1809b9a47736720e7ea1fe88..42a5ee9896062504e21575f23519983d5caa9652 100644
--- a/net/http/http_security_headers_unittest.cc
+++ b/net/http/http_security_headers_unittest.cc
@@ -416,6 +416,20 @@ static void TestValidPKPHeaders(HashValueTag tag) {
expect_max_age = base::TimeDelta::FromSeconds(kMaxHSTSAgeSecs);
EXPECT_EQ(expect_max_age, max_age);
EXPECT_FALSE(include_subdomains);
+
+ // Test that parsing the same header twice doesn't duplicate the recorded
+ // hashes.
+ hashes.clear();
+ EXPECT_TRUE(ParseHPKPHeader(
+ " max-age=999; " +
+ backup_pin + ";" + good_pin + "; ",
+ chain_hashes, &max_age, &include_subdomains, &hashes));
+ EXPECT_EQ(2u, hashes.size());
+ EXPECT_TRUE(ParseHPKPHeader(
+ " max-age=999; " +
+ backup_pin + ";" + good_pin + "; ",
+ chain_hashes, &max_age, &include_subdomains, &hashes));
+ EXPECT_EQ(2u, hashes.size());
}
TEST_F(HttpSecurityHeadersTest, BogusPinsHeadersSHA1) {
« no previous file with comments | « net/http/http_security_headers.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698