gpt4 book ai didi

google-app-engine - str(BlobKey) 的安全性如何?

转载 作者:行者123 更新时间:2023-12-04 04:53:34 26 4
gpt4 key购买 nike

我已经实现了 appengine docs 中提到的通用 blob 服务处理程序。 .只要您知道该 blob 的 key 字符串,该处理程序就会为您提供任何 blob。我使用它来轻松编写客户端可以用来下载文件的 URL。如果客户端 A 检查 URL 以下载他们的文件并找到他们的 blob key (即 1CX2kh468IDYKGcDUiq5c69u8BRXBtKBYcIaJkmSbSa4QY096gGVaYCZJjGZUpDz == str(BlobKey) ),他们能否以某种方式对该 key 进行逆向工程并轻松构建另一个可用于下载客户端 B 文件的 key ?或者 key 是否添加了随机组件?

供引用,有this note关于 str(db.Key) ,这引起了我的问题:

Note: The string representation of a key looks cryptic, but is not encrypted! It can be converted back to the raw key data, both kind and identifier. If you don't want to expose this data to your users (and allow them to easily guess other entities' keys), then encrypt these strings or use something else.



我正在创建这样的文件,它没有指定 filename参数,所以我认为问题归结为, create() 如何“挑”一个 filename什么时候没有指定?我想我可以生成一个随机文件名并将其传递到这里,以确保这是安全的。
file_name = files.blobstore.create(mime_type='application/octet-stream')

最佳答案

BlobKeys 是不可猜测的。如果用户有一个 key ,那绝不会让他们猜测另一个 key 。与包含完整路径信息的数据存储区 key 不同,BlobKeys 不编码任何此类数据。您可以安全地共享它们,而不会像您描述的那样冒用户进行攻击的风险。

(我找不到这些声明的文档 - 这是基于我的记忆。)

关于google-app-engine - str(BlobKey) 的安全性如何?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17079219/

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