Description
Review which identities can upload to each OSS object path. oss:PutObject writes content. Changing an object ACL has separate ownership and permission requirements.
Potential impact
Unrestricted uploads can increase charges or replace content an application serves. With versioning, an overwrite still changes the current version.
Remediation
Limit uploads to approved writers and paths. Reserve ACL changes for the bucket owner with both read and write access to the object. Check policy conditions, explicit denies, ACLs and Block Public Access. Test an approved upload and confirm anonymous writes are denied.
Examples
Both legacy inline policies use an unconditional wildcard, which excludes the bucket owner. For new configurations use alicloud_oss_bucket_policy and match the paths to your bucket.
Upload and object ACL permissions
resource "alicloud_oss_bucket" "bucket-policy4" {
bucket = "bucket-4-policy"
acl = "private"
policy = <<POLICY
{"Statement": [
{
"Action": [
"oss:PutObjectAcl", "oss:PutObject"
],
"Effect": "Allow",
"Principal": [
"*"
],
"Resource": [
"acs:oss:*:*:bucket-4-policy/*"
]
}
],
"Version":"1"}
POLICY
}
Multipart upload cancellation permission
resource "alicloud_oss_bucket" "bucket-policy1" {
bucket = "bucket-1-policy"
acl = "private"
policy = <<POLICY
{"Statement": [
{
"Action": [
"oss:AbortMultipartUpload"
],
"Effect": "Allow",
"Principal": [
"*"
],
"Resource": [
"acs:oss:*:*:bucket-1-policy/*"
]
}
],
"Version":"1"}
POLICY
}
oss:AbortMultipartUpload can cancel an in-progress upload and remove its parts when the caller has the upload ID. Limit it to the operators who need it. Completed objects are unaffected.