Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions state/s3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ Parameters:
Type: String
Default: true
AllowedValues: [true, false, 'false-but-was-true']
RestrictCustomerKeys:
Description: 'Block the use of SSE-C encryption (https://aws.amazon.com/blogs/security/preventing-unintended-encryption-of-amazon-s3-objects/).'
Type: String
Default: true
AllowedValues: [true, false]
NoncurrentVersionExpirationInDays:
Description: 'Remove noncurrent object versions after days (set to 0 to disable).'
Type: Number
Expand Down Expand Up @@ -161,6 +166,7 @@ Conditions:
HasBlockPublicAccess: !Not [!Or [!Condition HasPublicReadAccess, !Condition HasPublicWriteAccess]]
HasPermissionsBoundary: !Not [!Equals [!Ref PermissionsBoundary, '']]
HasBucketOwnerPreferred: !Or [!Condition HasCloudFrontAccessLogWrite, !Condition HasS3AccessLogWrite, !Not [!Condition HasBlockPublicAccess]]
HasRestrictCustomerKeys: !Equals [!Ref RestrictCustomerKeys, 'true']
Resources:
Bucket: # cannot be deleted with data
Type: 'AWS::S3::Bucket'
Expand Down Expand Up @@ -208,6 +214,17 @@ Resources:
Condition:
Bool:
'aws:SecureTransport': false
- !If
- HasRestrictCustomerKeys
- Sid: RestrictSSECObjectUploads # https://aws.amazon.com/blogs/security/preventing-unintended-encryption-of-amazon-s3-objects/
Principal: '*'
Action: 's3:PutObject'
Effect: Deny
Resource: !Sub '${Bucket.Arn}/*'
Condition:
'Null':
's3:x-amz-server-side-encryption-customer-algorithm': 'false'
- !Ref 'AWS::NoValue'
- !If
- HasPrivateAccessAndKmsKey
- Principal: '*'
Expand Down
Loading