Skip to content

Commit

Permalink
Deny non-HTTPS requests to the S3 bucket
Browse files Browse the repository at this point in the history
  • Loading branch information
shreyas-s-rao committed Apr 21, 2023
1 parent db16c16 commit 18ec623
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .ci/integration_test
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,10 @@ function delete_aws_secret() {
function create_s3_bucket() {
echo "Creating S3 bucket ${TEST_ID} in region ${REGION}"
aws s3api create-bucket --bucket ${TEST_ID} --region ${REGION} --create-bucket-configuration LocationConstraint=${REGION} --acl private
# Block public access to the S3 bucket
aws s3api put-public-access-block --bucket ${TEST_ID} --public-access-block-configuration "BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true"
# Deny non-HTTPS requests to the S3 bucket
aws s3api put-bucket-policy --bucket ${TEST_ID} --policy "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Deny\",\"Principal\":\"*\",\"Action\":\"s3:*\",\"Resource\":[\"arn:aws:s3:::${TEST_ID}\",\"arn:aws:s3:::${TEST_ID}/*\"],\"Condition\":{\"Bool\":{\"aws:SecureTransport\":\"false\"},\"NumericLessThan\":{\"s3:TlsVersion\":\"1.2\"}}}]}"
}

function delete_s3_bucket() {
Expand Down

0 comments on commit 18ec623

Please sign in to comment.