Description
Require HTTPS uploads with an explicit deny for s3:PutObject on the object ARNs when aws:SecureTransport is false in the AWS::S3::BucketPolicy.
Potential impact
Plaintext uploads can be read or altered in transit. An HTTPS-only allow does not block HTTP writes granted by another policy.
Remediation
Configure applications and deployment tools to upload over HTTPS. AWS service-to-service calls can omit network context, so review any needed service-principal exceptions. Verify that approved uploads succeed and HTTP uploads are rejected.
Examples
Supply an available unique name through the omitted BucketName parameter. Block Public Access may reject the first example’s public-read grant.
Before
Resources:
S3Bucket:
Type: AWS::S3::Bucket
Properties:
BucketName: !Ref BucketName
BucketPolicy:
Type: AWS::S3::BucketPolicy
Properties:
Bucket: !Ref S3Bucket
PolicyDocument:
Statement:
- Sid: PublicReadForGetBucketObjects
Effect: Allow
Principal: "*"
Action: s3:GetObject
Resource: !Sub arn:aws:s3:::${S3Bucket}/*
The first statement allows only s3:GetObject. It grants no upload permission and sets no transport condition.
After
Resources:
S3Bucket:
Type: AWS::S3::Bucket
Properties:
BucketName: !Ref BucketName
BucketPolicy:
Type: AWS::S3::BucketPolicy
Properties:
Bucket: !Ref S3Bucket
PolicyDocument:
Statement:
- Sid: EnsureSSL
Effect: Deny
Principal: "*"
Action: s3:PutObject
Condition:
Bool:
aws:SecureTransport: false
Resource: !Sub arn:aws:s3:::${S3Bucket}/*
The second removes the public-read grant and denies HTTP uploads. Grant authorized HTTPS uploads separately and configure TLS requirements for other actions as needed.