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

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: 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
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"
11 #include "base/debug/dump_without_crashing.h" 11 #include "base/debug/dump_without_crashing.h"
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/ptr_util.h" 15 #include "base/memory/ptr_util.h"
16 #include "base/metrics/histogram_macros.h" 16 #include "base/metrics/histogram_macros.h"
17 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
18 #include "build/build_config.h" 18 #include "build/build_config.h"
19 #include "content/browser/site_instance_impl.h" 19 #include "content/browser/site_instance_impl.h"
20 #include "content/common/site_isolation_policy.h" 20 #include "content/common/site_isolation_policy.h"
21 #include "content/public/browser/child_process_data.h" 21 #include "content/public/browser/child_process_data.h"
22 #include "content/public/browser/content_browser_client.h" 22 #include "content/public/browser/content_browser_client.h"
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 "content/public/common/url_utils.h"
26 #include "net/base/filename_util.h" 27 #include "net/base/filename_util.h"
27 #include "net/url_request/url_request.h" 28 #include "net/url_request/url_request.h"
28 #include "storage/browser/fileapi/file_permission_policy.h" 29 #include "storage/browser/fileapi/file_permission_policy.h"
29 #include "storage/browser/fileapi/file_system_url.h" 30 #include "storage/browser/fileapi/file_system_url.h"
30 #include "storage/browser/fileapi/isolated_context.h" 31 #include "storage/browser/fileapi/isolated_context.h"
31 #include "storage/common/fileapi/file_system_util.h" 32 #include "storage/common/fileapi/file_system_util.h"
32 #include "url/gurl.h" 33 #include "url/gurl.h"
33 34
34 namespace content { 35 namespace content {
35 36
(...skipping 583 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 (IsAboutBlankURL(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') | content/public/common/url_constants.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698