Default-src : < em > default-src 是加载诸如 JavaScript、 Images、 CSS、 Fonts、 AJAX 请求、 Frames、 HTML5 Media 等内容的默认策略
Img-src: < em > 定义有效的图像源。
Source Value
“ self”- < em > 允许从相同的源(相同的方案、主机和端口)加载资源。
用法: default-src 'self'
' unsafe-inline ' - Allows use of inline source elements such as style attribute, onclick, or script tag bodies (depends on the context of the source it is applied to) and javascript: URIs.
用法: default-src 'unsafe-inline'
“不安全-eval”-< em > 允许不安全的动态代码计算,如 JavaScript eval ()
用法: default-src 'unsafe-eval'
Data: -< em > 允许通过数据方案加载资源(例如 Base64编码的图像)。
用法: img-src 'self' data:
Please refer more about content security policy 给你
我的特别问题是在 SerenityBDD 报告中缺少图像/css。在执行这些步骤之后,我的 Serenity 报告已经正确地呈现了所有的图像/css,包括执行了 prior的构建到此更改的报告。This solution will also work for any published html-based report.
I know this is old, but this worked great for me, and it is what seems to be recommended in the Jenkins docs. I just set the resource root to a different url served from the same location.
import jenkins.model.Jenkins
import java.util.logging.LogManager
/* Jenkins home directory */
def jenkinsHome = Jenkins.instance.getRootDir().absolutePath
def logger = LogManager.getLogManager().getLogger("")
/* Replace the Key and value with the values you want to set.*/
/* System.setProperty(key, value) */
System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "")
logger.info("Jenkins Startup Script: Successfully updated the system properties value for hudson.model.DirectoryBrowserSupport.CSP . Script location : ${jenkinsHome}/init.groovy.d")