OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "extensions/common/csp_validator.h" | 5 #include "extensions/common/csp_validator.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
10 #include "base/strings/string_tokenizer.h" | 10 #include "base/strings/string_tokenizer.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 } | 80 } |
81 | 81 |
82 std::string host(url, start_of_host, end_of_host - start_of_host); | 82 std::string host(url, start_of_host, end_of_host - start_of_host); |
83 // Global wildcards are not allowed. | 83 // Global wildcards are not allowed. |
84 if (host.empty() || host.find("*") != std::string::npos) | 84 if (host.empty() || host.find("*") != std::string::npos) |
85 return false; | 85 return false; |
86 | 86 |
87 if (!is_wildcard_subdomain || !should_check_rcd) | 87 if (!is_wildcard_subdomain || !should_check_rcd) |
88 return true; | 88 return true; |
89 | 89 |
| 90 // Allow *.googleapis.com to be whitelisted for backwards-compatibility. |
| 91 // (crbug.com/409952) |
| 92 if (host == "googleapis.com") |
| 93 return true; |
| 94 |
90 // Wildcards on subdomains of a TLD are not allowed. | 95 // Wildcards on subdomains of a TLD are not allowed. |
91 size_t registry_length = net::registry_controlled_domains::GetRegistryLength( | 96 size_t registry_length = net::registry_controlled_domains::GetRegistryLength( |
92 host, | 97 host, |
93 net::registry_controlled_domains::INCLUDE_UNKNOWN_REGISTRIES, | 98 net::registry_controlled_domains::INCLUDE_UNKNOWN_REGISTRIES, |
94 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); | 99 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); |
95 return registry_length != 0; | 100 return registry_length != 0; |
96 } | 101 } |
97 | 102 |
98 bool HasOnlySecureTokens(base::StringTokenizer& tokenizer, | 103 bool HasOnlySecureTokens(base::StringTokenizer& tokenizer, |
99 Manifest::Type type) { | 104 Manifest::Type type) { |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 } | 242 } |
238 } | 243 } |
239 } | 244 } |
240 | 245 |
241 return seen_sandbox; | 246 return seen_sandbox; |
242 } | 247 } |
243 | 248 |
244 } // namespace csp_validator | 249 } // namespace csp_validator |
245 | 250 |
246 } // namespace extensions | 251 } // namespace extensions |
OLD | NEW |