-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
3 changed files
with
68 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
## Description | ||
|
||
This control checks whether Amazon S3 buckets provide user permissions via ACLs. The control fails if ACLs are configured for managing user access on S3 buckets. | ||
|
||
ACLs are legacy access control mechanisms that predate IAM. Instead of ACLs, we recommend using IAM policies or S3 bucket policies to more easily manage access to your S3 buckets. | ||
|
||
## Remediation | ||
|
||
For more information on managing access to S3 buckets, see [Bucket policies and user policies](https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-iam-policies.html) in the Amazon S3 User Guide. For details on how to review your current ACL permissions, see [Access control list (ACL) overview](https://docs.aws.amazon.com/AmazonS3/latest/userguide/acl-overview.html) in the Amazon S3 User Guide. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
with bucket_acl_details as ( | ||
select | ||
arn, | ||
title, | ||
ARRAY[acl -> 'Owner' ->> 'ID'] as bucket_owner, | ||
array_agg(grantee_id) as bucket_acl_permissions, | ||
region, | ||
account_id | ||
from | ||
aws_s3_bucket, | ||
jsonb_path_query(acl, '$.Grants.Grantee.ID') as grantee_id | ||
group by | ||
arn, | ||
title, | ||
acl, | ||
region, | ||
account_id | ||
), | ||
bucket_acl_checks as ( | ||
select | ||
arn, | ||
title, | ||
to_jsonb(bucket_acl_permissions) - bucket_owner as additional_permissions, | ||
region, | ||
account_id | ||
from | ||
bucket_acl_details | ||
) | ||
select | ||
-- Required Columns | ||
arn as resource, | ||
case | ||
when jsonb_array_length(additional_permissions) = 0 then 'ok' | ||
else 'alarm' | ||
end status, | ||
case | ||
when jsonb_array_length(additional_permissions) = 0 then title || ' does not have ACLs for user access.' | ||
else title || ' has ACLs for user access.' | ||
end reason, | ||
-- Additional Dimensions | ||
region, | ||
account_id | ||
from | ||
bucket_acl_checks; |