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

Unified Diff: third_party/WebKit/Source/core/html/HTMLIFrameElement.cpp

Issue 2372563002: Adding Embedding-CSP HTTP header (Closed)
Patch Set: Adding a test in FrameFetchContextModifyRequestTest Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/HTMLIFrameElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLIFrameElement.cpp b/third_party/WebKit/Source/core/html/HTMLIFrameElement.cpp
index f38e945a144e2cd9e5108e8014fc5b2903312d36..e7fd2a683baa7956e1ecdcbf78d73e40ba120d3c 100644
--- a/third_party/WebKit/Source/core/html/HTMLIFrameElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLIFrameElement.cpp
@@ -123,6 +123,14 @@ void HTMLIFrameElement::parseAttribute(const QualifiedName& name,
m_permissions->setValue(value);
} else if (RuntimeEnabledFeatures::embedderCSPEnforcementEnabled() &&
name == cspAttr) {
+ // TODO(amalika): add more robust validation of the value
+ if (!value.getString().containsOnlyASCII()) {
+ m_csp = nullAtom;
+ document().addConsoleMessage(ConsoleMessage::create(
+ OtherMessageSource, ErrorMessageLevel,
+ "'csp' attribute contains non-ASCII characters: " + value));
+ return;
+ }
AtomicString oldCSP = m_csp;
m_csp = value;
if (m_csp != oldCSP)

Powered by Google App Engine
This is Rietveld 408576698