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

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

Issue 2644133002: Do not sanitize about:blank/#foo & about:blank?foo (Closed)
Patch Set: Add missing include Created 3 years, 11 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 | content/common/navigation_params.cc » ('j') | url/url_util.h » ('J')
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 12 matching lines...) Expand all
23 #include "content/public/browser/render_process_host.h" 23 #include "content/public/browser/render_process_host.h"
24 #include "content/public/common/bindings_policy.h" 24 #include "content/public/common/bindings_policy.h"
25 #include "content/public/common/url_constants.h" 25 #include "content/public/common/url_constants.h"
26 #include "net/base/filename_util.h" 26 #include "net/base/filename_util.h"
27 #include "net/url_request/url_request.h" 27 #include "net/url_request/url_request.h"
28 #include "storage/browser/fileapi/file_permission_policy.h" 28 #include "storage/browser/fileapi/file_permission_policy.h"
29 #include "storage/browser/fileapi/file_system_url.h" 29 #include "storage/browser/fileapi/file_system_url.h"
30 #include "storage/browser/fileapi/isolated_context.h" 30 #include "storage/browser/fileapi/isolated_context.h"
31 #include "storage/common/fileapi/file_system_util.h" 31 #include "storage/common/fileapi/file_system_util.h"
32 #include "url/gurl.h" 32 #include "url/gurl.h"
33 #include "url/url_util.h"
33 34
34 namespace content { 35 namespace content {
35 36
36 namespace { 37 namespace {
37 38
38 // Used internally only. These bit positions have no relationship to any 39 // Used internally only. These bit positions have no relationship to any
39 // underlying OS and can be changed to accommodate finer-grained permissions. 40 // underlying OS and can be changed to accommodate finer-grained permissions.
40 enum ChildProcessSecurityPermissions { 41 enum ChildProcessSecurityPermissions {
41 READ_FILE_PERMISSION = 1 << 0, 42 READ_FILE_PERMISSION = 1 << 0,
42 WRITE_FILE_PERMISSION = 1 << 1, 43 WRITE_FILE_PERMISSION = 1 << 1,
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 620
620 state->second->RevokeReadRawCookies(); 621 state->second->RevokeReadRawCookies();
621 } 622 }
622 623
623 bool ChildProcessSecurityPolicyImpl::CanRequestURL( 624 bool ChildProcessSecurityPolicyImpl::CanRequestURL(
624 int child_id, const GURL& url) { 625 int child_id, const GURL& url) {
625 if (!url.is_valid()) 626 if (!url.is_valid())
626 return false; // Can't request invalid URLs. 627 return false; // Can't request invalid URLs.
627 628
628 if (IsPseudoScheme(url.scheme())) { 629 if (IsPseudoScheme(url.scheme())) {
629 // Every child process can request <about:blank> and <about:srcdoc>. 630 // Every child process can request <about:blank>, <about:blank?foo>,
630 if (url == url::kAboutBlankURL || url == kAboutSrcDocURL) 631 // <about:blank/#foo> and <about:srcdoc>.
632 if (url::IsAboutBlank(url) || url == kAboutSrcDocURL)
631 return true; 633 return true;
632 // URLs like <about:version>, <about:crash>, <view-source:...> shouldn't be 634 // URLs like <about:version>, <about:crash>, <view-source:...> shouldn't be
633 // requestable by any child process. Also, this case covers 635 // requestable by any child process. Also, this case covers
634 // <javascript:...>, which should be handled internally by the process and 636 // <javascript:...>, which should be handled internally by the process and
635 // not kicked up to the browser. 637 // not kicked up to the browser.
636 return false; 638 return false;
637 } 639 }
638 640
639 // Blob and filesystem URLs require special treatment, since they embed an 641 // Blob and filesystem URLs require special treatment, since they embed an
640 // inner origin. 642 // inner origin.
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 base::AutoLock lock(lock_); 1000 base::AutoLock lock(lock_);
999 1001
1000 SecurityStateMap::iterator state = security_state_.find(child_id); 1002 SecurityStateMap::iterator state = security_state_.find(child_id);
1001 if (state == security_state_.end()) 1003 if (state == security_state_.end())
1002 return false; 1004 return false;
1003 1005
1004 return state->second->can_send_midi_sysex(); 1006 return state->second->can_send_midi_sysex();
1005 } 1007 }
1006 1008
1007 } // namespace content 1009 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/common/navigation_params.cc » ('j') | url/url_util.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698