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

Side by Side Diff: Source/core/frame/csp/CSPSourceList.cpp

Issue 1178373004: 'blob:' URLs should not match 'self' in CSP source expression lists. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Exclude extensions. Created 5 years, 6 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "config.h" 5 #include "config.h"
6 #include "core/frame/csp/CSPSourceList.h" 6 #include "core/frame/csp/CSPSourceList.h"
7 7
8 #include "core/frame/csp/CSPSource.h" 8 #include "core/frame/csp/CSPSource.h"
9 #include "core/frame/csp/ContentSecurityPolicy.h" 9 #include "core/frame/csp/ContentSecurityPolicy.h"
10 #include "platform/ParsingUtilities.h" 10 #include "platform/ParsingUtilities.h"
(...skipping 30 matching lines...) Expand all
41 , m_allowEval(false) 41 , m_allowEval(false)
42 , m_hashAlgorithmsUsed(0) 42 , m_hashAlgorithmsUsed(0)
43 { 43 {
44 } 44 }
45 45
46 bool CSPSourceList::matches(const KURL& url, ContentSecurityPolicy::RedirectStat us redirectStatus) const 46 bool CSPSourceList::matches(const KURL& url, ContentSecurityPolicy::RedirectStat us redirectStatus) const
47 { 47 {
48 if (m_allowStar) 48 if (m_allowStar)
49 return true; 49 return true;
50 50
51 KURL effectiveURL = SecurityOrigin::shouldUseInnerURL(url) ? SecurityOrigin: :extractInnerURL(url) : url; 51 KURL effectiveURL = m_policy->selfMatchesInnerURL() && SecurityOrigin::shoul dUseInnerURL(url) ? SecurityOrigin::extractInnerURL(url) : url;
52 52
53 if (m_allowSelf && m_policy->urlMatchesSelf(effectiveURL)) 53 if (m_allowSelf && m_policy->urlMatchesSelf(effectiveURL))
54 return true; 54 return true;
55 55
56 for (size_t i = 0; i < m_list.size(); ++i) { 56 for (size_t i = 0; i < m_list.size(); ++i) {
57 if (m_list[i].matches(effectiveURL, redirectStatus)) 57 if (m_list[i].matches(effectiveURL, redirectStatus))
58 return true; 58 return true;
59 } 59 }
60 60
61 return false; 61 return false;
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 } 485 }
486 486
487 void CSPSourceList::addSourceHash(const ContentSecurityPolicyHashAlgorithm& algo rithm, const DigestValue& hash) 487 void CSPSourceList::addSourceHash(const ContentSecurityPolicyHashAlgorithm& algo rithm, const DigestValue& hash)
488 { 488 {
489 m_hashes.add(CSPHashValue(algorithm, hash)); 489 m_hashes.add(CSPHashValue(algorithm, hash));
490 m_hashAlgorithmsUsed |= algorithm; 490 m_hashAlgorithmsUsed |= algorithm;
491 } 491 }
492 492
493 493
494 } // namespace blink 494 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698