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

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

Issue 470723006: Disallow an empty host in a CSP host-source directive (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 4 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
« no previous file with comments | « LayoutTests/http/tests/security/contentSecurityPolicy/source-list-parsing-07-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 205
206 if (position[1] == '/') { 206 if (position[1] == '/') {
207 // scheme://host || scheme:// 207 // scheme://host || scheme://
208 // ^ ^ 208 // ^ ^
209 if (!parseScheme(begin, position, scheme) 209 if (!parseScheme(begin, position, scheme)
210 || !skipExactly<UChar>(position, end, ':') 210 || !skipExactly<UChar>(position, end, ':')
211 || !skipExactly<UChar>(position, end, '/') 211 || !skipExactly<UChar>(position, end, '/')
212 || !skipExactly<UChar>(position, end, '/')) 212 || !skipExactly<UChar>(position, end, '/'))
213 return false; 213 return false;
214 if (position == end) 214 if (position == end)
215 return true; 215 return false;
216 beginHost = position; 216 beginHost = position;
217 skipWhile<UChar, isNotColonOrSlash>(position, end); 217 skipWhile<UChar, isNotColonOrSlash>(position, end);
218 } 218 }
219 219
220 if (position < end && *position == ':') { 220 if (position < end && *position == ':') {
221 // host:port || scheme://host:port 221 // host:port || scheme://host:port
222 // ^ ^ 222 // ^ ^
223 beginPort = position; 223 beginPort = position;
224 skipUntil<UChar>(position, end, '/'); 224 skipUntil<UChar>(position, end, '/');
225 } 225 }
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 } 476 }
477 477
478 void CSPSourceList::addSourceHash(const ContentSecurityPolicyHashAlgorithm& algo rithm, const DigestValue& hash) 478 void CSPSourceList::addSourceHash(const ContentSecurityPolicyHashAlgorithm& algo rithm, const DigestValue& hash)
479 { 479 {
480 m_hashes.add(CSPHashValue(algorithm, hash)); 480 m_hashes.add(CSPHashValue(algorithm, hash));
481 m_hashAlgorithmsUsed |= algorithm; 481 m_hashAlgorithmsUsed |= algorithm;
482 } 482 }
483 483
484 484
485 } // namespace blink 485 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/security/contentSecurityPolicy/source-list-parsing-07-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698