Skip to main content

Triage and Remediation

Remediation

Using Console

  1. Open the AWS S3 Console.
  2. Navigate to the specific S3 bucket for which you want to enforce secure transport.
  3. Click on the “Permissions” tab.
  4. Scroll down to the “Bucket policy” section.
  5. Edit the bucket policy to enforce the use of HTTPS.
Here is an example policy snippet to enforce HTTPS:
Replace YOUR_BUCKET_NAME with the name of your S3 bucket.

Replace YOUR_BUCKET_NAME with the name of your S3 bucket.
Replace YOUR_BUCKET_NAME, YOUR_ACCESS_KEY, YOUR_SECRET_KEY, and update the region with your desired region in the Python script. Run the script, and it will enforce the use of HTTPS for the specified S3 bucket. Make sure to install the boto3 library if you haven’t already:
Note: Ensure that you have the necessary permissions to make these changes, and exercise caution when applying changes to production environments.
This enforces HTTPS-only access via a bucket policy equivalent to the provided CLI put-bucket-policy call; it updates the existing policy in place (no bucket replacement), but it will overwrite any previous policy unless you merge other required statements into the aws_iam_policy_document.Verification: terraform plan should show an aws_s3_bucket_policy resource being created or updated with a Deny statement on s3:* for the bucket and all objects when aws:SecureTransport is false.