PrimeFaces。 <p:editor> 标签

问题描述 投票:0回答:0

我在我的项目中使用Primefaces 8.0。 我正在尝试按照 here.

中的说明配置内容安全策略

这就是我的配置:

    <context-param>
        <param-name>primefaces.CSP</param-name>
        <param-value>true</param-value>
    </context-param>
    <context-param>
        <param-name>primefaces.CSP_POLICY</param-name>
        <param-value>script-src 'self' https://wchat.freshchat.com</param-value>
    </context-param>

在 Mozilla Firefox 中一切正常。 但在谷歌浏览器中,我收到这些错误消息:

jquery.js.jsf?ln=primefaces&v=8.0:2  Refused to run the JavaScript URL because it violates the following Content Security Policy directive: "script-src 'self' https://wchat.freshchat.com 'unsafe-hashes' 'nonce-MWYzYWZiMTEtNzM0Mi00Mzc1LWI0OTMtZTY3YWU4NTI2NjIx'". Either the 'unsafe-inline' keyword, a hash ('sha256-...'), or a nonce ('nonce-...') is required to enable inline execution.

我注意到这些错误发生在使用PrimeFaces Editor

的页面上

显然问题是

src="javascript:true;
是在渲染 PrimeFaces Editor 时添加的。

请告知如何解决此问题。

jsf primefaces content-security-policy
© www.soinside.com 2019 - 2024. All rights reserved.