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

Side by Side Diff: extensions/common/csp_validator.cc

Issue 2454553002: Revert of Reduce buggy usage of the registry controlled domain service. (Closed)
Patch Set: Created 4 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 unified diff | Download patch
OLDNEW
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 111
112 if (!is_wildcard_subdomain || !should_check_rcd) 112 if (!is_wildcard_subdomain || !should_check_rcd)
113 return true; 113 return true;
114 114
115 // Allow *.googleapis.com to be whitelisted for backwards-compatibility. 115 // Allow *.googleapis.com to be whitelisted for backwards-compatibility.
116 // (crbug.com/409952) 116 // (crbug.com/409952)
117 if (host == "googleapis.com") 117 if (host == "googleapis.com")
118 return true; 118 return true;
119 119
120 // Wildcards on subdomains of a TLD are not allowed. 120 // Wildcards on subdomains of a TLD are not allowed.
121 return net::registry_controlled_domains::HostHasRegistryControlledDomain( 121 size_t registry_length = net::registry_controlled_domains::GetRegistryLength(
122 host, net::registry_controlled_domains::INCLUDE_UNKNOWN_REGISTRIES, 122 host,
123 net::registry_controlled_domains::INCLUDE_UNKNOWN_REGISTRIES,
123 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); 124 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES);
125 return registry_length != 0;
124 } 126 }
125 127
126 // Checks whether the source is a syntactically valid hash. 128 // Checks whether the source is a syntactically valid hash.
127 bool IsHashSource(const std::string& source) { 129 bool IsHashSource(const std::string& source) {
128 size_t hash_end = source.length() - 1; 130 size_t hash_end = source.length() - 1;
129 if (source.empty() || source[hash_end] != '\'') { 131 if (source.empty() || source[hash_end] != '\'') {
130 return false; 132 return false;
131 } 133 }
132 134
133 for (const char* prefix : kHashSourcePrefixes) { 135 for (const char* prefix : kHashSourcePrefixes) {
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 } 369 }
368 } 370 }
369 } 371 }
370 372
371 return seen_sandbox; 373 return seen_sandbox;
372 } 374 }
373 375
374 } // namespace csp_validator 376 } // namespace csp_validator
375 377
376 } // namespace extensions 378 } // namespace extensions
OLDNEW
« no previous file with comments | « content/renderer/webpublicsuffixlist_impl.cc ('k') | extensions/common/manifest_handlers/externally_connectable.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698