nginx - 拒绝帧 '',因为它违反了以下内容安全策略指令

标签 nginx content-security-policy confluence

我们使用 Confluence Companion 工具在本地编辑来自 Confluence 的文件 (https://confluence.atlassian.com/doc/edit-files-170494553.html),但自从该工具上次更新以来,它不再工作。我发现这是因为我们在 NGINX 中设置的 CSP 指令,但无论我做出什么改变;没有任何效果。

原始 CSP 指令:

add_header Content-Security-Policy "default-src https: wss: blob: goedit: 'unsafe-inline' 'unsafe-eval'; connect-src https://*.atlassian.com 'self' ws:; img-src blob: https: data: 'unsafe-inline' *; font-src https: data:" always;

结果:Refused to frame '' because it violates the following Content Security Policy directive: "default-src https: wss: blob: goedit:". Note that 'frame-src' was not explicitly set, so 'default-src' is used as a fallback.
所以我想,让我们添加 frame-src;
add_header Content-Security-Policy "default-src https: wss: blob: goedit: 'unsafe-inline' 'unsafe-eval'; connect-src https://*.atlassian.com 'self' ws:; frame-src 'self'; img-src blob: https: data: 'unsafe-inline' *; font-src https: data:" always;

但现在它报告了;
Refused to frame '' because it violates the following Content Security Policy directive: "frame-src 'self'".

有点迷失在这里,首先为什么它加载....什么都没有?只是'',我希望那里有一个网站或其他东西,但无论我对 frame-src 进行什么更改,它都会一直提示。

我尝试了什么:
frame-src 'self';
frame-src '*';
frame-src '';
frame-src 'self' data:;
frame-src '*.mydomain.com';
frame-src 'none';

甚至尝试通过 X-FRAME-OPTIONS 允许所有帧以及添加帧祖先并以各种方式组合上述所有内容,但结果是相同的。

非常感谢帮助。

谢谢!

最佳答案

Confluence 7.3+ 使用前缀为 atlassian-companion: 的自定义协议(protocol)启动 Companion .这是使用隐藏的 iframe 构建的,以防止页面重定向。

因此,要解决此问题,请添加atlassian-companion:给您的default-srcframe-src您的内容安全政策中的排除项。例如:frame-src atlassian-companion:; .

关于nginx - 拒绝帧 '',因为它违反了以下内容安全策略指令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60635863/

相关文章:

google-chrome - 使用内容安全策略> 插件类型在 chrome 中打开嵌入在 iframe 中的 PDF

github - 将 Confluence 迁移到 Github wiki (Gollum)

nginx 将文件类型传递给后端服务器

ssl - 使用多个客户端证书的 nginx 客户端身份验证

php - Nginx Docker容器(作为Laradock的一部分)返回 'ERR_CONNECTION_CLOSED'

nginx - Nginx权限问题(404)

javascript - 我的脚本被一些移动运营商内联 - 如何处理?

javascript - 内容安全策略是否阻止书签?

ubuntu - Confluence 在 ubuntu EC2 上运行时给出奇怪的异常 "Invalid file name for use with -Xloggc"

linux - vmlinuz 进程在 100% CPU 上运行