Description
WRITE_ACP lets its grantee change the bucket ACL. Uploading or editing objects requires other permissions. ACLs can grant access to AWS accounts or predefined S3 groups. An account can delegate that access to IAM users, and FULL_CONTROL includes ACL administration.
Potential impact
A grantee can change who has access or interrupt legitimate users and log delivery. The effect depends on the grantee, policies and Block Public Access. The S3 LogDelivery group represents a service, not anonymous users.
Remediation
Review each grantee, retain the owner’s necessary control and remove unnecessary WRITE_ACP without broadening it to FULL_CONTROL. Prefer a bucket policy for log delivery. Before disabling ACLs with BucketOwnerEnforced, migrate necessary grants to policies and remove external bucket ACL grants.
Examples
Use only one of these ACL-based alternatives with an available bucket name. Configure the source bucket and logging separately. Source and destination must share an account and Region. Check destination encryption and delivery requirements.
Grant ACL administration to the logging group
data "aws_canonical_user_id" "current" {}
resource "aws_s3_bucket" "example" {
bucket = "my-tf-example-bucket"
}
resource "aws_s3_bucket_ownership_controls" "example" {
bucket = aws_s3_bucket.example.id
rule {
object_ownership = "BucketOwnerPreferred"
}
}
resource "aws_s3_bucket_acl" "example" {
depends_on = [aws_s3_bucket_ownership_controls.example]
bucket = aws_s3_bucket.example.id
access_control_policy {
grant {
grantee {
id = data.aws_canonical_user_id.current.id
type = "CanonicalUser"
}
permission = "FULL_CONTROL"
}
grant {
grantee {
type = "Group"
uri = "http://acs.amazonaws.com/groups/s3/LogDelivery"
}
permission = "WRITE_ACP"
}
owner {
id = data.aws_canonical_user_id.current.id
}
}
}
The owner has FULL_CONTROL. The LogDelivery group gets ACL administration but lacks the WRITE and READ_ACP permissions required to deliver logs.
ACL permissions needed for log delivery
data "aws_canonical_user_id" "current" {}
resource "aws_s3_bucket" "example" {
bucket = "my-tf-example-bucket"
}
resource "aws_s3_bucket_ownership_controls" "example" {
bucket = aws_s3_bucket.example.id
rule {
object_ownership = "BucketOwnerPreferred"
}
}
resource "aws_s3_bucket_acl" "example" {
depends_on = [aws_s3_bucket_ownership_controls.example]
bucket = aws_s3_bucket.example.id
access_control_policy {
grant {
grantee {
id = data.aws_canonical_user_id.current.id
type = "CanonicalUser"
}
permission = "FULL_CONTROL"
}
grant {
grantee {
type = "Group"
uri = "http://acs.amazonaws.com/groups/s3/LogDelivery"
}
permission = "WRITE"
}
grant {
grantee {
type = "Group"
uri = "http://acs.amazonaws.com/groups/s3/LogDelivery"
}
permission = "READ_ACP"
}
owner {
id = data.aws_canonical_user_id.current.id
}
}
}
The explicit dependency enables ACLs before applying the grants. The owner keeps FULL_CONTROL and LogDelivery receives WRITE and READ_ACP. Verify delivery to the configured destination.