Description
Review deletion permissions separately for the OSS bucket, its configuration and its objects. oss:DeleteBucket applies only to an empty bucket and only the owner can delete it.
Potential impact
Broad object or configuration deletion rights can disrupt applications. Recovery depends on versioning and retention.
Remediation
Grant each delete action only to the roles and resource paths that need it. Check conditions, explicit denies, ACLs and Block Public Access. A private bucket ACL can still have a policy grant.
Examples
The first wildcard has no condition. It excludes the owner, so its oss:DeleteBucket grant cannot authorize bucket deletion. The oss:PutObject grant can still allow uploads. The second policy can expose object names through public listing. For new policies use alicloud_oss_bucket_policy and match the paths to your bucket.
Bucket deletion and upload actions
resource "alicloud_oss_bucket" "bucket-policy1" {
bucket = "bucket-1-policy"
acl = "private"
policy = <<POLICY
{"Statement": [
{
"Action": [
"oss:PutObject", "oss:DeleteBucket"
],
"Effect": "Allow",
"Principal": [
"*"
],
"Resource": [
"acs:oss:*:*:bucket-1-policy",
"acs:oss:*:*:bucket-1-policy/*"
]
}
],
"Version":"1"}
POLICY
}
Listing-only grant
resource "alicloud_oss_bucket" "bucket-policy2" {
bucket = "bucket-2-policy"
acl = "private"
policy = <<POLICY
{"Statement": [
{
"Action": [
"oss:ListObjects"
],
"Effect": "Allow",
"Principal": [
"*"
],
"Resource": [
"acs:oss:*:*:bucket-2-policy"
]
}
],
"Version":"1"}
POLICY
}