Sunday 14 May 2023

Problem Statement - Jenkins HTML Pubisher Does Not Display HTML Reports Properly With CSS

By default, Jenkins latest version displays Extent Report or any html report with CSS in normal text, as Extent Report or any html report with CSS contains scripts which pose threat to web security. 

To overcome the problem, we have to override property - hudson.model.DirectoryBrowserSupport.CSP

There are 2 options available - 

1. Pass Parameter While Invoking Jenkins With War File - 

    java -Dhudson.model.DirectoryBrowserSupport.CSP="" -jar jenkins.war

2. Configure Jenkins 

    1.     Go to http://localhost:8080/ using admin credentials

2.     Click on Manage Jenkins link.

3.     Click on Script Console.

4.     Type below Syntax in Script Console and click on Run link.

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


No comments:

Post a Comment