If I open any .html file that generated by Robot Framework and try to convert it in any other format(for example, docx formate) using either any python code or inbuilt command l
The configuration change persists for me with Jenkins 2.235.2 installed via yum on CentOS 7 by placing the following content in a new file at $JENKINS_ROOT/init.groovy
, changing ownership of the file to the jenkins user, and then restarting Jenkins with service jenkins restart
import jenkins.model.Jenkins;
System.setProperty("hudson.model.DirectoryBrowserSupport.CSP","sandbox allow-scripts; default-src 'none'; img-src 'self' data: ; style-src 'self' 'unsafe-inline' data: ; script-src 'self' 'unsafe-inline' 'unsafe-eval' ;");
Please follow these steps to configure content security policies around Jenkins should resolve this issue: 1. Go to Jenkins 2. Click on Manage Jenkins 3.Click on Script Console 4.Enter unset header text shown in content security policies: System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "")
Click Run
The output should just show Result. If you see any thing other than this, that mean content policy is not updated successfully
If you are still facing the issue, please add the error details, what you tried, so we would be able to help you
The easiest thing to do is (if there are no worries on security aspects) also a permanent fix.
open the jenkins.xml file and
add the following
<arguments>-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -Dhudson.model.DirectoryBrowserSupport.CSP="" -jar "%BASE%\jenkins.war" -- httpPort=8080 --webroot="%BASE%\war"</arguments>
restart the jenkins server
rerun your jenkins jobs to see the result files.
If we are using the script console, every time you restart the jenkins server, the changes will be lost.
Answer is explained at Jenkins issue tracking system: https://issues.jenkins-ci.org/browse/JENKINS-32118
For resolve your problem you must :
Copy this into the field
System.setProperty("hudson.model.DirectoryBrowserSupport.CSP","sandbox allow-scripts; default-src 'none'; img-src 'self' data: ; style-src 'self' 'unsafe-inline' data: ; script-src 'self' 'unsafe-inline' 'unsafe-eval' ;")
Click on Run button.
Execute your Jenkins build.
The accepted answer works for me but is not persistent. To make it persistent, modify the file /etc/default/jenkins
and after JAVA_ARGS
line, add the following line:
JAVA_ARGS="$JAVA_ARGS -Dhudson.model.DirectoryBrowserSupport.CSP=\"sandbox allow-scripts; default-src 'none'; img-src 'self' data: ; style-src 'self' 'unsafe-inline' data: ; script-src 'self' 'unsafe-inline' 'unsafe-eval' ;\""
Change will apply and be persistent after reboot
We used to face same issue, however since we did not have access to jenkins, we could do it at client side be installing CSP plugin on chrome and enabling the plugin.