【发布时间】:2021-05-13 14:39:44
【问题描述】:
我正在尝试使用 Jenkins 中的 HTML 发布者插件报告我的 .html 文件
但是,由于 HTML Publisher 更新到 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。
我使用 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
但还是遇到了同样的错误。
我尝试了什么 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 *;"
.html 位于:
{mydomain}/job/{job_name}/Doc/index.html
【问题讨论】:
标签: jenkins content-security-policy