我试图.html在Jenkins中使用HTML发布者插件报告我的文件,但是由于HTML发布者已更新到版本1.10,因此无法发布HTML.
我收到的错误消息:
Blocked script execution in '{mydomain}' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
Uncaught SecurityError: Failed to read the 'localStorage' property from 'Window': The document is sandboxed and lacks the 'allow-same-origin' flag.
Run Code Online (Sandbox Code Playgroud)
我找到了这个文档:https: //wiki.jenkins-ci.org/display/JENKINS/Configuring+Content+Security+Policy
它讲述了CSP.
我用arg运行Jenkins:
/usr/bin/java -Djava.awt.headless=true -Dhudson.model.DirectoryBrowserSupport.CSP=sandbox allow-scripts; style-src 'unsafe-inline' *;script-src 'unsafe-inline' *; -jar /usr/share/jenkins/jenkins.war --webroot=/var/cache/jenkins/war --httpPort=8080 --ajp13Port=-1
Run Code Online (Sandbox Code Playgroud)
但仍然有同样的错误.
我试过args:
1. -Dhudson.model.DirectoryBrowserSupport.CSP="sandbox; default-src 'self';"
2. -Dhudson.model.DirectoryBrowserSupport.CSP=
3. -Dhudson.model.DirectoryBrowserSupport.CSP="sandbox; default-src *;"
4. -Dhudson.model.DirectoryBrowserSupport.CSP="sandbox allow-scripts; default-src *;"
Run Code Online (Sandbox Code Playgroud)
.html位于:
{mydomain}/job/{job_name}/Doc/index.html
Run Code Online (Sandbox Code Playgroud)