Description
Require HTTPS for OSS requests that carry object data or credentials. Other permissions can still allow HTTP when a policy only grants access over HTTPS.
Potential impact
HTTP exposes requests to interception or alteration in transit.
Remediation
Add an explicit Deny where acs:SecureTransport is false. Cover the bucket and its objects. Confirm an approved HTTPS request succeeds. Use nonsensitive test data and no production credentials when checking that HTTP is denied.
Examples
Supply your bucket owner UID and bucket name, and merge the denial into the existing policy.
Before
hcl
resource "alicloud_oss_bucket" "bucket" {
bucket = var.bucket_name
policy = <<POLICY
{
"Version": "1",
"Statement": [
{
"Effect": "Allow",
"Principal": ["*"],
"Action": ["oss:*"],
"Resource": [
"acs:oss:*:${var.bucket_owner_uid}:${var.bucket_name}",
"acs:oss:*:${var.bucket_owner_uid}:${var.bucket_name}/*"
],
"Condition": {
"Bool": {
"acs:SecureTransport": ["false"]
}
}
}
]
}
POLICY
}
After
hcl
resource "alicloud_oss_bucket" "bucket" {
bucket = var.bucket_name
policy = <<POLICY
{
"Version": "1",
"Statement": [
{
"Effect": "Deny",
"Principal": ["*"],
"Action": ["oss:*"],
"Resource": [
"acs:oss:*:${var.bucket_owner_uid}:${var.bucket_name}",
"acs:oss:*:${var.bucket_owner_uid}:${var.bucket_name}/*"
],
"Condition": {
"Bool": {
"acs:SecureTransport": ["false"]
}
}
}
]
}
POLICY
}