Jenkins Use Case: Jenkins Startup Script to set the System Properties

Shashi Bhushan
The DevOps Ship
Published in
3 min readJul 22, 2019

--

Jenkins provides tons of features that can be controlled by system properties such as DirectoryBrowserSupport, ParallelLoad, cacheRefreshPeriod, artifactPermision and many more. If I can elaborate one of these features, lets say DirectoryBroswerSupport, Jenkins 1.625.3 introduced the Content-Security-Policy header to static files served by Jenkins (specifically DirectoryBrowserSupport). This header is set to a very restrictive default set of permissions to protect Jenkins users from malicious HTML/JS files in workspaces, userContent, or archived artifacts. By using such features definitely it will increase security but also restrict some plugins to work efficiently, so its a trade-off you have to make.

So for setting up these values we can easily use the Script Console under manage Jenkins option, and just execute the below code and you will be ready to go.

System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "sandbox; default-src 'self';")

--

--