Bug 92649 - [Qt] REGRESSION http/tests/security/contentSecurityPolicy/object-src-none-blocked.html fails after r123978
Summary: [Qt] REGRESSION http/tests/security/contentSecurityPolicy/object-src-none-blo...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Mike West
URL:
Keywords: Qt, QtTriaged
: 71906 77556 91379 (view as bug list)
Depends on:
Blocks: 79666 92478 93138 93178
  Show dependency treegraph
 
Reported: 2012-07-30 07:57 PDT by Zoltan Arvai
Modified: 2012-08-04 15:20 PDT (History)
12 users (show)

See Also:


Attachments
Patch (10.39 KB, patch)
2012-08-03 06:49 PDT, Mike West
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Zoltan Arvai 2012-07-30 07:57:43 PDT
http/tests/security/contentSecurityPolicy/object-src-none-blocked.html fails after r123978

--- /ramdisk/qt-linux-release/build/layout-test-results/http/tests/security/contentSecurityPolicy/object-src-none-blocked-expected.txt 
+++ /ramdisk/qt-linux-release/build/layout-test-results/http/tests/security/contentSecurityPolicy/object-src-none-blocked-actual.txt 
@@ -1,3 +1,5 @@
+CONSOLE MESSAGE: Refused to load the object 'data:application/x-webkit-test-netscape,logifloaded' because it violates the following Content Security Policy directive: "object-src 'none'".
+
 CONSOLE MESSAGE: Refused to load the object 'data:application/x-webkit-test-netscape,logifloaded' because it violates the following Content Security Policy directive: "object-src 'none'".
Comment 1 Mike West 2012-07-30 08:01:51 PDT
The diff looks correct, sorry for not checking the other ports before landing. I'll fix it tonight when I'm back in front of a computer.
Comment 2 Csaba Osztrogonác 2012-07-30 08:18:38 PDT
Why r123978 caused this duplicated console message?
Comment 3 Zoltan Arvai 2012-07-30 08:24:35 PDT
Problem exist on Qt5, too. 

http/tests/security/contentSecurityPolicy/object-src-none-blocked.html test makes http/tests/security/xss-DENIED-xsl-document-securityOrigin.xml fail after the commit r123978. Before this commit it had no problem with "logifloaded".

--- /ramdisk/qt-linux-release/build/layout-test-results/http/tests/security/xss-DENIED-xsl-document-securityOrigin-expected.txt 
+++ /ramdisk/qt-linux-release/build/layout-test-results/http/tests/security/xss-DENIED-xsl-document-securityOrigin-actual.txt 
@@ -1,3 +1,5 @@
+CONSOLE MESSAGE: Refused to load the object 'data:application/x-webkit-test-netscape,logifloaded' because it violates the following Content Security Policy directive: "object-src 'none'".
+
 CONSOLE MESSAGE: Unsafe JavaScript attempt to access frame with URL http://localhost:8080/security/resources/innocent-victim.html from frame with URL about:blank. Domains, protocols and ports must match.
 
-This test passes if it doesn't alert the contents of innocent-victim.html.  
+This test passes if it doesn't alert the contents of innocent-victim.html.
Comment 4 Zoltan Arvai 2012-07-30 08:51:17 PDT
Test skipped on Qt in http://trac.webkit.org/changeset/124030.
Please unskip it with the proper fix.
Comment 5 Mike West 2012-07-31 08:55:22 PDT
(In reply to comment #2)
> Why r123978 caused this duplicated console message?

I spoke too quickly; I didn't see that the console message was being duplicated. That diff makes no sense.
Comment 6 Csaba Osztrogonác 2012-07-31 09:54:24 PDT
Great, skipping a test made another one fail, but only on WK2:

--- /home/webkitbuildbot/slaves/release64bitWebKit2_EC2/buildslave/qt-linux-64-release-webkit2/build/layout-test-results/http/tests/security/contentSecurityPolicy/object-src-no-url-blocked-expected.txt
+++ /home/webkitbuildbot/slaves/release64bitWebKit2_EC2/buildslave/qt-linux-64-release-webkit2/build/layout-test-results/http/tests/security/contentSecurityPolicy/object-src-no-url-blocked-actual.txt
@@ -1,3 +1,5 @@
+CONSOLE MESSAGE: Refused to load the object '' because it violates the following Content Security Policy directive: "object-src 'none'".
+
 CONSOLE MESSAGE: Refused to load the object '' because it violates the following Content Security Policy directive: "object-src 'none'".
 
 This test passes if there is a console message saying the plugin was blocked.
Comment 7 Mike West 2012-08-02 13:34:42 PDT
Merging 92963 into this bug.

Adam suggested that async console logs from one test might be leaking into the next. This could certainly be the case, given that plugin loading is wonky. I'll post a patch in a moment that adds delays and see how it goes. If it fixes the issues, I'll unskip the tests on the various ports.
Comment 8 Mike West 2012-08-02 13:35:41 PDT
*** Bug 92963 has been marked as a duplicate of this bug. ***
Comment 9 Mike West 2012-08-03 06:49:23 PDT
Created attachment 156356 [details]
Patch
Comment 10 Mike West 2012-08-03 06:52:59 PDT
This is a bit of a mess. Console messages are leaking into the next test, partially because we're generating more messages than we should when blocking plugins via Content Security Policy.

The attached patch adds a new PluginUnavailabilityReason, and marks the plugin element's renderer as unavailable when CSP blocks the plugin. This should prevent additional console messages from being generated, and works in my local testing (NRWT, running each test in the `security/contentSecurityPolicy` directory 20 times).

WDYT, Jochen and Adam?
Comment 11 jochen 2012-08-03 06:59:00 PDT
Comment on attachment 156356 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=156356&action=review

> Source/WebCore/loader/SubframeLoader.cpp:-130
> -            return false;

I assume you removed this check because you don't have a renderer yet at this point?

Are there code paths that go through requestPlugin but never loadPlugin?
Comment 12 Mike West 2012-08-03 07:06:47 PDT
Comment on attachment 156356 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=156356&action=review

>> Source/WebCore/loader/SubframeLoader.cpp:-130
>> -            return false;
> 
> I assume you removed this check because you don't have a renderer yet at this point?
> 
> Are there code paths that go through requestPlugin but never loadPlugin?

Right. Since someone already called out the dependence on renderer in loadPlugin as an issue, I decided that introducing it in another method would be a bad idea.

loadPlugin and requestPlugin are both private methods of SubframeLoader, and so far as I can tell, loadPlugin is only called inside SubframeLoader from requestPlugin. Removing this check here seems safe.
Comment 13 Mike West 2012-08-03 08:59:51 PDT
*** Bug 92956 has been marked as a duplicate of this bug. ***
Comment 14 Mike West 2012-08-03 09:01:17 PDT
*** Bug 91379 has been marked as a duplicate of this bug. ***
Comment 15 Adam Barth 2012-08-03 09:14:07 PDT
Comment on attachment 156356 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=156356&action=review

>>> Source/WebCore/loader/SubframeLoader.cpp:-130
>>> -            return false;
>> 
>> I assume you removed this check because you don't have a renderer yet at this point?
>> 
>> Are there code paths that go through requestPlugin but never loadPlugin?
> 
> Right. Since someone already called out the dependence on renderer in loadPlugin as an issue, I decided that introducing it in another method would be a bad idea.
> 
> loadPlugin and requestPlugin are both private methods of SubframeLoader, and so far as I can tell, loadPlugin is only called inside SubframeLoader from requestPlugin. Removing this check here seems safe.

Is the isSandboxed(SandboxPlugins) needed?  Should we add an ASSERT?
Comment 16 Mike West 2012-08-03 09:26:26 PDT
(In reply to comment #15)
> (From update of attachment 156356 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=156356&action=review
> 
> >>> Source/WebCore/loader/SubframeLoader.cpp:-130
> >>> -            return false;
> >> 
> >> I assume you removed this check because you don't have a renderer yet at this point?
> >> 
> >> Are there code paths that go through requestPlugin but never loadPlugin?
> > 
> > Right. Since someone already called out the dependence on renderer in loadPlugin as an issue, I decided that introducing it in another method would be a bad idea.
> > 
> > loadPlugin and requestPlugin are both private methods of SubframeLoader, and so far as I can tell, loadPlugin is only called inside SubframeLoader from requestPlugin. Removing this check here seems safe.
> 
> Is the isSandboxed(SandboxPlugins) needed?  Should we add an ASSERT?

I don't see another check for SandboxPlugins in SubframeLoader or in HTML{Object,Embed}Element. We could move that check to loadPlugin if you'd like?

Moving some of these check out into HTMLXXXElement might very well make sense. I'm happy to do that, but I'd suggest doing it in a separate patch, as it's cleanup that's somewhat tangential to this bug.
Comment 17 Adam Barth 2012-08-03 10:19:32 PDT
Comment on attachment 156356 [details]
Patch

Ok.  In general, these two checks should be right next to each other since they're doing very similar things, but we can clean that up in a later patch.
Comment 18 Mike West 2012-08-03 10:29:21 PDT
Comment on attachment 156356 [details]
Patch

I've filed a bug to follow up on the cleanup.  Would you mind CQing this in the meantime?
Comment 19 Mike West 2012-08-03 10:30:39 PDT
(In reply to comment #18)
> (From update of attachment 156356 [details])
> I've filed a bug to follow up on the cleanup.  Would you mind CQing this in the meantime?

web.it/93138
Comment 20 Adam Barth 2012-08-03 10:32:11 PDT
boom
Comment 21 WebKit Review Bot 2012-08-03 12:14:26 PDT
Comment on attachment 156356 [details]
Patch

Clearing flags on attachment: 156356

Committed r124636: <http://trac.webkit.org/changeset/124636>
Comment 22 WebKit Review Bot 2012-08-03 12:14:33 PDT
All reviewed patches have been landed.  Closing bug.
Comment 23 Mike West 2012-08-04 15:18:38 PDT
*** Bug 77556 has been marked as a duplicate of this bug. ***
Comment 24 Mike West 2012-08-04 15:20:19 PDT
*** Bug 71906 has been marked as a duplicate of this bug. ***