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

Side by Side Diff: content/browser/child_process_security_policy_impl.cc

Issue 2387173005: Lock down creation of "filesystem:chrome-extension://" URLs (Closed)
Patch Set: Add a histogram. Created 4 years, 2 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 (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 "content/browser/child_process_security_policy_impl.h" 5 #include "content/browser/child_process_security_policy_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 return result; 789 return result;
790 } 790 }
791 791
792 bool ChildProcessSecurityPolicyImpl::HasPermissionsForFileSystemFile( 792 bool ChildProcessSecurityPolicyImpl::HasPermissionsForFileSystemFile(
793 int child_id, 793 int child_id,
794 const storage::FileSystemURL& url, 794 const storage::FileSystemURL& url,
795 int permissions) { 795 int permissions) {
796 if (!url.is_valid()) 796 if (!url.is_valid())
797 return false; 797 return false;
798 798
799 // If |url.origin()| is not committable in this process, then this page
800 // should not be able to place content in that origin via the filesystem
801 // API either.
802 bool can_commit_origin = CanCommitURL(child_id, url.origin());
803 UMA_HISTOGRAM_BOOLEAN("ChildProcessSecurityPolicy.FileSystemCanCommitOrigin",
804 can_commit_origin);
805 if (!can_commit_origin)
806 return false;
807
799 if (url.path().ReferencesParent()) 808 if (url.path().ReferencesParent())
800 return false; 809 return false;
801 810
802 // Any write access is disallowed on the root path. 811 // Any write access is disallowed on the root path.
803 if (storage::VirtualPath::IsRootPath(url.path()) && 812 if (storage::VirtualPath::IsRootPath(url.path()) &&
804 (permissions & ~READ_FILE_GRANT)) { 813 (permissions & ~READ_FILE_GRANT)) {
805 return false; 814 return false;
806 } 815 }
807 816
808 if (url.mount_type() == storage::kFileSystemTypeIsolated) { 817 if (url.mount_type() == storage::kFileSystemTypeIsolated) {
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
963 base::AutoLock lock(lock_); 972 base::AutoLock lock(lock_);
964 973
965 SecurityStateMap::iterator state = security_state_.find(child_id); 974 SecurityStateMap::iterator state = security_state_.find(child_id);
966 if (state == security_state_.end()) 975 if (state == security_state_.end())
967 return false; 976 return false;
968 977
969 return state->second->can_send_midi_sysex(); 978 return state->second->can_send_midi_sysex();
970 } 979 }
971 980
972 } // namespace content 981 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698