Jenkins HTML Publisher插件:允许脚本权限问题 [英] Jenkins HTML Publisher Plugin : allow script permission issue
问题描述
我正在尝试使用Jenkins中的HTML Publisher插件报告我的.html
文件
但是,由于HTML发布者已更新至1.10版,因此无法发布HTML.
I'm trying to report my .html
file with HTML publisher plugin in Jenkins
however,since HTML publisher is updated to version 1.10, can't publish 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
I found this doc: 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
但上面仍然有相同的错误.
but still got same error above.
我尝试了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
推荐答案
您可以尝试使用空白的CSP选项吗?
Can you have a try with a blank CSP option?
/usr/bin/java -Djava.awt.headless=true -Dhudson.model.DirectoryBrowserSupport.CSP= -jar /usr/share/jenkins/jenkins.war --webroot=/var/cache/jenkins/war --httpPort=8080 --ajp13Port=-1
在我的Jenkins实例上,它解决了我的报告问题.
On my Jenkins instance, it solved my reporting issues.
我知道这不是一个安全的选择,但是我没有找到其他解决方案:(
I know it's not a safe option, but I didn't find another solution :(
这篇关于Jenkins HTML Publisher插件:允许脚本权限问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!