如何使 GET 产品与 Strict CSP 兼容?

What to do to make GWT product Strict CSP Comapatible?

我在 gwt 中制作了一个网络应用程序,CSP Mitigator 说,我有很多 eval 语句和 javascript uri 在 js 中加载,所以我的项目不是 Strict CSP Compatible 。

但我的问题是,我在 java 中编写代码,gwwt 为我制作 js。

我也问过 gwt 社区,但他们说在 gwt 的下一个版本中,将涵盖 csp 合规性。

但到那时,有谁知道,我该如何解决这个漏洞。

符合 csp 标准的 gwt 2.8.2 版本已经发布。

并非完全开箱即用,只是改进了 gwt-2.8.2 中的 CSP 支持。

例如 GWT 编译的 js 包含数据 URL,例如 data:image/gif;base64.. 并且会违反 img-src 'self';

在 CSP 中包含此类 URL 很尴尬。使用 img-src 'self' 数据更糟糕:;因为黑客可以在数据方案中注入任何东西。

这可以在模块 gwt.xml 中关闭。禁止使用数据:URLs

<set-property name="ClientBundle.enableInlining" value="false" />

还有一些悬而未决的 CSP 问题,其中 GWT 代码库仍然使用在 CSP 声明中需要 unsafe-eval 的 eval。

Additionally, this is an issue since it violates CSP, as eval isn't particularly safe, and some sites would like to forbid its use to further protect their data and their users.

https://github.com/gwtproject/gwt/issues/9578