gpt4 book ai didi

google-chrome-extension - Firebase + Chrome内容安全策略设置?

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

我正在尝试在Chrome扩展程序后台页面中使用Firebase,但是看起来它正在执行内联脚本,出于安全考虑,不允许这样做。

我目前将CSP设置为:

{"content_security_policy": 
"script-src 'self' https://cdn.firebase.com https://<my-subdomain>.firebaseio.com; object-src 'self'"}

我可以加载初始的Firebase脚本,但是在调用新的Firebase('my-firebase-url')时,出现以下错误:

Refused to execute inline script because it violates the following Content Security Policy directive: ". Uncaught ReferenceError: pRTLPCB is not defined



Firebase团队(或任何人)可以提供任何解决方法或建议,或者可以解释为什么要内联执行脚本?

最佳答案

在提出问题时,有一个错误使Firebase无法在Chrome扩展程序中运行,但现在已修复。

正确的CSP是:

"content_security_policy": "script-src 'self' https://cdn.firebase.com https://*.firebaseio.com; object-src 'self'"

(请注意,域中的通配符很重要,因为Firebase可能会在内部连接到其他子域。)

有关使用Firebase的chrome扩展示例,请参阅: https://github.com/firebase/firebase-chrome-extension

关于google-chrome-extension - Firebase + Chrome内容安全策略设置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14007080/

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