如何保护 GCS 触发的 App Engine Pub/Sub 推送端点?

How to Secure App Engine Pub/Sub Push Endpoint Triggered by GCS?

我正在尝试找到一种方法来保护我的 google 云应用引擎标准环境端点订阅了推送 pub/sub 主题,该主题由在 google 上创建文件触发云存储。

由于只能将 IP 地址设置为 App Engine 的防火墙规则,而 pub/sub 没有预定义的 IP 地址集,因此无法使用此功能。也无法在 pub/sub 调用上使用自定义 header 并检查其在应用引擎上的有效性,因为我无法控制 pub/sub 请求。

关于如何保护应用引擎端点的任何建议?

谢谢

云 Pub/Sub 推送基于 IP 的防火墙规则 配合得很好。使您的推送通知基于 IP 地址的安全性并不是最有效的方式

OAuth and Service Accounts can useful to authenticate access to Google products, such as Cloud Pub/Sub. This will prevent outsiders from accessing your Pub/Sub API for as long as they are not included under a specific service account.

此外,为了确保您的推送通知安全,我将采用以下两种解决方案之一:

To confirm that the push notification originates from Cloud Pub/Sub. You could configure endpoints which only accept messages that contain a secret token.

Set up your own push proxy. A simple stateless service might pull messages from Pub/Sub and push them from a fixed IP address to your webhook. Pub/Sub offers value in this setup by providing scaling and availability.

此外,我不确定您是否已经完全实现了这一点但没有奏效,但是来自另一个 Whosebug 问题的 这个 可能会有所帮助