Bug 92396 - Images loaded via object elements should be governed by the 'object-src' CSP directive.
Summary: Images loaded via object elements should be governed by the 'object-src' CSP ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Daniel Bates
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2012-07-26 10:36 PDT by Mike West
Modified: 2022-02-03 10:42 PST (History)
7 users (show)

See Also:


Attachments
Broken test. (2.19 KB, patch)
2012-07-26 10:42 PDT, Mike West
no flags Details | Formatted Diff | Diff
Patch (4.86 KB, patch)
2012-08-26 03:41 PDT, Mike West
jochen: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mike West 2012-07-26 10:36:13 PDT
The attached test gives results that I don't understand; I think that setting `object-src 'none'` should block the image from being loaded via the `object` tag (see the spec: "It is not required that the consumer of the element's data be a plugin in order for the object-src directive to be enforced. ...").

I'm not sure if the behavior I'm seeing is a bug in my understanding of plugins, or a bug in our CSP implementations (or a bug in my test, I suppose).
Comment 1 Adam Barth 2012-07-26 10:40:31 PDT
It's likely a bug in our implementation.  This is a tricky corner case.
Comment 2 Mike West 2012-07-26 10:42:10 PDT
Created attachment 154685 [details]
Broken test.
Comment 3 Mike West 2012-07-26 10:43:53 PDT
Ok. Then I'll take a look at solving it. At some point. Possibly soon, as this makes it tough to test `plugin-types`.

Any idea where I might want to start looking? :)
Comment 4 Mike West 2012-07-26 10:50:58 PDT
CCing Bernhard and Jochen, who both know things about plugins. :)
Comment 5 Mike West 2012-07-26 10:51:24 PDT
*ahem* Bernhard _and Jochen_.
Comment 6 Mike West 2012-08-26 03:41:31 PDT
Created attachment 160598 [details]
Patch
Comment 7 Mike West 2012-08-26 03:47:05 PDT
The attached patch is a first pass at running image content through CSP even if it's loaded via an object element. I'm not convinced that this is the right place for the check, but I'm not sure where else to put it. ImageLoader seems like the wrong place and anything else is too late. *shrug*

WDYT?
Comment 8 jochen 2012-08-27 04:12:42 PDT
Comment on attachment 160598 [details]
Patch

I believe that this is the wrong place, as this won't catch redirects.

What about adding a callback to ImageLoaderClient to do the CSP checks on redirects?
Comment 9 Mike West 2012-08-27 10:18:43 PDT
(In reply to comment #8)
> (From update of attachment 160598 [details])
> I believe that this is the wrong place, as this won't catch redirects.
> 
> What about adding a callback to ImageLoaderClient to do the CSP checks on redirects?

Hrm. If I'm understanding the layout of things correctly, this would involve switching up some of the CSP checks in CachedResourceLoader::canRequest to call out to the relevant XXXLoaderClient (that is, the various HTMLXXXElement objects), kinda like we did in MainResourceLoader::willSendRequest for 'form-action' a few patches back...

Is that the structure you're thinking of, Jochen?
Comment 10 jochen 2012-08-28 00:07:28 PDT
(In reply to comment #9)
> (In reply to comment #8)
> > (From update of attachment 160598 [details] [details])
> > I believe that this is the wrong place, as this won't catch redirects.
> > 
> > What about adding a callback to ImageLoaderClient to do the CSP checks on redirects?
> 
> Hrm. If I'm understanding the layout of things correctly, this would involve switching up some of the CSP checks in CachedResourceLoader::canRequest to call out to the relevant XXXLoaderClient (that is, the various HTMLXXXElement objects), kinda like we did in MainResourceLoader::willSendRequest for 'form-action' a few patches back...
> 
> Is that the structure you're thinking of, Jochen?

The alternative would be to teach the CachedResourceLoader about images that are loaded via an object tag. Not sure which solution is better.
Comment 11 Mike West 2012-08-28 00:11:51 PDT
(In reply to comment #10)
> (In reply to comment #9)
> > (In reply to comment #8)
> > > (From update of attachment 160598 [details] [details] [details])
> > > I believe that this is the wrong place, as this won't catch redirects.
> > > 
> > > What about adding a callback to ImageLoaderClient to do the CSP checks on redirects?
> > 
> > Hrm. If I'm understanding the layout of things correctly, this would involve switching up some of the CSP checks in CachedResourceLoader::canRequest to call out to the relevant XXXLoaderClient (that is, the various HTMLXXXElement objects), kinda like we did in MainResourceLoader::willSendRequest for 'form-action' a few patches back...
> > 
> > Is that the structure you're thinking of, Jochen?
> 
> The alternative would be to teach the CachedResourceLoader about images that are loaded via an object tag. Not sure which solution is better.

Naah, CachedResourceLoader is complicated enough already. :)

I'll try to fiddle around with the HTMLXXXElement structure sometime this week. Thanks!
Comment 12 Mike West 2013-02-07 11:00:44 PST
Unassigning myself; let's be realistic about what I'm actually working on. :/
Comment 13 Radar WebKit Bug Importer 2016-02-18 15:26:55 PST
<rdar://problem/24730219>
Comment 14 Patrick Griffis 2022-02-03 10:42:59 PST
Fixed by r288792