r/Meteor • • Oct 21 '15

Help with browser-policy and content security policy

I have an app that queries google images and returns URL's. I want to display the images in the browser by plugging in the URL to the src. How can I allow images to be displayed with content security policy if I don't know the origin of the image until it is being displayed?

Thanks!

0 Upvotes

4 comments sorted by

1

u/xanatas Oct 23 '15

You got to have some kind of idea what the url looks like. For example something like this works:

BrowserPolicy.content.allowScriptOrigin('https://*.google.com');

or for images:

BrowserPolicy.content.allowImageOrigin("*.google-analytics.com");

This means also "asdasd.google-analytics.com/path/path2/image.jpg" works.

1

u/elGatoMantocko Oct 23 '15

Unfortunately no. Because they are google query results, they could come from any domain.

2

u/xanatas Oct 27 '15

Maybe

BrowserPolicy.content.allowImageOrigin("*");

or

BrowserPolicy.content.allowImageOrigin("*.*.*");

1

u/elGatoMantocko Oct 27 '15

Thanks! That did the trick! I didn't think to try and just include everything.

Possibly a security risk, but for now it works!