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

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

Issue 704723003: Revert "Allow CSP checkNonce and checkHash to pass with 'unsafe-inline' only." (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month 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/CSPDirectiveList.h" 6 #include "core/frame/csp/CSPDirectiveList.h"
7 7
8 #include "core/dom/Document.h" 8 #include "core/dom/Document.h"
9 #include "core/frame/LocalFrame.h" 9 #include "core/frame/LocalFrame.h"
10 #include "core/inspector/ConsoleMessage.h" 10 #include "core/inspector/ConsoleMessage.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 return !directive || directive->allowEval(); 79 return !directive || directive->allowEval();
80 } 80 }
81 81
82 bool CSPDirectiveList::checkInline(SourceListDirective* directive) const 82 bool CSPDirectiveList::checkInline(SourceListDirective* directive) const
83 { 83 {
84 return !directive || (directive->allowInline() && !directive->isHashOrNonceP resent()); 84 return !directive || (directive->allowInline() && !directive->isHashOrNonceP resent());
85 } 85 }
86 86
87 bool CSPDirectiveList::checkNonce(SourceListDirective* directive, const String& nonce) const 87 bool CSPDirectiveList::checkNonce(SourceListDirective* directive, const String& nonce) const
88 { 88 {
89 return !directive || directive->allowNonce(nonce) || checkInline(directive); 89 return !directive || directive->allowNonce(nonce);
90 } 90 }
91 91
92 bool CSPDirectiveList::checkHash(SourceListDirective* directive, const CSPHashVa lue& hashValue) const 92 bool CSPDirectiveList::checkHash(SourceListDirective* directive, const CSPHashVa lue& hashValue) const
93 { 93 {
94 return !directive || directive->allowHash(hashValue) || checkInline(directiv e); 94 return !directive || directive->allowHash(hashValue);
95 } 95 }
96 96
97 bool CSPDirectiveList::checkSource(SourceListDirective* directive, const KURL& u rl) const 97 bool CSPDirectiveList::checkSource(SourceListDirective* directive, const KURL& u rl) const
98 { 98 {
99 return !directive || directive->allows(url); 99 return !directive || directive->allows(url);
100 } 100 }
101 101
102 bool CSPDirectiveList::checkAncestors(SourceListDirective* directive, LocalFrame * frame) const 102 bool CSPDirectiveList::checkAncestors(SourceListDirective* directive, LocalFrame * frame) const
103 { 103 {
104 if (!frame || !directive) 104 if (!frame || !directive)
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 setCSPDirective<SourceListDirective>(name, value, m_manifestSrc); 688 setCSPDirective<SourceListDirective>(name, value, m_manifestSrc);
689 else 689 else
690 m_policy->reportUnsupportedDirective(name); 690 m_policy->reportUnsupportedDirective(name);
691 } else { 691 } else {
692 m_policy->reportUnsupportedDirective(name); 692 m_policy->reportUnsupportedDirective(name);
693 } 693 }
694 } 694 }
695 695
696 696
697 } // namespace blink 697 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/security/contentSecurityPolicy/1.1/scriptnonce-multiple-policies-with-unsafe-inline-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698