IAP签名标头和AppEngine标准Python 3.7运行时

rxs*_*bjw 5 google-app-engine google-app-engine-python google-iap

是否有必要在AppEngine Standard Python 3.7运行时中从IAP验证签名的标头?

IAP文档未提及Python 3.7运行时的细节。

IAP 文档说:

  • AppEngine Standard应该使用Users API
  • 必须进行验证才能保护AppEngine Flex中的应用程序安全

用户API对于标准3.7不可用。签名头是。可以验证标题。

我可以看到AppEngine环境添加了一些标题。我想知道X-Appengine-值是否可以隐式信任(即AppEngine在验证来自IAP的标头后是否附加这些值)?

X-Appengine-User-Id: <user id>
X-Appengine-Auth-Domain: <domain>
X-Appengine-User-Email: <user email>
...
X-Goog-Iap-Jwt-Assertion: <assertion>
X-Goog-Authenticated-User-Email: accounts.google.com:<user email> 
X-Goog-Authenticated-User-Id: accounts.google.com:<user id>
Run Code Online (Sandbox Code Playgroud)

Dan*_*scu 1

来自App Engine 特定的标头

对于中指定的 login:admin或处理程序,App Engine 还提供以下一组标头:login:requiredapp.yaml

  • X-AppEngine-User-Email,示例标题:“ange@example.com”
  • X-AppEngine-Auth-Domain,示例标题:“example.com”
  • X-AppEngine-User-ID,示例标头:“100979712376541954724”

因此可以相信他们不是来自 GAE 外部。但我不确定它们与 IAP 基础设施有何关系。

由于不支持 Users API,我会遵循灵活环境的建议,从这个角度来看,它似乎更接近 Python3 运行时 - 我会验证签名的标头。