简体   繁体   English

Amazon S3 可公开读取的存储桶是否损坏

[英]Is an Amazon S3 publicly readable bucket bad

I have an S3 bucket defined with the following policy -我有一个使用以下策略定义的 S3 存储桶 -

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "AllowReading",
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::BUCKETNAME/*"
        },
        {
            "Sid": "AllowWriting",
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::000000000000:user/USERNAME"
            },
            "Action": "s3:PutObject",
            "Resource": "arn:aws:s3:::BUCKETNAME/*"
        }
    ]
}

This bucket is to hold user uploads, and its contents currently needs to be accessible via a standard URL.此存储桶用于保存用户上传,目前需要通过标准 URL 访问其内容。 Each file is stored as a GUID (eg. 64a5e486-e73a-4310-85ff-327f4618a176.jpg ).每个文件都存储为一个 GUID(例如64a5e486-e73a-4310-85ff-327f4618a176.jpg )。

AWS seems to warn me over and over that my current policy of having a publicly accessible bucket is extremely bad, but as far as I can see, the only public aspect is reading, which I don't see as a problem. AWS 似乎一遍又一遍地警告我,我目前拥有可公开访问的存储桶的政策非常糟糕,但据我所知,唯一的公共方面是阅读,我认为这不是问题。 Directory listing is denied to the public, and only a specific IAM user I have set up can write files to the bucket.目录列表被拒绝公开,只有我设置的特定 IAM 用户才能将文件写入存储桶。

My question is, should I be setting up the bucket differently (from a security standpoint) or is AWS simply being overly cautious in its warnings to me?我的问题是,我应该以不同的方式设置存储桶(从安全角度来看)还是 AWS 只是在向我发出警告时过于谨慎?

Over the past year, AWS has been proactively helping customers err on the side of safety by blocking public access by default and by providing clear warnings when buckets are publicly accessible.在过去的一年中,AWS 通过默认阻止公共访问并在存储桶可公开访问时提供明确的警告,主动帮助客户在安全方面犯错。

If your intention is to allow any objects to be read by anyone (if they know the filename), then your policy is fine and you can be comfortable with the warning that has been provided.如果您的意图是允许任何人读取任何对象(如果他们知道文件名),那么您的策略很好,您可以对已提供的警告感到满意。

The only way to make it more secure would be to have users login to an application, which then grants access to objects via Amazon S3 pre-signed URLs .使其更安全的唯一方法是让用户登录应用程序,然后通过Amazon S3 预签名 URL授予对对象的访问权限。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM