Cordova Content Security Policy frame-src error - html

Refused to frame '' because it violates the following Content Security Policy directive: "default-src *". Note that 'frame-src' was not explicitly set, so 'default-src' is used as a fallback.
I added "wkwebview" plugin for ios. But then I get this error. I don't have an iframe in my code. an iframe is automatically created. From "gap://ready".
Error:
can you help me please

Related

how to fix error " Refused to execute inline script because it violates the following Content Security Policy directive:

i want using iframe in html but i got this error:
Refused to execute inline script because it violates the following
Content Security Policy directive: "script-src 'unsafe-eval' 'self'".
Either the 'unsafe-inline' keyword, a hash
('sha256-P5polb1UreUSOe5V/Pv7tc+yeZuJXiOi/3fqhGsU7BE='), or a nonce
('nonce-...') is required to enable inline execution.
my code :
<iframe src="test.com" height="200" width="300" title="Iframe Example"></iframe>
how can i fix this error
thanks inadvance
Iframe it has nothing to do with it, you have an inline script like <script>...</script> in the HTML code. Therefore you have opts:
to add 'unsafe-inline' into script-src directive (unsafe way)
to use 'nonce-value'
to use 'hash-value' 'sha256-P5polb1UreUSOe5V/Pv7tc+yeZuJXiOi/3fqhGsU7BE='
move inline script to external file, and it will fall under 'self' token allowance.

Chrome browser not allowing iframe source to load for Webchat url

I have registered a bot and was working fine till yesterday. All of a sudden my chrome browser refused to load my webchat control of MS Botframework. When i checked the console it throws me the following policies are restricting the iframe from loading url. I tried adding meta-tags but didn't helped me.
Refused to frame 'https://webchat.botframework.com/embed/DiPA_BOT?s=xxxxxxxxxxxxxxxx' because it violates the following Content Security Policy directive: "default-src 'self' 'unsafe-eval' 'unsafe-inline' *.mydomain.com". Note that 'frame-src' was not explicitly set, so 'default-src' is used as a fallback.
Also this
botchat.js:34449 Refused to connect to 'https://directline.botframework.com/v3/directline/conversations' because it violates the following Content Security Policy directive: "default-src 'self' 'unsafe-eval' 'unsafe-inline' *.accenture.com". Note that 'connect-src' was not explicitly set, so 'default-src' is used as a fallback.
I found the issue why chrome is refused to frame/load directline call and am posting here, may it help for someone like me.
In my server iis,In Http headers section, i saw a header as Conten-Security-Policy. After disabled it, my Bot calls works fine.

images from imgur.com is not displaying on website

I am using simple html tag to display images from imgur.com:
<img alt="Modern Dashboard Design" src="http://i.imgur.com/yst7lV9.png?1" style="height:550px; width:1024px" />
this was working few days back, but now it is not showing. Image is displaying on jsfiddle,but not displaying on this page:
http://www.ucom.my/p/admin-page-for-website-50
When you view the page source, you will find img tags.
What might be the reason?
Content Security Policy: The page’s settings blocked the loading of a resource at http://i.imgur.com/2qEeCDA.png (“default-src http://www.ucom.my”).
Content Security Policy: The page’s settings blocked the loading of a resource at http://i.imgur.com/yst7lV9.png?1 (“default-src http://www.ucom.my”).
Content Security Policy: The page’s settings blocked the loading of a resource at http://i.imgur.com/GAXEkpu.jpg (“default-src http://www.ucom.my”).
Content Security Policy: The page’s settings blocked the loading of a resource at self (“default-src http://www.ucom.my”).
This can be seen when opening the Firebug console.
You have this in your head:
<meta http-equiv="Content-Security-Policy" content="default-src 'self'">
This means you have deliberately blocked all requests to imgur or anywhere else. Change it to this:
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; img-src example.com;">
Or just remove it entirely.
A quick look in your console tells me you have a LOAD of security errors.
Refused to load the image 'http://i.imgur.com/GAXEkpu.jpg' because it
violates the following Content Security Policy directive: "default-src
'self'". Note that 'img-src' was not explicitly set, so 'default-src'
is used as a fallback.
And this happens because:
<meta http-equiv="Content-Security-Policy" content="default-src 'self'">
this line of code exists which disallows content from foreign sources.
Open your browser's developer tools. Look at the console. Read the error messages.
Refused to load the image 'http://i.imgur.com/GAXEkpu.jpg' because it violates the following Content Security Policy directive: "default-src 'self'". Note that 'img-src' was not explicitly set, so 'default-src' is used as a fallback.
You've included:
<meta http-equiv="Content-Security-Policy" content="default-src 'self'">
in your page, which bans the use of <img> elements with a src on a different domain.
Have a look to your browser inspector...
It says:
[Error] Refused to load http://i.imgur.com/2qEeCDA.png because it appears in neither the img-src directive nor the default-src directive of the Content Security Policy.
[Error] Refused to apply a stylesheet because its hash, its nonce, or 'unsafe-inline' appears in neither the style-src directive nor the default-src directive of the Content Security Policy. (admin-page-for-website-50, line 87)
[Error] Refused to load http://i.imgur.com/yst7lV9.png?1 because it appears in neither the img-src directive nor the default-src directive of the Content Security Policy.
[Error] Refused to apply a stylesheet because its hash, its nonce, or 'unsafe-inline' appears in neither the style-src directive nor the default-src directive of the Content Security Policy. (admin-page-for-website-50, line 89)
[Error] Refused to load http://i.imgur.com/GAXEkpu.jpg because it appears in neither the img-src directive nor the default-src directive of the Content Security Policy.

HTML iFrame doesn't work

I am trying to embed a website onto another website using the following code:
<iframe width="100%" height="100%" src="http://www.petarvasilev.com/"></iframe>
this fails I get the following error in the console
Refused to frame 'http://www.petarvasilev.com/' because it violates the following Content Security Policy directive: "default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'". Note that 'frame-src' was not explicitly set, so 'default-src' is used as a fallback.
Here is a JsFiddle to try it out.
I checked the X-Frame-Options header and my site isn't sending one which leaves me oblivious as to why it doesn't work. Any help appreciated : )
The error message clearly says:
Note that 'frame-src' was not explicitly set, so 'default-src' is used as a fallback.
So perhaps change 'src' to 'frame-src'?
And please put your code in a jsfiddle (or pastebin or whatever), and provide a link.

Chrome app content security policy issue

I'm trying to build a chrome app that embeds Youtube content but facing this error while using some scripts :
"Refused to load the script 'https://www.youtube.com/iframe_api' because it violates the following Content Security Policy directive: "default-src 'self' chrome-extension-resource:". Note that 'script-src' was not explicitly set, so 'default-src' is used as a fallback."
I've followed the documentation as long i tried to look around the web and found out i needed to loosen the CSP. Here is my manifest.json
{
...
"permissions": ["https://*.youtube.com"],
"content_security_policy": "script-src 'self' https://*.youtube.com; object-src 'self'"
}
but i still have the same error. What am i doing wrong?
You cannot override CSP for apps. The reference you found was for extensions.
Your options are limited to <webview> embedding and sandboxing.