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

Side by Side Diff: chrome/common/extensions/csp_validator.cc

Issue 10873060: Adding 'blob:' and 'filesystem:' URLs as secure sources for extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adam's feedback. Created 8 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/common/extensions/csp_validator_unittest.cc » ('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 "chrome/common/extensions/csp_validator.h" 5 #include "chrome/common/extensions/csp_validator.h"
6 6
7 #include "base/string_split.h" 7 #include "base/string_split.h"
8 #include "base/string_tokenizer.h" 8 #include "base/string_tokenizer.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 10
(...skipping 29 matching lines...) Expand all
40 std::string source = tokenizer.token(); 40 std::string source = tokenizer.token();
41 StringToLowerASCII(&source); 41 StringToLowerASCII(&source);
42 42
43 if (EndsWith(source, "*", true)) 43 if (EndsWith(source, "*", true))
44 return false; 44 return false;
45 45
46 // We might need to relax this whitelist over time. 46 // We might need to relax this whitelist over time.
47 if (source == "'self'" || 47 if (source == "'self'" ||
48 source == "'none'" || 48 source == "'none'" ||
49 source == "http://127.0.0.1" || 49 source == "http://127.0.0.1" ||
50 LowerCaseEqualsASCII(source, "blob:") ||
51 LowerCaseEqualsASCII(source, "filesystem:") ||
50 LowerCaseEqualsASCII(source, "http://localhost") || 52 LowerCaseEqualsASCII(source, "http://localhost") ||
51 StartsWithASCII(source, "http://127.0.0.1:", false) || 53 StartsWithASCII(source, "http://127.0.0.1:", false) ||
52 StartsWithASCII(source, "http://localhost:", false) || 54 StartsWithASCII(source, "http://localhost:", false) ||
53 StartsWithASCII(source, "https://", true) || 55 StartsWithASCII(source, "https://", true) ||
54 StartsWithASCII(source, "chrome://", true) || 56 StartsWithASCII(source, "chrome://", true) ||
55 StartsWithASCII(source, "chrome-extension://", true) || 57 StartsWithASCII(source, "chrome-extension://", true) ||
56 StartsWithASCII(source, "chrome-extension-resource:", true)) { 58 StartsWithASCII(source, "chrome-extension-resource:", true)) {
57 continue; 59 continue;
58 } 60 }
59 61
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 } 168 }
167 } 169 }
168 } 170 }
169 171
170 return seen_sandbox; 172 return seen_sandbox;
171 } 173 }
172 174
173 } // csp_validator 175 } // csp_validator
174 176
175 } // extensions 177 } // extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/common/extensions/csp_validator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698