Skip to content
Advertisement

Jenkins error – Blocked script execution in . because the document’s frame is sandboxed and the ‘allow-scripts’ permission is not set

I’m aware that if we use a iFrame in HTML we’ve to sandbox it & add the ‘allow-scripts’ permission to be true.

But my problem is I don’t have a iFrame at all in my pure Angular JS application. When I run it on my local machine it works fine.

The moment I deploy it to my server, Chrome displays this error message along with the below error:

Refused to load the style ‘bootstrap.min.css’ because it violates the following Content Security Policy directive: “style-src ‘self'”.

Blocked script execution in ‘dashboard.html’ because the document’s frame is sandboxed and the ‘allow-scripts’ permission is not set.

I’m not invoking the page from a 3rd party site or elsewhere which could possibly inject my source & make it appear in a iframe. I inspected the code & I can confirm there are no iframes at all.

BTW, I use a very old version of Chrome (26) and Firefox (10) [Organisational restrictions]. This happens on IE11 as well (Though no error message displayed) the page doesn’t load up.

What could be causing this ? Am I missing anything here ? Any pointers would be greatly appreciated.

Below is a snapshot of what I’m trying to do… Trivial parts trimmed out..

JavaScript

Advertisement

Answer

We were using this content HTML in a Jenkins userContent directory. We recently upgraded to the latest Jenkins 1.625 LTS version & it seems they’ve introduced new Content security policy which adds the below header to the response headers & the browsers simply decline to execute anything like stylesheets / Javascripts.

JavaScript

To get over it, we had to simply remove this header by resetting the below property in Jenkins.

JavaScript

Those who upgrade to Jenkins 1.625 & use the userContent folder might be affected by this change.

For more information refer https://wiki.jenkins-ci.org/display/JENKINS/Configuring+Content+Security+Policy

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement