diff options
author | rob <rob@robwu.nl> | 2014-11-19 05:27:36 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-11-19 13:27:56 +0000 |
commit | 67244e678279741947c09ba2ab18fbfec1707a97 (patch) | |
tree | a3a22056151c5d66f7705ffc97b48e0925fd4b51 /extensions/common/csp_validator.cc | |
parent | 52766365c191b1bcb68f006db0627fc8a972d920 (diff) | |
download | chromium_src-67244e678279741947c09ba2ab18fbfec1707a97.zip chromium_src-67244e678279741947c09ba2ab18fbfec1707a97.tar.gz chromium_src-67244e678279741947c09ba2ab18fbfec1707a97.tar.bz2 |
Accept invalid chrome-extension:// and chrome:// CSP tokens
Do not refuse to load the extension when the CSP contains
"chrome-extension://", because there are some extensions in the wild
that contains this token in the CSP. It is safe to accept this token
because the invalid CSP token is ignored by Blink (together with an
error message in the console, so the developer can fix the problem if
they bother to look at the console).
BUG=432227
TBR=kalman@chromium.org
Review URL: https://codereview.chromium.org/722233004
Cr-Commit-Position: refs/heads/master@{#304799}
Diffstat (limited to 'extensions/common/csp_validator.cc')
-rw-r--r-- | extensions/common/csp_validator.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/extensions/common/csp_validator.cc b/extensions/common/csp_validator.cc index 65edd0a..6221367 100644 --- a/extensions/common/csp_validator.cc +++ b/extensions/common/csp_validator.cc @@ -54,6 +54,11 @@ bool isNonWildcardTLD(const std::string& url, if (end_of_host == std::string::npos) end_of_host = url.size(); + // A missing host such as "chrome-extension://" is invalid, but for backwards- + // compatibility, accept such CSP parts. They will be ignored by Blink anyway. + if (start_of_host == end_of_host) + return true; + // Note: It is sufficient to only compare the first character against '*' // because the CSP only allows wildcards at the start of a directive, see // host-source and host-part at http://www.w3.org/TR/CSP2/#source-list-syntax |