gpt4 book ai didi

git - 我应该将 google-services.json(来自 Firebase)添加到我的存储库吗?

转载 作者:行者123 更新时间:2023-11-29 02:28:27 25 4
gpt4 key购买 nike

我刚刚注册了 Firebase 并创建了一个新项目。 Firebase 要求我提供我的应用域和 SHA1 调试 key 。我输入了这些详细信息,它生成了一个 google-services.json 文件供我添加到我的应用程序模块的根目录中。

我的问题是,是否应该将此 .json 文件添加到公共(public)(开源)存储库中。它是不是应该保密的东西,比如 API key ?

最佳答案

A google-services.json文件是,from the Firebase doc :

Firebase manages all of your API settings and credentials through a single configuration file.
The file is named google-services.json on Android and GoogleService-Info.plist on iOS.

将它添加到 .gitignore 而不是将其包含在公共(public) repo 中似乎是有意义的。
这在 issue 26 中讨论过, 更多细节 google-services.json包含。

类似 googlesamples/google-services 的项目确实有 in its .gitignore例如。
虽然,作为commented通过 stepheaw , 这个thread does mention

For a library or open-source sample we do not include the JSON file because the intention is that users insert their own to point the code to their own backend.
That's why you won't see JSON files in most of our firebase repos on GitHub.

如果“数据库 URL、Android API key 和存储桶”对您来说不是 secret ,那么您可以考虑将文件添加到您的存储库中。
正如“Is google-services.json safe from hackers?”中提到的,这并不是那么简单。

bauericthe comments 中询问:

In that post he says:

The JSON file does not contain any super-sensitive information (like a server API key)

但是 google-services.json 确实有名为 api_key 的条目。
那是与“服务器 api key ”不同的 api key 吗?

Willie Chalmers III指向“Is google-services.json safe from hackers?”,并添加:

Yes, that API key isn't a server API key which should never be public, so it's fine if your google-services.json is visible by others.

In any case, you should still restrict how your client API key can be used in the Google Cloud console.


Puzz 所述在 the comments ,另见“ Is it safe to expose Firebase apiKey to the public?

在那个答案中,Frank Van Puffelen提及:

更新(2021 年 5 月):感谢名为 Firebase App Check 的新功能,现在实际上可以将对 Firebase 项目中后端服务的访问限制为仅来自在该特定项目中注册的 iOS、Android 和 Web 应用程序的访问。

关于git - 我应该将 google-services.json(来自 Firebase)添加到我的存储库吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50896040/

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