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

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: rparen 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
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 if (!CanCommitURL(child_id, url.origin())) {
803 UMA_HISTOGRAM_BOOLEAN("FileSystem.OriginFailedCanCommitURL", true);
804 return false;
805 }
806
799 if (url.path().ReferencesParent()) 807 if (url.path().ReferencesParent())
800 return false; 808 return false;
801 809
802 // Any write access is disallowed on the root path. 810 // Any write access is disallowed on the root path.
803 if (storage::VirtualPath::IsRootPath(url.path()) && 811 if (storage::VirtualPath::IsRootPath(url.path()) &&
804 (permissions & ~READ_FILE_GRANT)) { 812 (permissions & ~READ_FILE_GRANT)) {
805 return false; 813 return false;
806 } 814 }
807 815
808 if (url.mount_type() == storage::kFileSystemTypeIsolated) { 816 if (url.mount_type() == storage::kFileSystemTypeIsolated) {
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
963 base::AutoLock lock(lock_); 971 base::AutoLock lock(lock_);
964 972
965 SecurityStateMap::iterator state = security_state_.find(child_id); 973 SecurityStateMap::iterator state = security_state_.find(child_id);
966 if (state == security_state_.end()) 974 if (state == security_state_.end())
967 return false; 975 return false;
968 976
969 return state->second->can_send_midi_sysex(); 977 return state->second->can_send_midi_sysex();
970 } 978 }
971 979
972 } // namespace content 980 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698