OAUTH2应用程序中的Google客户端秘密可以访问什么?

发布于 2025-01-27 11:12:20 字数 188 浏览 5 评论 0原文

我正在实施使用Google客户端ID和Google Client Secret的登录流。我正在考虑Google Client Secret的安全含义,谁应该能够访问它。

当前,客户秘密存储在环境变量中,但是我想知道有什么可以访问此秘密的人可以使用它来确定哪些开发人员应该可以访问此环境变量,并且我是否应该在开发中设置其他OAUTH2应用程序与生产。

I am implementing a login flow which uses the Google Client ID and Google Client Secret. I am considering the security implications of the Google Client Secret and who should be able to have access to it.

Currently the Client secret is stored in an environment variable, but I would like to know what someone with access to this secret could do with it to determine which developers should have access to this environment variable and if I should setup a different OAuth2 application in development vs production.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

简单 2025-02-03 11:12:20

这取决于您指定的OAUTH应用程序类型。
创建OAuth客户端ID时

  • 在Google Cloud中 秘密应该确实是秘密的,因为它被Google视为这样,并用于验证自己的服务器。因此,您应该将其隐藏,尤其是将其包含在开源代码中。

  • 但是,还可以选择创建桌面应用程序,这意味着您想在没有自己的服务器的情况下使用OAuth。对于这种情况,Google的文档 say ::

    该过程会导致客户端ID,在某些情况下是客户端
    秘密,您将其嵌入应用程序的源代码。 (在
    在这种情况下,客户秘密显然不是被视为秘密。)

因此,在这种情况下,将客户秘密包含在您的应用程序中的用户是可以的。

It depends on which type of OAuth application you specified.
When creating an OAuth client ID in Google Cloud (and with that, a client secret), you are asked to specify the type of application you are creating:

  • If you choose Web App, your client secret should really be secret, as its treated as such by Google and is used to authenticate your own server. You should therefore hide it and especially not include it in open sourced code.

  • However, there is also the option of creating a Desktop app, which means you want to use OAuth without having your own server. For this case the documentation by Google says:

    The process results in a client ID and, in some cases, a client
    secret, which you embed in the source code of your application. (In
    this context, the client secret is obviously not treated as a secret.)

So in this case it's fine (even required) to include the client secret in your app for your users.

雨夜星沙 2025-02-03 11:12:20

客户端ID和客户端秘密类似于登录和密码。他们使您的应用程序能够请求用户访问其数据的能力。如果您要存储刷新令牌,它也将使用户可以从刷新令牌中创建访问令牌。

Google TOS指出

要求开发人员做出合理的努力,以保持其私钥私密而不将其嵌入开源项目中。

您不应该与任何人分享。您和您的开发人员只能使用它。

是的,理想情况下,您应该拥有测试和生产客户ID。您的开发人员可以使用测试客户ID,唯一应该使用您的生产验证的项目客户ID是您的生产环境。我将它们存储在某些人中,以便个人分泌商店。

Client id and client secret are similar to a login and password. They give your application the ability to request consent of a user to access their data. If you are storing refresh tokens it would also give the user access to create access tokens from your refresh tokens.

Googles TOS states

Asking developers to make reasonable efforts to keep their private keys private and not embed them in open source projects.

You should not be sharing this with anyone. It should only be used by you and your developers.

Yes Ideally you should have a test and production client ids. Test client id can be used by your developers the only one who should be using your production verified project client ids is your production environment. I would store them in some for for secrete store personally.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文