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

Side by Side Diff: third_party/WebKit/Source/platform/weborigin/SecurityOrigin.h

Issue 1507023004: Harden the implementation of '--disable-web-security' (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: esprehn feedback Created 5 years 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 /* 1 /*
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 // Explicitly grant the ability to load local resources to this 143 // Explicitly grant the ability to load local resources to this
144 // SecurityOrigin. 144 // SecurityOrigin.
145 // 145 //
146 // Note: This method exists only to support backwards compatibility 146 // Note: This method exists only to support backwards compatibility
147 // with older versions of WebKit. 147 // with older versions of WebKit.
148 void grantLoadLocalResources(); 148 void grantLoadLocalResources();
149 149
150 // Explicitly grant the ability to access every other SecurityOrigin. 150 // Explicitly grant the ability to access every other SecurityOrigin.
151 // 151 //
152 // WARNING: This is an extremely powerful ability. Use with caution! 152 // WARNING: This is an extremely powerful ability. Use with caution!
153 //
154 // TODO(mkwst): Remove this API as soon as is fesiable. That will likely
155 // require creating a more limited replacement.
153 void grantUniversalAccess(); 156 void grantUniversalAccess();
154 bool isGrantedUniversalAccess() const { return m_universalAccess; } 157 bool isGrantedUniversalAccess() const { return m_universalAccess; }
155 158
159 // Grant `file:` origins universal access.
160 //
161 // TODO(mkwst): As soon as we can reasonably get WebView to stop offering
162 // the API which requires this method, we should remove it.
163 void grantUniversalAccessForFileOrigins();
164
156 bool canAccessDatabase() const { return !isUnique(); } 165 bool canAccessDatabase() const { return !isUnique(); }
157 bool canAccessLocalStorage() const { return !isUnique(); } 166 bool canAccessLocalStorage() const { return !isUnique(); }
158 bool canAccessSharedWorkers() const { return !isUnique(); } 167 bool canAccessSharedWorkers() const { return !isUnique(); }
159 bool canAccessServiceWorkers() const { return !isUnique(); } 168 bool canAccessServiceWorkers() const { return !isUnique(); }
160 bool canAccessCookies() const { return !isUnique(); } 169 bool canAccessCookies() const { return !isUnique(); }
161 bool canAccessPasswordManager() const { return !isUnique(); } 170 bool canAccessPasswordManager() const { return !isUnique(); }
162 bool canAccessFileSystem() const { return !isUnique(); } 171 bool canAccessFileSystem() const { return !isUnique(); }
163 bool canAccessCacheStorage() const { return !isUnique(); } 172 bool canAccessCacheStorage() const { return !isUnique(); }
164 173
165 // Technically, we should always allow access to sessionStorage, but we 174 // Technically, we should always allow access to sessionStorage, but we
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 static const KURL& urlWithUniqueSecurityOrigin(); 231 static const KURL& urlWithUniqueSecurityOrigin();
223 232
224 // Transfer origin privileges from another security origin. 233 // Transfer origin privileges from another security origin.
225 // The following privileges are currently copied over: 234 // The following privileges are currently copied over:
226 // 235 //
227 // - Grant universal access. 236 // - Grant universal access.
228 // - Grant loading of local resources. 237 // - Grant loading of local resources.
229 // - Use path-based file:// origins. 238 // - Use path-based file:// origins.
230 struct PrivilegeData { 239 struct PrivilegeData {
231 bool m_universalAccess; 240 bool m_universalAccess;
241 bool m_universalAccessForFileOrigins;
232 bool m_canLoadLocalResources; 242 bool m_canLoadLocalResources;
233 bool m_blockLocalAccessFromLocalOrigin; 243 bool m_blockLocalAccessFromLocalOrigin;
234 }; 244 };
235 PassOwnPtr<PrivilegeData> createPrivilegeData() const; 245 PassOwnPtr<PrivilegeData> createPrivilegeData() const;
236 void transferPrivilegesFrom(PassOwnPtr<PrivilegeData>); 246 void transferPrivilegesFrom(PassOwnPtr<PrivilegeData>);
237 247
238 private: 248 private:
239 friend class SecurityOriginTest; 249 friend class SecurityOriginTest;
240 FRIEND_TEST_ALL_PREFIXES(SecurityOriginTest, Suborigins); 250 FRIEND_TEST_ALL_PREFIXES(SecurityOriginTest, Suborigins);
241 FRIEND_TEST_ALL_PREFIXES(SecurityOriginTest, SuboriginsParsing); 251 FRIEND_TEST_ALL_PREFIXES(SecurityOriginTest, SuboriginsParsing);
(...skipping 10 matching lines...) Expand all
252 static bool deserializeSuboriginAndHost(const String&, String&, String&); 262 static bool deserializeSuboriginAndHost(const String&, String&, String&);
253 263
254 String m_protocol; 264 String m_protocol;
255 String m_host; 265 String m_host;
256 String m_domain; 266 String m_domain;
257 String m_suboriginName; 267 String m_suboriginName;
258 unsigned short m_port; 268 unsigned short m_port;
259 unsigned short m_effectivePort; 269 unsigned short m_effectivePort;
260 bool m_isUnique; 270 bool m_isUnique;
261 bool m_universalAccess; 271 bool m_universalAccess;
272 bool m_universalAccessForFileOrigins;
262 bool m_domainWasSetInDOM; 273 bool m_domainWasSetInDOM;
263 bool m_canLoadLocalResources; 274 bool m_canLoadLocalResources;
264 bool m_blockLocalAccessFromLocalOrigin; 275 bool m_blockLocalAccessFromLocalOrigin;
265 }; 276 };
266 277
267 } // namespace blink 278 } // namespace blink
268 279
269 #endif // SecurityOrigin_h 280 #endif // SecurityOrigin_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698