桶安全
在 Remotion Lambda v4.0.418 之前,使用 Remotion Lambda 创建的存储桶使用 public-read ACL。这意味着:
🌐 Before Remotion Lambda, v4.0.418, buckets created with Remotion Lambda used a public-read ACL. This means that:
- 未通过在
renderMediaOnLambda()中设置privacy选项显式设为私有的项目,任何人都可以访问。 - 人们可以通过访问存储桶 URL 或使用 AWS SDK 来“列出”存储桶
风险
🌐 Risk
如果你也允许用户将文件上传到存储桶,任何人都可以列出存储桶并查看用户的项目。
如果你没有为渲染设置 privacy 选项,任何人都可以列出存储桶并查看渲染内容。
🌐 If you also accepted user uploads to the bucket, anyone could list the bucket and see user items.
If you did not set the privacy option for renders, anyone could list the bucket and see renders.
新的默认v4.0.418
🌐 The new defaultv4.0.418
从 Remotion Lambda v4.0.418 开始,默认是不设置 ACL,而是设置桶策略:
🌐 From Remotion Lambda v4.0.418, the default is to not set an ACL, but to set a bucket policy:
- 未通过在
renderMediaOnLambda()中设置privacy选项显式设为私有的项目,只有在你知道 URL 的情况下才能访问。 - 人们不能再“列出”这些桶了。
这个新的默认值仅适用于新创建的存储桶,并且仅在你已将 s3:PutBucketPolicy 权限添加到你的 IAM 用户 的情况下适用。现有存储桶和未带 s3:PutBucketPolicy 权限的新存储桶将继续使用 public-read ACL。自 v4.0.418 以来,s3:PutBucketPolicy 仅作为 getUserPolicy() 的一部分提供。
🌐 This new default only applies for newly created buckets and only if you added the s3:PutBucketPolicy permission to your IAM user.
Existing buckets and new buckets created without the s3:PutBucketPolicy permission will continue to have a public-read ACL.
s3:PutBucketPolicy is only available as part of getUserPolicy() since v4.0.418.
推荐
🌐 Recommendation
由于公众不需要能够列出存储桶,我们建议禁用此功能以最小化文件的暴露。
🌐 Since it is not required for the public to be able to list the bucket, we recommend disabling this to minimize exposure of your files.
对于新存储桶: 确保你将 s3:PutBucketPolicy 添加到你的 IAM 用户策略中(默认仅从 v4.0.418 开始,如果升级,你需要手动更新你的用户策略)。然后创建一个存储桶。
对于现有的存储桶: 访问 S3 控制台中的存储桶。转到“权限”。在 Access control list 下,点击 Edit 并为 Everyone 移除 List。
另请参阅
🌐 See also