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

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

Issue 2896833002: Added validation of the policy specified in the 'csp' attribute (Closed)
Patch Set: Code Review suggestions Created 3 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 "core/frame/csp/CSPDirectiveList.h" 5 #include "core/frame/csp/CSPDirectiveList.h"
6 6
7 #include "bindings/core/v8/SourceLocation.h" 7 #include "bindings/core/v8/SourceLocation.h"
8 #include "core/dom/Document.h" 8 #include "core/dom/Document.h"
9 #include "core/dom/SecurityContext.h" 9 #include "core/dom/SecurityContext.h"
10 #include "core/dom/SpaceSplitString.h" 10 #include "core/dom/SpaceSplitString.h"
(...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after
1218 // TODO(mkwst) It seems unlikely that developers would use different 1218 // TODO(mkwst) It seems unlikely that developers would use different
1219 // algorithms for scripts and styles. We may want to combine the 1219 // algorithms for scripts and styles. We may want to combine the
1220 // usesScriptHashAlgorithms() and usesStyleHashAlgorithms. 1220 // usesScriptHashAlgorithms() and usesStyleHashAlgorithms.
1221 policy_->UsesScriptHashAlgorithms(default_src_->HashAlgorithmsUsed()); 1221 policy_->UsesScriptHashAlgorithms(default_src_->HashAlgorithmsUsed());
1222 policy_->UsesStyleHashAlgorithms(default_src_->HashAlgorithmsUsed()); 1222 policy_->UsesStyleHashAlgorithms(default_src_->HashAlgorithmsUsed());
1223 } else if (type == ContentSecurityPolicy::DirectiveType::kScriptSrc) { 1223 } else if (type == ContentSecurityPolicy::DirectiveType::kScriptSrc) {
1224 SetCSPDirective<SourceListDirective>(name, value, script_src_); 1224 SetCSPDirective<SourceListDirective>(name, value, script_src_);
1225 policy_->UsesScriptHashAlgorithms(script_src_->HashAlgorithmsUsed()); 1225 policy_->UsesScriptHashAlgorithms(script_src_->HashAlgorithmsUsed());
1226 } else if (type == ContentSecurityPolicy::DirectiveType::kObjectSrc) { 1226 } else if (type == ContentSecurityPolicy::DirectiveType::kObjectSrc) {
1227 SetCSPDirective<SourceListDirective>(name, value, object_src_); 1227 SetCSPDirective<SourceListDirective>(name, value, object_src_);
1228 } else if (type == 1228 } else if (type == ContentSecurityPolicy::DirectiveType::kFrameAncestors) {
1229
1230 ContentSecurityPolicy::DirectiveType::kFrameAncestors) {
1231 SetCSPDirective<SourceListDirective>(name, value, frame_ancestors_); 1229 SetCSPDirective<SourceListDirective>(name, value, frame_ancestors_);
1232 } else if (type == ContentSecurityPolicy::DirectiveType::kFrameSrc) { 1230 } else if (type == ContentSecurityPolicy::DirectiveType::kFrameSrc) {
1233 SetCSPDirective<SourceListDirective>(name, value, frame_src_); 1231 SetCSPDirective<SourceListDirective>(name, value, frame_src_);
1234 } else if (type == ContentSecurityPolicy::DirectiveType::kImgSrc) { 1232 } else if (type == ContentSecurityPolicy::DirectiveType::kImgSrc) {
1235 SetCSPDirective<SourceListDirective>(name, value, img_src_); 1233 SetCSPDirective<SourceListDirective>(name, value, img_src_);
1236 } else if (type == ContentSecurityPolicy::DirectiveType::kStyleSrc) { 1234 } else if (type == ContentSecurityPolicy::DirectiveType::kStyleSrc) {
1237 SetCSPDirective<SourceListDirective>(name, value, style_src_); 1235 SetCSPDirective<SourceListDirective>(name, value, style_src_);
1238 policy_->UsesStyleHashAlgorithms(style_src_->HashAlgorithmsUsed()); 1236 policy_->UsesStyleHashAlgorithms(style_src_->HashAlgorithmsUsed());
1239 } else if (type == ContentSecurityPolicy::DirectiveType::kFontSrc) { 1237 } else if (type == ContentSecurityPolicy::DirectiveType::kFontSrc) {
1240 SetCSPDirective<SourceListDirective>(name, value, font_src_); 1238 SetCSPDirective<SourceListDirective>(name, value, font_src_);
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
1418 visitor->Trace(img_src_); 1416 visitor->Trace(img_src_);
1419 visitor->Trace(media_src_); 1417 visitor->Trace(media_src_);
1420 visitor->Trace(manifest_src_); 1418 visitor->Trace(manifest_src_);
1421 visitor->Trace(object_src_); 1419 visitor->Trace(object_src_);
1422 visitor->Trace(script_src_); 1420 visitor->Trace(script_src_);
1423 visitor->Trace(style_src_); 1421 visitor->Trace(style_src_);
1424 visitor->Trace(worker_src_); 1422 visitor->Trace(worker_src_);
1425 } 1423 }
1426 1424
1427 } // namespace blink 1425 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698