Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 28 matching lines...) Expand all Loading... | |
| 39 while (tokenizer.GetNext()) { | 39 while (tokenizer.GetNext()) { |
| 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" || | |
| 50 source == "http://localhost" || | |
|
abarth-chromium
2012/08/13 15:50:01
This one should probably be case insensitive.
abarth-chromium
2012/08/13 15:50:42
Do we want to allow non-default ports? You might
| |
| 49 StartsWithASCII(source, "https://", true) || | 51 StartsWithASCII(source, "https://", true) || |
| 50 StartsWithASCII(source, "chrome://", true) || | 52 StartsWithASCII(source, "chrome://", true) || |
| 51 StartsWithASCII(source, "chrome-extension://", true) || | 53 StartsWithASCII(source, "chrome-extension://", true) || |
| 52 StartsWithASCII(source, "chrome-extension-resource:", true)) { | 54 StartsWithASCII(source, "chrome-extension-resource:", true)) { |
| 53 continue; | 55 continue; |
| 54 } | 56 } |
| 55 | 57 |
| 56 return false; | 58 return false; |
| 57 } | 59 } |
| 58 | 60 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 162 } | 164 } |
| 163 } | 165 } |
| 164 } | 166 } |
| 165 | 167 |
| 166 return seen_sandbox; | 168 return seen_sandbox; |
| 167 } | 169 } |
| 168 | 170 |
| 169 } // csp_validator | 171 } // csp_validator |
| 170 | 172 |
| 171 } // extensions | 173 } // extensions |
| OLD | NEW |