| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/base/transport_security_state.h" | 5 #include "net/base/transport_security_state.h" |
| 6 | 6 |
| 7 #if defined(USE_OPENSSL) | 7 #if defined(USE_OPENSSL) |
| 8 #include <openssl/ecdsa.h> | 8 #include <openssl/ecdsa.h> |
| 9 #include <openssl/ssl.h> | 9 #include <openssl/ssl.h> |
| 10 #else // !defined(USE_OPENSSL) | 10 #else // !defined(USE_OPENSSL) |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "base/string_number_conversions.h" | 28 #include "base/string_number_conversions.h" |
| 29 #include "base/string_tokenizer.h" | 29 #include "base/string_tokenizer.h" |
| 30 #include "base/string_util.h" | 30 #include "base/string_util.h" |
| 31 #include "base/time.h" | 31 #include "base/time.h" |
| 32 #include "base/utf_string_conversions.h" | 32 #include "base/utf_string_conversions.h" |
| 33 #include "base/values.h" | 33 #include "base/values.h" |
| 34 #include "crypto/sha2.h" | 34 #include "crypto/sha2.h" |
| 35 #include "googleurl/src/gurl.h" | 35 #include "googleurl/src/gurl.h" |
| 36 #include "net/base/asn1_util.h" | 36 #include "net/base/asn1_util.h" |
| 37 #include "net/base/dns_util.h" | 37 #include "net/base/dns_util.h" |
| 38 #include "net/base/public_key_hashes.h" |
| 38 #include "net/base/ssl_info.h" | 39 #include "net/base/ssl_info.h" |
| 39 #include "net/base/x509_certificate.h" | 40 #include "net/base/x509_certificate.h" |
| 40 #include "net/http/http_util.h" | 41 #include "net/http/http_util.h" |
| 41 | 42 |
| 42 #if defined(USE_OPENSSL) | 43 #if defined(USE_OPENSSL) |
| 43 #include "crypto/openssl_util.h" | 44 #include "crypto/openssl_util.h" |
| 44 #endif | 45 #endif |
| 45 | 46 |
| 46 namespace net { | 47 namespace net { |
| 47 | 48 |
| (...skipping 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1139 hash++; | 1140 hash++; |
| 1140 } | 1141 } |
| 1141 } | 1142 } |
| 1142 } | 1143 } |
| 1143 return true; | 1144 return true; |
| 1144 } | 1145 } |
| 1145 } | 1146 } |
| 1146 return false; | 1147 return false; |
| 1147 } | 1148 } |
| 1148 | 1149 |
| 1149 #include "net/base/transport_security_state_static.h" | 1150 // kNoRejectedPublicKeys is a placeholder for when no public keys are rejected. |
| 1151 static const char* const kNoRejectedPublicKeys[] = { |
| 1152 NULL, |
| 1153 }; |
| 1154 |
| 1155 static const char* const kGoogleAcceptableCerts[] = { |
| 1156 kSPKIHash_VeriSignClass3, |
| 1157 kSPKIHash_VeriSignClass3_G3, |
| 1158 kSPKIHash_Google1024, |
| 1159 kSPKIHash_Google2048, |
| 1160 kSPKIHash_EquifaxSecureCA, |
| 1161 NULL, |
| 1162 }; |
| 1163 static const char* const kGoogleRejectedCerts[] = { |
| 1164 kSPKIHash_Aetna, |
| 1165 kSPKIHash_Intel, |
| 1166 kSPKIHash_TCTrustCenter, |
| 1167 kSPKIHash_Vodafone, |
| 1168 NULL, |
| 1169 }; |
| 1170 #define kGooglePins { \ |
| 1171 kGoogleAcceptableCerts, \ |
| 1172 kGoogleRejectedCerts, \ |
| 1173 } |
| 1174 |
| 1175 static const char* const kTorAcceptableCerts[] = { |
| 1176 kSPKIHash_RapidSSL, |
| 1177 kSPKIHash_DigiCertEVRoot, |
| 1178 kSPKIHash_Tor1, |
| 1179 kSPKIHash_Tor2, |
| 1180 kSPKIHash_Tor3, |
| 1181 NULL, |
| 1182 }; |
| 1183 #define kTorPins { \ |
| 1184 kTorAcceptableCerts, \ |
| 1185 kNoRejectedPublicKeys, \ |
| 1186 } |
| 1187 |
| 1188 static const char* const kTwitterComAcceptableCerts[] = { |
| 1189 kSPKIHash_VeriSignClass1, |
| 1190 kSPKIHash_VeriSignClass3, |
| 1191 kSPKIHash_VeriSignClass3_G4, |
| 1192 kSPKIHash_VeriSignClass4_G3, |
| 1193 kSPKIHash_VeriSignClass3_G3, |
| 1194 kSPKIHash_VeriSignClass1_G3, |
| 1195 kSPKIHash_VeriSignClass2_G3, |
| 1196 kSPKIHash_VeriSignClass3_G2, |
| 1197 kSPKIHash_VeriSignClass2_G2, |
| 1198 kSPKIHash_VeriSignClass3_G5, |
| 1199 kSPKIHash_VeriSignUniversal, |
| 1200 kSPKIHash_GeoTrustGlobal, |
| 1201 kSPKIHash_GeoTrustGlobal2, |
| 1202 kSPKIHash_GeoTrustUniversal, |
| 1203 kSPKIHash_GeoTrustUniversal2, |
| 1204 kSPKIHash_GeoTrustPrimary, |
| 1205 kSPKIHash_GeoTrustPrimary_G2, |
| 1206 kSPKIHash_GeoTrustPrimary_G3, |
| 1207 kSPKIHash_Twitter1, |
| 1208 NULL, |
| 1209 }; |
| 1210 #define kTwitterComPins { \ |
| 1211 kTwitterComAcceptableCerts, \ |
| 1212 kNoRejectedPublicKeys, \ |
| 1213 } |
| 1214 |
| 1215 // kTwitterCDNAcceptableCerts are the set of public keys valid for Twitter's |
| 1216 // CDNs, which includes all the keys from kTwitterComAcceptableCerts. |
| 1217 static const char* const kTwitterCDNAcceptableCerts[] = { |
| 1218 kSPKIHash_VeriSignClass1, |
| 1219 kSPKIHash_VeriSignClass3, |
| 1220 kSPKIHash_VeriSignClass3_G4, |
| 1221 kSPKIHash_VeriSignClass4_G3, |
| 1222 kSPKIHash_VeriSignClass3_G3, |
| 1223 kSPKIHash_VeriSignClass1_G3, |
| 1224 kSPKIHash_VeriSignClass2_G3, |
| 1225 kSPKIHash_VeriSignClass3_G2, |
| 1226 kSPKIHash_VeriSignClass2_G2, |
| 1227 kSPKIHash_VeriSignClass3_G5, |
| 1228 kSPKIHash_VeriSignUniversal, |
| 1229 kSPKIHash_GeoTrustGlobal, |
| 1230 kSPKIHash_GeoTrustGlobal2, |
| 1231 kSPKIHash_GeoTrustUniversal, |
| 1232 kSPKIHash_GeoTrustUniversal2, |
| 1233 kSPKIHash_GeoTrustPrimary, |
| 1234 kSPKIHash_GeoTrustPrimary_G2, |
| 1235 kSPKIHash_GeoTrustPrimary_G3, |
| 1236 kSPKIHash_Twitter1, |
| 1237 |
| 1238 kSPKIHash_Entrust_2048, |
| 1239 kSPKIHash_Entrust_EV, |
| 1240 kSPKIHash_Entrust_G2, |
| 1241 kSPKIHash_Entrust_SSL, |
| 1242 kSPKIHash_AAACertificateServices, |
| 1243 kSPKIHash_AddTrustClass1CARoot, |
| 1244 kSPKIHash_AddTrustExternalCARoot, |
| 1245 kSPKIHash_AddTrustPublicCARoot, |
| 1246 kSPKIHash_AddTrustQualifiedCARoot, |
| 1247 kSPKIHash_COMODOCertificationAuthority, |
| 1248 kSPKIHash_SecureCertificateServices, |
| 1249 kSPKIHash_TrustedCertificateServices, |
| 1250 kSPKIHash_UTNDATACorpSGC, |
| 1251 kSPKIHash_UTNUSERFirstClientAuthenticationandEmail, |
| 1252 kSPKIHash_UTNUSERFirstHardware, |
| 1253 kSPKIHash_UTNUSERFirstObject, |
| 1254 kSPKIHash_GTECyberTrustGlobalRoot, |
| 1255 NULL, |
| 1256 }; |
| 1257 #define kTwitterCDNPins { \ |
| 1258 kTwitterCDNAcceptableCerts, \ |
| 1259 kNoRejectedPublicKeys, \ |
| 1260 } |
| 1261 |
| 1262 // kTestAcceptableCerts doesn't actually match any public keys and is used |
| 1263 // with "pinningtest.appspot.com", below, to test if pinning is active. |
| 1264 static const char* const kTestAcceptableCerts[] = { |
| 1265 "sha1/AAAAAAAAAAAAAAAAAAAAAAAAAAA=", |
| 1266 NULL, |
| 1267 }; |
| 1268 #define kTestPins { \ |
| 1269 kTestAcceptableCerts, \ |
| 1270 kNoRejectedPublicKeys, \ |
| 1271 } |
| 1272 |
| 1273 #define kNoPins { \ |
| 1274 NULL, NULL, \ |
| 1275 } |
| 1276 |
| 1277 #if defined(OS_CHROMEOS) |
| 1278 static const bool kTwitterHSTS = true; |
| 1279 #else |
| 1280 static const bool kTwitterHSTS = false; |
| 1281 #endif |
| 1282 |
| 1283 // In the medium term this list is likely to just be hardcoded here. This |
| 1284 // slightly odd form removes the need for additional relocations records. |
| 1285 static const struct HSTSPreload kPreloadedSTS[] = { |
| 1286 // (*.)google.com, iff using SSL must use an acceptable certificate. |
| 1287 {12, true, "\006google\003com", false, kGooglePins, |
| 1288 DOMAIN_GOOGLE_COM }, |
| 1289 {25, true, "\013pinningtest\007appspot\003com", false, |
| 1290 kTestPins, DOMAIN_APPSPOT_COM }, |
| 1291 // Now we force HTTPS for subtrees of google.com. |
| 1292 {19, true, "\006health\006google\003com", true, kGooglePins, |
| 1293 DOMAIN_GOOGLE_COM }, |
| 1294 {21, true, "\010checkout\006google\003com", true, kGooglePins, |
| 1295 DOMAIN_GOOGLE_COM }, |
| 1296 {19, true, "\006chrome\006google\003com", true, kGooglePins, |
| 1297 DOMAIN_GOOGLE_COM }, |
| 1298 {17, true, "\004docs\006google\003com", true, kGooglePins, |
| 1299 DOMAIN_GOOGLE_COM }, |
| 1300 {18, true, "\005sites\006google\003com", true, kGooglePins, |
| 1301 DOMAIN_GOOGLE_COM }, |
| 1302 {25, true, "\014spreadsheets\006google\003com", true, |
| 1303 kGooglePins, DOMAIN_GOOGLE_COM }, |
| 1304 {22, false, "\011appengine\006google\003com", true, |
| 1305 kGooglePins, DOMAIN_GOOGLE_COM }, |
| 1306 {22, true, "\011encrypted\006google\003com", true, kGooglePins, |
| 1307 DOMAIN_GOOGLE_COM }, |
| 1308 {21, true, "\010accounts\006google\003com", true, kGooglePins, |
| 1309 DOMAIN_GOOGLE_COM }, |
| 1310 {21, true, "\010profiles\006google\003com", true, kGooglePins, |
| 1311 DOMAIN_GOOGLE_COM }, |
| 1312 {17, true, "\004mail\006google\003com", true, kGooglePins, |
| 1313 DOMAIN_GOOGLE_COM }, |
| 1314 {23, true, "\012talkgadget\006google\003com", true, |
| 1315 kGooglePins, DOMAIN_GOOGLE_COM }, |
| 1316 {17, true, "\004talk\006google\003com", true, kGooglePins, |
| 1317 DOMAIN_GOOGLE_COM }, |
| 1318 {29, true, "\020hostedtalkgadget\006google\003com", true, |
| 1319 kGooglePins, DOMAIN_GOOGLE_COM }, |
| 1320 {17, true, "\004plus\006google\003com", true, kGooglePins, |
| 1321 DOMAIN_GOOGLE_COM }, |
| 1322 // Other Google-related domains that must use HTTPS. |
| 1323 {20, true, "\006market\007android\003com", true, kGooglePins, |
| 1324 DOMAIN_ANDROID_COM }, |
| 1325 {26, true, "\003ssl\020google-analytics\003com", true, |
| 1326 kGooglePins, DOMAIN_GOOGLE_ANALYTICS_COM }, |
| 1327 {18, true, "\005drive\006google\003com", true, kGooglePins, |
| 1328 DOMAIN_GOOGLE_COM }, |
| 1329 {16, true, "\012googleplex\003com", true, kGooglePins, |
| 1330 DOMAIN_GOOGLEPLEX_COM }, |
| 1331 {19, true, "\006groups\006google\003com", true, kGooglePins, |
| 1332 DOMAIN_GOOGLE_COM }, |
| 1333 {17, true, "\004apis\006google\003com", true, kGooglePins, |
| 1334 DOMAIN_GOOGLE_COM }, |
| 1335 // chart.apis.google.com is *not* HSTS because the certificate doesn't match |
| 1336 // and there are lots of links out there that still use the name. The correct |
| 1337 // hostname for this is chart.googleapis.com. |
| 1338 {23, true, "\005chart\004apis\006google\003com", false, kGooglePins, |
| 1339 DOMAIN_GOOGLE_COM}, |
| 1340 |
| 1341 // Other Google-related domains that must use an acceptable certificate |
| 1342 // iff using SSL. |
| 1343 {11, true, "\005ytimg\003com", false, kGooglePins, |
| 1344 DOMAIN_YTIMG_COM }, |
| 1345 {23, true, "\021googleusercontent\003com", false, kGooglePins, |
| 1346 DOMAIN_GOOGLEUSERCONTENT_COM }, |
| 1347 {13, true, "\007youtube\003com", false, kGooglePins, |
| 1348 DOMAIN_YOUTUBE_COM }, |
| 1349 {16, true, "\012googleapis\003com", false, kGooglePins, |
| 1350 DOMAIN_GOOGLEAPIS_COM }, |
| 1351 {22, true, "\020googleadservices\003com", false, kGooglePins, |
| 1352 DOMAIN_GOOGLEADSERVICES_COM }, |
| 1353 {16, true, "\012googlecode\003com", false, kGooglePins, |
| 1354 DOMAIN_GOOGLECODE_COM }, |
| 1355 {13, true, "\007appspot\003com", false, kGooglePins, |
| 1356 DOMAIN_APPSPOT_COM }, |
| 1357 {23, true, "\021googlesyndication\003com", false, kGooglePins, |
| 1358 DOMAIN_GOOGLESYNDICATION_COM }, |
| 1359 {17, true, "\013doubleclick\003net", false, kGooglePins, |
| 1360 DOMAIN_DOUBLECLICK_NET }, |
| 1361 {17, true, "\003ssl\007gstatic\003com", false, kGooglePins, |
| 1362 DOMAIN_GSTATIC_COM }, |
| 1363 // Exclude the learn.doubleclick.net subdomain because it uses a different |
| 1364 // CA. |
| 1365 {23, true, "\005learn\013doubleclick\003net", false, kNoPins, DOMAIN_NOT_PINNE
D }, |
| 1366 // Now we force HTTPS for other sites that have requested it. |
| 1367 {16, false, "\003www\006paypal\003com", true, kNoPins, DOMAIN_NOT_PINNED }, |
| 1368 {16, false, "\003www\006elanex\003biz", true, kNoPins, DOMAIN_NOT_PINNED }, |
| 1369 {12, true, "\006jottit\003com", true, kNoPins, DOMAIN_NOT_PINNED }, |
| 1370 {19, true, "\015sunshinepress\003org", true, kNoPins, DOMAIN_NOT_PINNED }, |
| 1371 {21, false, "\003www\013noisebridge\003net", true, kNoPins, |
| 1372 DOMAIN_NOT_PINNED }, |
| 1373 {10, false, "\004neg9\003org", true, kNoPins, DOMAIN_NOT_PINNED }, |
| 1374 {12, true, "\006riseup\003net", true, kNoPins, DOMAIN_NOT_PINNED }, |
| 1375 {11, false, "\006factor\002cc", true, kNoPins, DOMAIN_NOT_PINNED }, |
| 1376 {22, false, "\007members\010mayfirst\003org", true, kNoPins, DOMAIN_NOT_PINNED
}, |
| 1377 {22, false, "\007support\010mayfirst\003org", true, kNoPins, DOMAIN_NOT_PINNED
}, |
| 1378 {17, false, "\002id\010mayfirst\003org", true, kNoPins, DOMAIN_NOT_PINNED }, |
| 1379 {20, false, "\005lists\010mayfirst\003org", true, kNoPins, DOMAIN_NOT_PINNED }
, |
| 1380 {19, true, "\015splendidbacon\003com", true, kNoPins, DOMAIN_NOT_PINNED }, |
| 1381 {28, false, "\016aladdinschools\007appspot\003com", true, kNoPins, |
| 1382 DOMAIN_NOT_PINNED }, |
| 1383 {14, true, "\011ottospora\002nl", true, kNoPins, DOMAIN_NOT_PINNED }, |
| 1384 {25, false, "\003www\017paycheckrecords\003com", true, kNoPins, |
| 1385 DOMAIN_NOT_PINNED }, |
| 1386 {14, false, "\010lastpass\003com", true, kNoPins, DOMAIN_NOT_PINNED }, |
| 1387 {18, false, "\003www\010lastpass\003com", true, kNoPins, DOMAIN_NOT_PINNED }, |
| 1388 {14, true, "\010keyerror\003com", true, kNoPins, DOMAIN_NOT_PINNED }, |
| 1389 {13, false, "\010entropia\002de", true, kNoPins, DOMAIN_NOT_PINNED }, |
| 1390 {17, false, "\003www\010entropia\002de", true, kNoPins, DOMAIN_NOT_PINNED }, |
| 1391 {11, true, "\005romab\003com", true, kNoPins, DOMAIN_NOT_PINNED }, |
| 1392 {16, false, "\012logentries\003com", true, kNoPins, DOMAIN_NOT_PINNED }, |
| 1393 {20, false, "\003www\012logentries\003com", true, kNoPins, DOMAIN_NOT_PINNED }
, |
| 1394 {12, true, "\006stripe\003com", true, kNoPins, DOMAIN_NOT_PINNED }, |
| 1395 {27, true, "\025cloudsecurityalliance\003org", true, kNoPins, |
| 1396 DOMAIN_NOT_PINNED }, |
| 1397 {15, true, "\005login\004sapo\002pt", true, kNoPins, DOMAIN_NOT_PINNED }, |
| 1398 {19, true, "\015mattmccutchen\003net", true, kNoPins, DOMAIN_NOT_PINNED }, |
| 1399 {11, true, "\006betnet\002fr", true, kNoPins, DOMAIN_NOT_PINNED }, |
| 1400 {13, true, "\010uprotect\002it", true, kNoPins, DOMAIN_NOT_PINNED }, |
| 1401 {14, false, "\010squareup\003com", true, kNoPins, DOMAIN_NOT_PINNED }, |
| 1402 {9, true, "\004cert\002se", true, kNoPins, DOMAIN_NOT_PINNED }, |
| 1403 {11, true, "\006crypto\002is", true, kNoPins, DOMAIN_NOT_PINNED }, |
| 1404 {20, true, "\005simon\007butcher\004name", true, kNoPins, DOMAIN_NOT_PINNED }, |
| 1405 {10, true, "\004linx\003net", true, kNoPins, DOMAIN_NOT_PINNED }, |
| 1406 {13, false, "\007dropcam\003com", true, kNoPins, DOMAIN_NOT_PINNED }, |
| 1407 {17, false, "\003www\007dropcam\003com", true, kNoPins, DOMAIN_NOT_PINNED }, |
| 1408 {30, true, "\010ebanking\014indovinabank\003com\002vn", true, kNoPins, |
| 1409 DOMAIN_NOT_PINNED }, |
| 1410 {13, false, "\007epoxate\003com", true, kNoPins, DOMAIN_NOT_PINNED }, |
| 1411 {16, false, "\012torproject\003org", true, kTorPins, |
| 1412 DOMAIN_TORPROJECT_ORG }, |
| 1413 {21, true, "\004blog\012torproject\003org", true, kTorPins, |
| 1414 DOMAIN_TORPROJECT_ORG }, |
| 1415 {22, true, "\005check\012torproject\003org", true, kTorPins, |
| 1416 DOMAIN_TORPROJECT_ORG }, |
| 1417 {20, true, "\003www\012torproject\003org", true, kTorPins, |
| 1418 DOMAIN_TORPROJECT_ORG }, |
| 1419 {22, true, "\003www\014moneybookers\003com", true, kNoPins, |
| 1420 DOMAIN_NOT_PINNED }, |
| 1421 {17, false, "\013ledgerscope\003net", true, kNoPins, DOMAIN_NOT_PINNED }, |
| 1422 {21, false, "\003www\013ledgerscope\003net", true, kNoPins, |
| 1423 DOMAIN_NOT_PINNED }, |
| 1424 {10, false, "\004kyps\003net", true, kNoPins, DOMAIN_NOT_PINNED }, |
| 1425 {14, false, "\003www\004kyps\003net", true, kNoPins, DOMAIN_NOT_PINNED }, |
| 1426 {17, true, "\003app\007recurly\003com", true, kNoPins, DOMAIN_NOT_PINNED }, |
| 1427 {17, true, "\003api\007recurly\003com", true, kNoPins, DOMAIN_NOT_PINNED }, |
| 1428 {13, false, "\007greplin\003com", true, kNoPins, DOMAIN_NOT_PINNED }, |
| 1429 {17, false, "\003www\007greplin\003com", true, kNoPins, DOMAIN_NOT_PINNED }, |
| 1430 {27, true, "\006luneta\016nearbuysystems\003com", true, kNoPins, |
| 1431 DOMAIN_NOT_PINNED }, |
| 1432 {12, true, "\006ubertt\003org", true, kNoPins, DOMAIN_NOT_PINNED }, |
| 1433 {9, true, "\004pixi\002me", true, kNoPins, DOMAIN_NOT_PINNED }, |
| 1434 {14, true, "\010grepular\003com", true, kNoPins, DOMAIN_NOT_PINNED }, |
| 1435 {16, false , "\012mydigipass\003com", true, kNoPins, DOMAIN_NOT_PINNED }, |
| 1436 {20, false , "\003www\012mydigipass\003com", true, kNoPins, |
| 1437 DOMAIN_NOT_PINNED }, |
| 1438 {26, false , "\011developer\012mydigipass\003com", true, kNoPins, |
| 1439 DOMAIN_NOT_PINNED }, |
| 1440 {30, false , "\003www\011developer\012mydigipass\003com", true, kNoPins, |
| 1441 DOMAIN_NOT_PINNED }, |
| 1442 {24, false , "\007sandbox\012mydigipass\003com", true, kNoPins, |
| 1443 DOMAIN_NOT_PINNED }, |
| 1444 {28, false , "\003www\007sandbox\012mydigipass\003com", true, kNoPins, |
| 1445 DOMAIN_NOT_PINNED }, |
| 1446 {12, true, "\006crypto\003cat", true, kNoPins, DOMAIN_NOT_PINNED }, |
| 1447 {25, true, "\014bigshinylock\006minazo\003net", true, kNoPins, |
| 1448 DOMAIN_NOT_PINNED }, |
| 1449 {10, true, "\005crate\002io", true, kNoPins, DOMAIN_NOT_PINNED }, |
| 1450 |
| 1451 {13, false, "\007twitter\003com", kTwitterHSTS, |
| 1452 kTwitterComPins, DOMAIN_TWITTER_COM }, |
| 1453 {17, true, "\003www\007twitter\003com", kTwitterHSTS, |
| 1454 kTwitterComPins, DOMAIN_TWITTER_COM }, |
| 1455 {17, true, "\003api\007twitter\003com", kTwitterHSTS, |
| 1456 kTwitterCDNPins, DOMAIN_TWITTER_COM }, |
| 1457 {19, true, "\005oauth\007twitter\003com", kTwitterHSTS, |
| 1458 kTwitterComPins, DOMAIN_TWITTER_COM }, |
| 1459 {20, true, "\006mobile\007twitter\003com", kTwitterHSTS, |
| 1460 kTwitterComPins, DOMAIN_TWITTER_COM }, |
| 1461 {17, true, "\003dev\007twitter\003com", kTwitterHSTS, |
| 1462 kTwitterComPins, DOMAIN_TWITTER_COM }, |
| 1463 {22, true, "\010business\007twitter\003com", kTwitterHSTS, |
| 1464 kTwitterComPins, DOMAIN_TWITTER_COM }, |
| 1465 {22, true, "\010platform\007twitter\003com", false, |
| 1466 kTwitterCDNPins, DOMAIN_TWITTER_COM }, |
| 1467 {15, true, "\003si0\005twimg\003com", false, kTwitterCDNPins, |
| 1468 DOMAIN_TWIMG_COM }, |
| 1469 {23, true, "\010twimg0-a\010akamaihd\003net", false, |
| 1470 kTwitterCDNPins, DOMAIN_AKAMAIHD_NET }, |
| 1471 }; |
| 1472 static const size_t kNumPreloadedSTS = ARRAYSIZE_UNSAFE(kPreloadedSTS); |
| 1473 |
| 1474 static const struct HSTSPreload kPreloadedSNISTS[] = { |
| 1475 // These SNI-only domains must always use HTTPS. |
| 1476 {11, false, "\005gmail\003com", true, kGooglePins, |
| 1477 DOMAIN_GMAIL_COM }, |
| 1478 {16, false, "\012googlemail\003com", true, kGooglePins, |
| 1479 DOMAIN_GOOGLEMAIL_COM }, |
| 1480 {15, false, "\003www\005gmail\003com", true, kGooglePins, |
| 1481 DOMAIN_GMAIL_COM }, |
| 1482 {20, false, "\003www\012googlemail\003com", true, kGooglePins, |
| 1483 DOMAIN_GOOGLEMAIL_COM }, |
| 1484 // These SNI-only domains must use an acceptable certificate iff using |
| 1485 // HTTPS. |
| 1486 {22, true, "\020google-analytics\003com", false, kGooglePins, |
| 1487 DOMAIN_GOOGLE_ANALYTICS_COM }, |
| 1488 // www. requires SNI. |
| 1489 {18, true, "\014googlegroups\003com", false, kGooglePins, |
| 1490 DOMAIN_GOOGLEGROUPS_COM }, |
| 1491 }; |
| 1492 static const size_t kNumPreloadedSNISTS = ARRAYSIZE_UNSAFE(kPreloadedSNISTS); |
| 1150 | 1493 |
| 1151 // Returns the HSTSPreload entry for the |canonicalized_host| in |entries|, | 1494 // Returns the HSTSPreload entry for the |canonicalized_host| in |entries|, |
| 1152 // or NULL if there is none. Prefers exact hostname matches to those that | 1495 // or NULL if there is none. Prefers exact hostname matches to those that |
| 1153 // match only because HSTSPreload.include_subdomains is true. | 1496 // match only because HSTSPreload.include_subdomains is true. |
| 1154 // | 1497 // |
| 1155 // |canonicalized_host| should be the hostname as canonicalized by | 1498 // |canonicalized_host| should be the hostname as canonicalized by |
| 1156 // CanonicalizeHost. | 1499 // CanonicalizeHost. |
| 1157 static const struct HSTSPreload* GetHSTSPreload( | 1500 static const struct HSTSPreload* GetHSTSPreload( |
| 1158 const std::string& canonicalized_host, | 1501 const std::string& canonicalized_host, |
| 1159 const struct HSTSPreload* entries, | 1502 const struct HSTSPreload* entries, |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1313 | 1656 |
| 1314 return true; | 1657 return true; |
| 1315 } | 1658 } |
| 1316 | 1659 |
| 1317 bool TransportSecurityState::DomainState::ShouldRedirectHTTPToHTTPS() | 1660 bool TransportSecurityState::DomainState::ShouldRedirectHTTPToHTTPS() |
| 1318 const { | 1661 const { |
| 1319 return mode == MODE_STRICT; | 1662 return mode == MODE_STRICT; |
| 1320 } | 1663 } |
| 1321 | 1664 |
| 1322 } // namespace | 1665 } // namespace |
| OLD | NEW |