从Google Cloud Run自动生成的日志中删除敏感信息

huangapple go评论61阅读模式
英文:

Redacting sensitive information from automatically generated logs from Google Cloud Run

问题

在运行在谷歌云运行上的服务中,我有一个端点,基本上接受查询字符串中的访问令牌,并返回与该访问令牌对应的用户的一些用户详细信息。

类似于 BASE_URL/auth?access_token=abc123

问题在于,云运行会自动写入包含有关请求信息的日志,包括包含查询字符串的完整URL。这意味着访问令牌会被写入日志,这并不是我想要的。

根据我从这里了解到的信息:https://cloud.google.com/run/docs/logging#exclude-logs,似乎无法关闭这些日志,除非使用某些排除过滤器。我想了解的是,我是否可以使用这个来实际筛选云运行写入云日志的日志?如果可以,这个汇集会是什么样子的?

我也非常愿意考虑任何其他可以简单地隐藏敏感信息的替代方案。如果相关的话,访问令牌是一个JWT(不是由Google发布的)。

英文:

In a service running on google cloud run, I have an endpoint that essentially accepts an access token in the query string and returns some user details of the user that is corresponding to that access token.

Something like BASE_URL/auth?access_token=abc123

The issue with this is that cloud run writes logs automatically that contains information about the request, including the full url including the query string. This then means that the access token gets written to the logs, which is not exactly what I want.

From what I gather from here: https://cloud.google.com/run/docs/logging#exclude-logs, it doesnt seem possible to turn off these logs except via some exclusion filter. What I'm trying to understand is, can I use this to actually filter the logs that cloud run writes to cloud logging? If so how would that sink look?

I'm also very open to any other alternative that would simply redact the sensitive information. In case it is of any relevance, the access token is a JWT (not issued by Google).

答案1

得分: 2

将所有评论中的信息编译成一个供所有人查看的社区维基。

在Cloud Logging中无法关闭这些日志记录。您可以使用日志排除来排除默认存储桶中的日志,并将它们添加到专用日志存储桶中。之后,您可以管理谁可以访问这些日志。您还可以查看此帖子的答案,其中详细说明了如何排除日志。

另一件要检查的事情是HTTP请求URL中的敏感信息是一个安全问题。将敏感信息放在URL中被认为是不良实践

英文:

Compiling all information in the comments as a community wiki for everyone's visibility.

It is not possible to turn off these logs in Cloud Logging. What you can do is use log exclusion to exclude the logs from the default bucket and add them in a dedicated log bucket. After that, you can manage who can access the logs. You can also check the answer to this post as it shows details on how to exclude logs.

Another thing to check is that sensitive information in HTTP request URLs is a security issue. Putting sensitive information in a URL is considered bad practice.

huangapple
  • 本文由 发表于 2023年5月29日 22:45:07
  • 转载请务必保留本文链接:https://go.coder-hub.com/76358279.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定