You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From what I can tell this rule is meant to alert when a bucket policy grants public access to a bucket. And it seems to be producing false positives and false negatives.
What I Did
resource "aws_s3_bucket" "private" {
# This bucket has a private ACL and has no bucket policy at all, so this is
# definitely a private bucket.
bucket = "private"
acl = "private"
}
resource "aws_s3_bucket" "public" {
bucket = "public"
}
data "aws_iam_policy_document" "public" {
# This is the example use case for Granting read-only permission to an anonymous user
# https://docs.aws.amazon.com/AmazonS3/latest/userguide/example-bucket-policies.html#example-bucket-policies-use-case-2
statement {
effect = "Allow"
actions = ["s3:GetObject", "s3:GetObjectVersion"]
resources = ["${aws_s3_bucket.public.arn}/*"]
principals {
type = "AWS"
identifiers = ["*"]
}
}
}
resource "aws_s3_bucket_policy" "public" {
bucket = aws_s3_bucket.public.id
policy = data.aws_iam_policy_document.public.json
}
It will detect public access, but in the wrong bucket. Here it calls out the private bucket as being the one to blame. This represents the false positive.
OSX
Description
From what I can tell this rule is meant to alert when a bucket policy grants public access to a bucket. And it seems to be producing false positives and false negatives.
What I Did
It will detect public access, but in the wrong bucket. Here it calls out the private bucket as being the one to blame. This represents the false positive.
And if I then delete the private bucket resource and leave the public bucket resources, I'll get a false negative:
The text was updated successfully, but these errors were encountered: