我正在尝试使用Jenkins中的HTML发布器插件报告我的.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.
我找到了这个文档:https://wiki.jenkins-ci.org/display/JENKINS/Configuring+Content+Security+Policy
它介绍了CSP。
我使用以下参数运行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
但仍然得到了同样的错误。
我尝试的参数:
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 *;"
.html文件位于:
{mydomain}/job/{job_name}/Doc/index.html