Title: [197038] trunk
Revision
197038
Author
dba...@webkit.org
Date
2016-02-24 10:51:58 -0800 (Wed, 24 Feb 2016)

Log Message

CSP: Enable plugin-types directive by default
https://bugs.webkit.org/show_bug.cgi?id=154420
<rdar://problem/24730322>

Reviewed by Brent Fulgham.

Source/WebCore:

* page/csp/ContentSecurityPolicyDirectiveList.cpp:
(WebCore::isExperimentalDirectiveName): Move plugin-types from the directives considered
experimental to...
(WebCore::isCSPDirectiveName): ...the list of standard directives.
(WebCore::ContentSecurityPolicyDirectiveList::addDirective): Move logic to parse the plugin-types
directive outside the ENABLE(CSP_NEXT) macro guarded section/experimental feature runtime flag.

LayoutTests:

* TestExpectations: Mark http/tests/security/contentSecurityPolicy/1.1/plugintypes*.html tests as PASS so that we run them.
* http/tests/security/contentSecurityPolicy/1.1/plugintypes-invalid-expected.txt: Update expected result.
* http/tests/security/contentSecurityPolicy/1.1/plugintypes-invalid.html: Call runTests() following changes to multiple-iframe-plugin-test.js.
Also add closing tags for <body> and <html> to make the document well-formed.
* http/tests/security/contentSecurityPolicy/1.1/plugintypes-mismatched-data.html: Substitute "Content-Security-Policy" for "X-WebKit-CSP";
no behavior change.
* http/tests/security/contentSecurityPolicy/1.1/plugintypes-mismatched-url.html: Ditto.
* http/tests/security/contentSecurityPolicy/1.1/plugintypes-notype-data.html: Ditto.
* http/tests/security/contentSecurityPolicy/1.1/plugintypes-notype-url-expected.txt: Update expected result.
* http/tests/security/contentSecurityPolicy/1.1/plugintypes-notype-url.html: Substitute "Content-Security-Policy" for "X-WebKit-CSP";
no behavior change.
* http/tests/security/contentSecurityPolicy/1.1/plugintypes-nourl-allowed.html: Ditto.
* http/tests/security/contentSecurityPolicy/1.1/plugintypes-nourl-blocked.html: Ditto.
* http/tests/security/contentSecurityPolicy/1.1/plugintypes-url-01.html: Call runTests() following changes to multiple-iframe-plugin-test.js.
Also add closing tags for <body> and <html> to make the document well-formed.
* http/tests/security/contentSecurityPolicy/1.1/plugintypes-url-02.html: Ditto.
* http/tests/security/contentSecurityPolicy/resources/echo-object-data.pl: Remove logic to support Content Security Policy header X-WebKit-CSP
as it is sufficient to make use of the standardized header Content-Security-Policy.
* http/tests/security/contentSecurityPolicy/resources/multiple-iframe-plugin-test.js: Simplify code now that we do not pass query string parameter
experimental to script echo-object-data.pl.
(runTests): Runs all the sub-tests.
(runNextTest.iframe.onload): Formerly named testImpl.iframe.onload.
(runNextTest): Formerly named testImpl. Runs the next sub-test.
(testExperimentalPolicy): Deleted.
(test): Deleted.
(testImpl.iframe.onload): Deleted.
(testImpl): Deleted.
(finishTesting): Deleted.
* http/tests/security/contentSecurityPolicy/source-list-parsing-no-semicolon-expected.txt: Update expected result based on change to test (below).
* http/tests/security/contentSecurityPolicy/source-list-parsing-no-semicolon.html: Modified to test that we emit
a console warning when plugin-types is used as a source _expression_.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (197037 => 197038)


--- trunk/LayoutTests/ChangeLog	2016-02-24 18:49:45 UTC (rev 197037)
+++ trunk/LayoutTests/ChangeLog	2016-02-24 18:51:58 UTC (rev 197038)
@@ -1,3 +1,43 @@
+2016-02-24  Daniel Bates  <daba...@apple.com>
+
+        CSP: Enable plugin-types directive by default
+        https://bugs.webkit.org/show_bug.cgi?id=154420
+        <rdar://problem/24730322>
+
+        Reviewed by Brent Fulgham.
+
+        * TestExpectations: Mark http/tests/security/contentSecurityPolicy/1.1/plugintypes*.html tests as PASS so that we run them.
+        * http/tests/security/contentSecurityPolicy/1.1/plugintypes-invalid-expected.txt: Update expected result.
+        * http/tests/security/contentSecurityPolicy/1.1/plugintypes-invalid.html: Call runTests() following changes to multiple-iframe-plugin-test.js.
+        Also add closing tags for <body> and <html> to make the document well-formed.
+        * http/tests/security/contentSecurityPolicy/1.1/plugintypes-mismatched-data.html: Substitute "Content-Security-Policy" for "X-WebKit-CSP";
+        no behavior change.
+        * http/tests/security/contentSecurityPolicy/1.1/plugintypes-mismatched-url.html: Ditto.
+        * http/tests/security/contentSecurityPolicy/1.1/plugintypes-notype-data.html: Ditto.
+        * http/tests/security/contentSecurityPolicy/1.1/plugintypes-notype-url-expected.txt: Update expected result.
+        * http/tests/security/contentSecurityPolicy/1.1/plugintypes-notype-url.html: Substitute "Content-Security-Policy" for "X-WebKit-CSP";
+        no behavior change.
+        * http/tests/security/contentSecurityPolicy/1.1/plugintypes-nourl-allowed.html: Ditto.
+        * http/tests/security/contentSecurityPolicy/1.1/plugintypes-nourl-blocked.html: Ditto.
+        * http/tests/security/contentSecurityPolicy/1.1/plugintypes-url-01.html: Call runTests() following changes to multiple-iframe-plugin-test.js.
+        Also add closing tags for <body> and <html> to make the document well-formed.
+        * http/tests/security/contentSecurityPolicy/1.1/plugintypes-url-02.html: Ditto.
+        * http/tests/security/contentSecurityPolicy/resources/echo-object-data.pl: Remove logic to support Content Security Policy header X-WebKit-CSP
+        as it is sufficient to make use of the standardized header Content-Security-Policy.
+        * http/tests/security/contentSecurityPolicy/resources/multiple-iframe-plugin-test.js: Simplify code now that we do not pass query string parameter
+        experimental to script echo-object-data.pl.
+        (runTests): Runs all the sub-tests.
+        (runNextTest.iframe.onload): Formerly named testImpl.iframe.onload.
+        (runNextTest): Formerly named testImpl. Runs the next sub-test.
+        (testExperimentalPolicy): Deleted.
+        (test): Deleted.
+        (testImpl.iframe.onload): Deleted.
+        (testImpl): Deleted.
+        (finishTesting): Deleted.
+        * http/tests/security/contentSecurityPolicy/source-list-parsing-no-semicolon-expected.txt: Update expected result based on change to test (below).
+        * http/tests/security/contentSecurityPolicy/source-list-parsing-no-semicolon.html: Modified to test that we emit
+        a console warning when plugin-types is used as a source _expression_.
+
 2016-02-24  Ryan Haddad  <ryanhad...@apple.com>
 
         Rebaseline two W3C tests for ios-simulator after r197014

Modified: trunk/LayoutTests/TestExpectations (197037 => 197038)


--- trunk/LayoutTests/TestExpectations	2016-02-24 18:49:45 UTC (rev 197037)
+++ trunk/LayoutTests/TestExpectations	2016-02-24 18:51:58 UTC (rev 197038)
@@ -817,6 +817,16 @@
 webkit.org/b/154203 http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-overrides-xfo.html
 webkit.org/b/154203 http/tests/security/contentSecurityPolicy/1.1/scripthash-default-src.html
 webkit.org/b/154203 http/tests/security/contentSecurityPolicy/1.1/stylehash-default-src.html
+http/tests/security/contentSecurityPolicy/1.1/plugintypes-affects-child.html [ Pass ]
+http/tests/security/contentSecurityPolicy/1.1/plugintypes-invalid.html [ Pass ]
+http/tests/security/contentSecurityPolicy/1.1/plugintypes-mismatched-data.html [ Pass ]
+http/tests/security/contentSecurityPolicy/1.1/plugintypes-mismatched-url.html [ Pass ]
+http/tests/security/contentSecurityPolicy/1.1/plugintypes-notype-data.html [ Pass ]
+http/tests/security/contentSecurityPolicy/1.1/plugintypes-notype-url.html [ Pass ]
+http/tests/security/contentSecurityPolicy/1.1/plugintypes-nourl-allowed.html [ Pass ]
+http/tests/security/contentSecurityPolicy/1.1/plugintypes-nourl-blocked.html [ Pass ]
+http/tests/security/contentSecurityPolicy/1.1/plugintypes-url-01.html [ Pass ]
+http/tests/security/contentSecurityPolicy/1.1/plugintypes-url-02.html [ Pass ]
 webkit.org/b/111869 http/tests/security/contentSecurityPolicy/eval-blocked-and-sends-report.html
 webkit.org/b/115700 http/tests/security/contentSecurityPolicy/inline-event-handler-blocked-after-injecting-meta.html [ Failure ]
 webkit.org/b/153148 http/tests/security/contentSecurityPolicy/eval-allowed-in-report-only-mode-and-sends-report.html

Modified: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/plugintypes-invalid-expected.txt (197037 => 197038)


--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/plugintypes-invalid-expected.txt	2016-02-24 18:49:45 UTC (rev 197037)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/plugintypes-invalid-expected.txt	2016-02-24 18:51:58 UTC (rev 197038)
@@ -6,6 +6,10 @@
 
 CONSOLE MESSAGE: Refused to load 'data:application/x-webkit-test-netscape,logifloaded' (MIME type 'application/x-webkit-test-netscape') because it violates the following Content Security Policy Directive: 'plugin-types '.
 
+CONSOLE MESSAGE: Invalid plugin type in 'plugin-types' Content Security Policy directive: ''none''.
+
+CONSOLE MESSAGE: Refused to load 'data:application/x-webkit-test-netscape,logifloaded' (MIME type 'application/x-webkit-test-netscape') because it violates the following Content Security Policy Directive: 'plugin-types 'none''.
+
 CONSOLE MESSAGE: Invalid plugin type in 'plugin-types' Content Security Policy directive: 'text'.
 
 CONSOLE MESSAGE: Refused to load 'data:application/x-webkit-test-netscape,logifloaded' (MIME type 'application/x-webkit-test-netscape') because it violates the following Content Security Policy Directive: 'plugin-types text'.
@@ -70,6 +74,11 @@
 --------
 Frame: '<!--framePath //<!--frame7-->-->'
 --------
+
+
+--------
+Frame: '<!--framePath //<!--frame8-->-->'
+--------
 PASS.
 
 

Modified: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/plugintypes-invalid.html (197037 => 197038)


--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/plugintypes-invalid.html	2016-02-24 18:49:45 UTC (rev 197037)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/plugintypes-invalid.html	2016-02-24 18:51:58 UTC (rev 197038)
@@ -16,9 +16,11 @@
 ];
 </script>
 </head>
-<body _onload_="testExperimentalPolicy()">
+<body _onload_="runTests()">
     <p>
         This tests our handling of invalid `plugin-types` CSP directives.
         Consider this test passing if each of the following frames contains
         either "PASS" or no text at all.
     </p>
+</body>
+</html>

Modified: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/plugintypes-mismatched-data.html (197037 => 197038)


--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/plugintypes-mismatched-data.html	2016-02-24 18:49:45 UTC (rev 197037)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/plugintypes-mismatched-data.html	2016-02-24 18:51:58 UTC (rev 197038)
@@ -7,7 +7,7 @@
     testRunner.dumpChildFramesAsText();
 }
 </script>
-<meta http-equiv="X-WebKit-CSP" content="plugin-types application/x-invalid-type">
+<meta http-equiv="Content-Security-Policy" content="plugin-types application/x-invalid-type">
 </head>
 <body>
     This tests that plugin content that doesn't match the declared type doesn't

Modified: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/plugintypes-mismatched-url.html (197037 => 197038)


--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/plugintypes-mismatched-url.html	2016-02-24 18:49:45 UTC (rev 197037)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/plugintypes-mismatched-url.html	2016-02-24 18:51:58 UTC (rev 197038)
@@ -8,7 +8,7 @@
 }
 </script>
 <script src=""
-<meta http-equiv="X-WebKit-CSP" content="plugin-types application/x-invalid-type">
+<meta http-equiv="Content-Security-Policy" content="plugin-types application/x-invalid-type">
 </head>
 <body>
     This tests that plugin content that doesn't match the declared type doesn't

Modified: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/plugintypes-notype-data.html (197037 => 197038)


--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/plugintypes-notype-data.html	2016-02-24 18:49:45 UTC (rev 197037)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/plugintypes-notype-data.html	2016-02-24 18:51:58 UTC (rev 197038)
@@ -11,7 +11,7 @@
     runAfterPluginLoad(null, NotifyDone);
 </script>
 <script src=""
-<meta http-equiv="X-WebKit-CSP" content="plugin-types application/x-invalid-type">
+<meta http-equiv="Content-Security-Policy" content="plugin-types application/x-invalid-type">
 </head>
 <body>
     Given a `plugin-types` directive, plugins have to declare a type explicitly.

Modified: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/plugintypes-notype-url-expected.txt (197037 => 197038)


--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/plugintypes-notype-url-expected.txt	2016-02-24 18:49:45 UTC (rev 197037)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/plugintypes-notype-url-expected.txt	2016-02-24 18:51:58 UTC (rev 197038)
@@ -1,8 +1,3 @@
 CONSOLE MESSAGE: Refused to load 'http://127.0.0.1:8000/plugins/resources/mock-plugin.pl' (MIME type '') because it violates the following Content Security Policy Directive: 'plugin-types application/x-invalid-type'. When enforcing the 'plugin-types' directive, the plugin's media type must be explicitly declared with a 'type' attribute on the containing element (e.g. '<object type="[TYPE GOES HERE]" ...>').
 
 Given a `plugin-types` directive, plugins have to declare a type explicitly. No declared type, no load. This test passes if there's a console message above.  
-
---------
-Frame: '<!--framePath //<!--frame0-->-->'
---------
-

Modified: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/plugintypes-notype-url.html (197037 => 197038)


--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/plugintypes-notype-url.html	2016-02-24 18:49:45 UTC (rev 197037)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/plugintypes-notype-url.html	2016-02-24 18:51:58 UTC (rev 197038)
@@ -7,7 +7,7 @@
     testRunner.dumpChildFramesAsText();
 }
 </script>
-<meta http-equiv="X-WebKit-CSP" content="plugin-types application/x-invalid-type">
+<meta http-equiv="Content-Security-Policy" content="plugin-types application/x-invalid-type">
 </head>
 <body>
     Given a `plugin-types` directive, plugins have to declare a type explicitly.

Modified: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/plugintypes-nourl-allowed.html (197037 => 197038)


--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/plugintypes-nourl-allowed.html	2016-02-24 18:49:45 UTC (rev 197037)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/plugintypes-nourl-allowed.html	2016-02-24 18:51:58 UTC (rev 197038)
@@ -5,7 +5,7 @@
 if (window.testRunner)
     testRunner.dumpAsText();
 </script>
-<meta http-equiv="X-WebKit-CSP" content="plugin-types application/x-webkit-test-netscape">
+<meta http-equiv="Content-Security-Policy" content="plugin-types application/x-webkit-test-netscape">
 </head>
 <body>
 This test passes if there isn't a console message saying the plugin was blocked.

Modified: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/plugintypes-nourl-blocked.html (197037 => 197038)


--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/plugintypes-nourl-blocked.html	2016-02-24 18:49:45 UTC (rev 197037)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/plugintypes-nourl-blocked.html	2016-02-24 18:51:58 UTC (rev 197038)
@@ -8,7 +8,7 @@
 
     runAfterPluginLoad(null, NotifyDone);
 </script>
-<meta http-equiv="X-WebKit-CSP" content="plugin-types text/plain">
+<meta http-equiv="Content-Security-Policy" content="plugin-types text/plain">
 </head>
 <body>
 This test passes if there is a console message saying the plugin was blocked.

Modified: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/plugintypes-url-01.html (197037 => 197038)


--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/plugintypes-url-01.html	2016-02-24 18:49:45 UTC (rev 197037)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/plugintypes-url-01.html	2016-02-24 18:51:58 UTC (rev 197038)
@@ -11,9 +11,11 @@
 ];
 </script>
 </head>
-<body _onload_="testExperimentalPolicy()">
+<body _onload_='runTests()'>
     <p>
         This tests our handling of `data:` URLs, given a `plugin-types` CSP
         directive. Consider this test passing if each of the following frames
         contains "PASS" or no text at all, and no console warnings appear above.
     </p>
+</body>
+</html>

Modified: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/plugintypes-url-02.html (197037 => 197038)


--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/plugintypes-url-02.html	2016-02-24 18:49:45 UTC (rev 197037)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/plugintypes-url-02.html	2016-02-24 18:51:58 UTC (rev 197038)
@@ -10,9 +10,11 @@
 ];
 </script>
 </head>
-<body _onload_="testExperimentalPolicy()">
+<body _onload_='runTests()'>
     <p>
         This tests our handling of non-`data:` URLs, given a `plugin-types` CSP
         directive. Consider this test passing if none of the following frames
         contains "FAIL" and four sets of console logs appear above.
     </p>
+</body>
+</html>

Modified: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/resources/echo-object-data.pl (197037 => 197038)


--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/resources/echo-object-data.pl	2016-02-24 18:49:45 UTC (rev 197037)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/resources/echo-object-data.pl	2016-02-24 18:51:58 UTC (rev 197038)
@@ -5,12 +5,7 @@
 my $cgi = new CGI;
 
 print "Content-Type: text/html; charset=UTF-8\n";
-my $experimental = $cgi->param('experimental') || "";
-if ($experimental eq 'true') {
-    print "X-WebKit-CSP: " . $cgi->param('csp') . "\n\n";
-} else {
-    print "Content-Security-Policy: " . $cgi->param('csp') . "\n\n";
-}
+print "Content-Security-Policy: " . $cgi->param('csp') . "\n\n";
 
 print "<!DOCTYPE html>\n";
 print "<html>\n";

Modified: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/resources/multiple-iframe-plugin-test.js (197037 => 197038)


--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/resources/multiple-iframe-plugin-test.js	2016-02-24 18:49:45 UTC (rev 197037)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/resources/multiple-iframe-plugin-test.js	2016-02-24 18:51:58 UTC (rev 197038)
@@ -4,51 +4,30 @@
     testRunner.dumpChildFramesAsText();
 }
 
-function testExperimentalPolicy() {
-    testImpl(true);
+function runTests()
+{
+    runNextTest();
 }
 
-function test() {
-    testImpl(false);
-}
-
-function testImpl(experimental) {
-    if (tests.length === 0)
-        return finishTesting();
-    var baseURL = "/security/contentSecurityPolicy/";
-    var current = tests.shift();
-    var iframe = document.createElement("iframe");
-    iframe.src = "" + "resources/echo-object-data.pl?" +
-                 "experimental=" + (experimental ? "true" : "false") +
-                 "&csp=" + escape(current[1]);
-
-    if (current[0])
-        iframe.src += "&log=PASS.";
-    else
-        iframe.src += "&log=FAIL.";
-
-    if (current[2])
-        iframe.src += "&plugin=" + escape(current[2]);
-    else {
-        iframe.src += "&plugin=data:application/x-webkit-test-netscape,logifloaded";
+function runNextTest()
+{
+    var currentTest = tests.shift();
+    if (!currentTest) {
+        if (window.testRunner)
+            setTimeout("testRunner.notifyDone()", 0);
+        return;
     }
 
-    if (current[3] !== undefined)
-        iframe.src += "&type=" + escape(current[3]);
-    else
-        iframe.src += "&type=application/x-webkit-test-netscape";
-
+    var iframe = document.createElement("iframe");
     iframe._onload_ = function() {
         if (window.internals)
             internals.updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks(iframe);
-        testImpl(experimental);
+        runNextTest();
     };
+    var url = "" + encodeURIComponent(currentTest[1]);
+    url += "&log=" + (currentTest[0] ? "PASS." : "FAIL.");
+    url += "&plugin=" + (currentTest[2] ? encodeURIComponent(currentTest[2]) : "data:application/x-webkit-test-netscape,logifloaded");
+    url += "&type=" + (currentTest[3] !== undefined ? encodeURIComponent(currentTest[3]) : "application/x-webkit-test-netscape");
+    iframe.src = ""
     document.body.appendChild(iframe);
 }
-
-function finishTesting() {
-    if (window.testRunner) {
-        setTimeout("testRunner.notifyDone()", 0);
-    }
-    return true;
-}

Modified: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/source-list-parsing-no-semicolon-expected.txt (197037 => 197038)


--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/source-list-parsing-no-semicolon-expected.txt	2016-02-24 18:49:45 UTC (rev 197037)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/source-list-parsing-no-semicolon-expected.txt	2016-02-24 18:51:58 UTC (rev 197038)
@@ -3,6 +3,7 @@
 CONSOLE MESSAGE: The Content Security Policy directive 'script-src' contains 'style-src' as a source _expression_. Did you mean 'script-src ...; style-src...' (note the semicolon)?
 CONSOLE MESSAGE: The Content Security Policy directive 'script-src' contains 'form-action' as a source _expression_. Did you mean 'script-src ...; form-action...' (note the semicolon)?
 CONSOLE MESSAGE: The Content Security Policy directive 'script-src' contains 'base-uri' as a source _expression_. Did you mean 'script-src ...; base-uri...' (note the semicolon)?
+CONSOLE MESSAGE: The Content Security Policy directive 'script-src' contains 'plugin-types' as a source _expression_. Did you mean 'script-src ...; plugin-types...' (note the semicolon)?
 If a web author forgets a semicolon, we should do our best to warn them that the policy they've defined is probably not what they intended.
 
 

Modified: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/source-list-parsing-no-semicolon.html (197037 => 197038)


--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/source-list-parsing-no-semicolon.html	2016-02-24 18:49:45 UTC (rev 197037)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/source-list-parsing-no-semicolon.html	2016-02-24 18:51:58 UTC (rev 197038)
@@ -5,7 +5,7 @@
 <script>
 var tests = [
     ['yes', 'default-src \'self\' script-src example.com', 'resources/script.js'],
-    ['yes', "script-src 'self' object-src 'self' style-src * form-action 'self' base-uri 'self'", 'resources/script.js'],
+    ['yes', "script-src 'self' object-src 'self' style-src * form-action 'self' base-uri 'self' plugin-types application/x-webkit-test-netscape", 'resources/script.js'],
 ];
 </script>
 </head>

Modified: trunk/Source/WebCore/ChangeLog (197037 => 197038)


--- trunk/Source/WebCore/ChangeLog	2016-02-24 18:49:45 UTC (rev 197037)
+++ trunk/Source/WebCore/ChangeLog	2016-02-24 18:51:58 UTC (rev 197038)
@@ -1,3 +1,18 @@
+2016-02-24  Daniel Bates  <daba...@apple.com>
+
+        CSP: Enable plugin-types directive by default
+        https://bugs.webkit.org/show_bug.cgi?id=154420
+        <rdar://problem/24730322>
+
+        Reviewed by Brent Fulgham.
+
+        * page/csp/ContentSecurityPolicyDirectiveList.cpp:
+        (WebCore::isExperimentalDirectiveName): Move plugin-types from the directives considered
+        experimental to...
+        (WebCore::isCSPDirectiveName): ...the list of standard directives.
+        (WebCore::ContentSecurityPolicyDirectiveList::addDirective): Move logic to parse the plugin-types
+        directive outside the ENABLE(CSP_NEXT) macro guarded section/experimental feature runtime flag.
+
 2016-02-24  Ryan Haddad  <ryanhad...@apple.com>
 
         Speculative fix for ios build.

Modified: trunk/Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.cpp (197037 => 197038)


--- trunk/Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.cpp	2016-02-24 18:49:45 UTC (rev 197037)
+++ trunk/Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.cpp	2016-02-24 18:51:58 UTC (rev 197038)
@@ -59,7 +59,7 @@
 
 static inline bool isExperimentalDirectiveName(const String& name)
 {
-    return equalLettersIgnoringASCIICase(name, pluginTypes) || equalLettersIgnoringASCIICase(name, reflectedXSS);
+    return equalLettersIgnoringASCIICase(name, reflectedXSS);
 }
 
 #else
@@ -82,6 +82,7 @@
         || equalLettersIgnoringASCIICase(name, imgSrc)
         || equalLettersIgnoringASCIICase(name, mediaSrc)
         || equalLettersIgnoringASCIICase(name, objectSrc)
+        || equalLettersIgnoringASCIICase(name, pluginTypes)
         || equalLettersIgnoringASCIICase(name, reportURI)
         || equalLettersIgnoringASCIICase(name, sandbox)
         || equalLettersIgnoringASCIICase(name, scriptSrc)
@@ -602,15 +603,15 @@
         setCSPDirective<ContentSecurityPolicySourceListDirective>(name, value, m_formAction);
     else if (equalLettersIgnoringASCIICase(name, baseURI))
         setCSPDirective<ContentSecurityPolicySourceListDirective>(name, value, m_baseURI);
+    else if (equalLettersIgnoringASCIICase(name, pluginTypes))
+        setCSPDirective<ContentSecurityPolicyMediaListDirective>(name, value, m_pluginTypes);
     else if (equalLettersIgnoringASCIICase(name, sandbox))
         applySandboxPolicy(name, value);
     else if (equalLettersIgnoringASCIICase(name, reportURI))
         parseReportURI(name, value);
 #if ENABLE(CSP_NEXT)
     else if (m_policy.experimentalFeaturesEnabled()) {
-        if (equalLettersIgnoringASCIICase(name, pluginTypes))
-            setCSPDirective<ContentSecurityPolicyMediaListDirective>(name, value, m_pluginTypes);
-        else if (equalLettersIgnoringASCIICase(name, reflectedXSS))
+        if (equalLettersIgnoringASCIICase(name, reflectedXSS))
             parseReflectedXSS(name, value);
         else
             m_policy.reportUnsupportedDirective(name);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to