Skip to content

Commit

Permalink
fix: involve the public access block in the check for public acl (#256)
Browse files Browse the repository at this point in the history
* fix: involve the public access block in the check for public acl
* fix: add nil check
  • Loading branch information
Owen Rumney authored Feb 10, 2022
1 parent f21999d commit d2da58b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions provider/aws/s3/bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ type Bucket struct {
func (b *Bucket) HasPublicExposureACL() bool {
for _, publicACL := range []string{"public-read", "public-read-write", "website", "authenticated-read"} {
if b.ACL.EqualTo(publicACL) {
// if there is a public access block, check the public ACL blocks
if b.PublicAccessBlock != nil && b.PublicAccessBlock.IsManaged() {
return b.PublicAccessBlock.IgnorePublicACLs.IsFalse() && b.PublicAccessBlock.BlockPublicACLs.IsFalse()
}
return true
}
}
Expand Down

0 comments on commit d2da58b

Please sign in to comment.