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

Unified Diff: net/proxy/proxy_service.h

Issue 1996773002: Sanitize https:// URLs before sending them to PAC scripts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another ftp test with path Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/chrome_switches.cc ('k') | net/proxy/proxy_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/proxy/proxy_service.h
diff --git a/net/proxy/proxy_service.h b/net/proxy/proxy_service.h
index 635d26dbe2a71f7bd7777392f4e2256f43b101e6..c00cada4f7e86cc07fc20c33cf1ae88d9c085658 100644
--- a/net/proxy/proxy_service.h
+++ b/net/proxy/proxy_service.h
@@ -25,6 +25,7 @@
#include "net/proxy/proxy_config_service.h"
#include "net/proxy/proxy_info.h"
#include "net/proxy/proxy_server.h"
+#include "url/gurl.h"
class GURL;
@@ -52,6 +53,25 @@ class NET_EXPORT ProxyService : public NetworkChangeNotifier::IPAddressObserver,
public ProxyConfigService::Observer,
NON_EXPORTED_BASE(public base::NonThreadSafe) {
public:
+ // Enumerates the policy to use when sanitizing URLs for proxy resolution
+ // (before passing them off to PAC scripts).
+ enum class SanitizeUrlPolicy {
+ // Do a basic level of sanitization for URLs:
+ // - strip embedded identities (ex: "username:password@")
+ // - strip the fragment (ex: "#blah")
+ //
+ // This is considered "unsafe" because it does not do any additional
+ // stripping for https:// URLs.
+ UNSAFE,
+
+ // SAFE does the same sanitization as UNSAFE, but additionally strips
+ // everything but the (scheme,host,port) from cryptographic URL schemes
+ // (https:// and wss://).
+ //
+ // In other words, it strips the path and query portion of https:// URLs.
+ SAFE,
+ };
+
static const size_t kDefaultNumPacThreads = 4;
// This interface defines the set of policies for when to poll the PAC
@@ -296,6 +316,10 @@ class NET_EXPORT ProxyService : public NetworkChangeNotifier::IPAddressObserver,
quick_check_enabled_ = value;
}
+ void set_sanitize_url_policy(SanitizeUrlPolicy policy) {
+ sanitize_url_policy_ = policy;
+ }
+
private:
FRIEND_TEST_ALL_PREFIXES(ProxyServiceTest, UpdateConfigAfterFailedAutodetect);
FRIEND_TEST_ALL_PREFIXES(ProxyServiceTest, UpdateConfigFromPACToDirect);
@@ -460,6 +484,9 @@ class NET_EXPORT ProxyService : public NetworkChangeNotifier::IPAddressObserver,
// Whether child ProxyScriptDeciders should use QuickCheck
bool quick_check_enabled_;
+ // The method to use for sanitizing URLs seen by the proxy resolver.
+ SanitizeUrlPolicy sanitize_url_policy_;
+
DISALLOW_COPY_AND_ASSIGN(ProxyService);
};
« no previous file with comments | « chrome/common/chrome_switches.cc ('k') | net/proxy/proxy_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698