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

Side by Side Diff: chrome/common/pepper_permission_util.cc

Issue 573113002: Relax shared module whitelist restriction (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 3 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 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 "chrome/common/pepper_permission_util.h" 5 #include "chrome/common/pepper_permission_util.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/sha1.h" 10 #include "base/sha1.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 typedef std::vector<SharedModuleInfo::ImportInfo> ImportInfoVector; 56 typedef std::vector<SharedModuleInfo::ImportInfo> ImportInfoVector;
57 const ImportInfoVector& imports = SharedModuleInfo::GetImports(extension); 57 const ImportInfoVector& imports = SharedModuleInfo::GetImports(extension);
58 for (ImportInfoVector::const_iterator it = imports.begin(); 58 for (ImportInfoVector::const_iterator it = imports.begin();
59 it != imports.end(); 59 it != imports.end();
60 ++it) { 60 ++it) {
61 const Extension* imported_extension = 61 const Extension* imported_extension =
62 extension_set->GetByID(it->extension_id); 62 extension_set->GetByID(it->extension_id);
63 if (imported_extension && 63 if (imported_extension &&
64 SharedModuleInfo::IsSharedModule(imported_extension) && 64 SharedModuleInfo::IsSharedModule(imported_extension) &&
65 // We check the whitelist explicitly even though the extension should
66 // never have been allowed to be installed in the first place if this
67 // fails. See SharedModuleService::CheckImports for details.
68 SharedModuleInfo::IsExportAllowedByWhitelist(imported_extension,
69 host) &&
70 HostIsInSet(it->extension_id, whitelist)) { 65 HostIsInSet(it->extension_id, whitelist)) {
71 return true; 66 return true;
72 } 67 }
73 } 68 }
74 69
75 return false; 70 return false;
76 } 71 }
77 72
78 bool IsHostAllowedByCommandLine(const GURL& url, 73 bool IsHostAllowedByCommandLine(const GURL& url,
79 const extensions::ExtensionSet* extension_set, 74 const extensions::ExtensionSet* extension_set,
(...skipping 22 matching lines...) Expand all
102 base::StringTokenizer t(allowed_list, ","); 97 base::StringTokenizer t(allowed_list, ",");
103 while (t.GetNext()) { 98 while (t.GetNext()) {
104 if (t.token() == host) 99 if (t.token() == host)
105 return true; 100 return true;
106 } 101 }
107 102
108 return false; 103 return false;
109 } 104 }
110 105
111 } // namespace chrome 106 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/extensions/shared_module_service_unittest.cc ('k') | chrome/common/pepper_permission_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698