Issue
I tried to add this in Jenkins Script Console, but it didn't help:
"-Dhudson.model.DirectoryBrowserSupport.CSP=default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline';"
How to do this? Or what is wrong?
Solution
You posted the start parameter for java. If you would like to test it inside the console try this:
System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline';")
If you want to change the property for every start, you can add:
-Dhudson.model.DirectoryBrowserSupport.CSP="default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline';"
to your start parameter, so that it might look like:
java -Dhudson.model.DirectoryBrowserSupport.CSP="default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline';" -jar jenkins.war
If you need further informations, you can take a look at JENKINS Configuring Content Security Policy
Answered By - S.Spieker
Answer Checked By - Senaida (JavaFixing Volunteer)