CSS formatting getting stripped out when viewing on jenkins

0 votes
I’m facing a weird problem with my Jenkins HTML publisher plugin. I have a report where I’ve done all fancy css formatting and I’m unable to view it on Jenkins. If I download the report on my local and view it, its seen perfectly fine(with all formatting).

How am I supposed to solve it.
Aug 14, 2018 in DevOps & Agile by Hannah
• 14,070 points
147 views

1 answer to this question.

0 votes

CSS is stripped out because of the Content Security Policy in Jenkins.

The default rule is set to:

sandbox; default-src 'none'; img-src 'self'; style-src 'self';

This rule set results in the following:

  • No JavaScript allowed at all
  • No plugins (object/embed) allowed
  • No inline CSS, or CSS from other sites allowed
  • No images from other sites allowed
  • No frames allowed
  • No web fonts allowed
  • No XHR/AJAX allowed, etc.

To relax this rule, go to Manage Jenkins->Script console and type in the following command:

System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "")

and Press Run. If you see the output as 'Result:' below "Result" header then the protection disabled. Re-Run your build and you can see that the new HTML files archived will have the CSS enabled.

answered Aug 14, 2018 by Kalgi
• 40,460 points

Related Questions In DevOps & Agile

0 votes
1 answer

What OS is Jenkins installed on Azure Virtual Machine?

Under Managed Jenkins there's a section called ...READ MORE

answered Apr 4, 2018 in DevOps & Agile by DareDev
• 6,810 points
39 views
0 votes
2 answers

Unable to use jenkins to run oracle script on remote DB

add ORACLE_HOME  in jenkins global variable. READ MORE

answered Mar 26 in DevOps & Agile by hal
1,281 views
0 votes
2 answers
0 votes
1 answer
0 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 56,540 points
156 views
+13 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,380 points
152 views
+6 votes
5 answers

can't remove SSIS variables using remove method on PowerShell

you're missing the additional $environment.Alter() after your ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by ajs3033
• 7,280 points
84 views