gpt4 book ai didi

Jenkins HTML 发布器插件 : No external links with Jenkins 1. 643

转载 作者:行者123 更新时间:2023-12-02 13:01:29 25 4
gpt4 key购买 nike

我有一份 Jenkins 工作,其中我生成一个 HTML 页面作为构建后步骤,其中包含图像链接( HTML img 标签)。此 HTML 页面由 HTMLPublisher 插件为每个作业发布。

这一直很有效。但由于我已将 Jenkins 更新到 v.1.643,当我单击发布的 HTML 页面时,我只看到一个空白页面。

我尝试了很多东西,发现了以下奇怪的行为:自更新以来,我无法将外部链接嵌入到我发布的 HTML 页面中。如果我从外部位置嵌入图像 (img src="somelocation/xxx.jpg),则该图像将不会显示。

如果我用 Firefox 检查 HTML 页面,我可以看到图像标记呈灰色,就像不可见一样,但事实并非如此。

如果我嵌入一个普通的超链接,指向外部位置,我可以在显示的页面中看到该链接,但是当我点击它时,什么也没有发生。

这就好像 Jenkins 不允许在这种情况下使用外部链接。

请帮帮我:)

谢谢!

编辑:

感谢 Dave Bacher,他给了我正确的提示。查看此页面以了解 Jenkins 的新安全策略。

https://wiki.jenkins-ci.org/display/JENKINS/Configuring+Content+Security+Policy#ConfiguringContentSecurityPolicy-Implementation

您必须放宽规则,以便再次允许嵌入外部图像。

要对其进行测试,只需在脚本控制台中键入以下内容:

System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "sandbox; img-src *;")

这将允许嵌入来自任何外部网站的图像。

如果您在 Ubuntu 上运行 Jenkins 并且想要永久设置此设置,只需编辑文件/etc/default/jenkins。在传递给java的#参数下添加以下行:

JAVA_ARGS="-Dhudson.model.DirectoryBrowserSupport.CSP=\"sandbox; img-src *;\""

最佳答案

您看到的问题可能与最近的 security fixes 有关。请参阅Configuring Content Security Policy wiki page有关如何放宽 Jenkins 配置的详细信息。

The CSP header sent by Jenkins can be modified by setting the system property hudson.model.DirectoryBrowserSupport.CSP:

If its value is the empty string, e.g. java -Dhudson.model.DirectoryBrowserSupport.CSP= -jar jenkins.war then the header will not be sent at all.

(Warning!) This is potentially very unsafe and should only be used after reviewing the overall security setup.

您可以使用 Jenkins Script Console 尝试不同的设置。

此外,正如 wiki 页面所述,请确保您已升级到 HTML Publisher 1.10(或更高版本)。

关于Jenkins HTML 发布器插件 : No external links with Jenkins 1. 643,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34681852/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com