Skip to content

Commit

Permalink
Merge pull request #2652 from lpsinger/bucket-ssl-only
Browse files Browse the repository at this point in the history
Require SSL for all actions on S3 buckets
  • Loading branch information
dakota002 authored Oct 29, 2024
2 parents 8186216 + 1dfaa63 commit 7321140
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/plugins/email-incoming.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,24 @@ export const deploy = {
},
},
},
{
Sid: 'AllowSSLRequestsOnly',
Action: 's3:*',
Effect: 'Deny',
Resource: [
{ 'Fn::GetAtt': 'EmailIncomingBucket.Arn' },
{
'Fn::Sub': [
`\${bukkit}/*`,
{ bukkit: { 'Fn::GetAtt': 'EmailIncomingBucket.Arn' } },
],
},
],
Condition: {
Bool: { 'aws:SecureTransport': false },
},
Principal: '*',
},
],
},
},
Expand Down
24 changes: 24 additions & 0 deletions src/plugins/missionCloudPlatform.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,30 @@
// Custom permissions for deployment on Mission Cloud Platform
export const deploy = {
start({ cloudformation }) {
// Mission Cloud Platform requires that S3 buckets only permit access over
// SSL in order to dismiss
// https://docs.aws.amazon.com/securityhub/latest/userguide/s3-controls.html#s3-5.
cloudformation.Resources.StaticBucketPolicy.Properties.PolicyDocument.Statement.push(
{
Sid: 'AllowSSLRequestsOnly',
Action: 's3:*',
Effect: 'Deny',
Resource: [
{ 'Fn::GetAtt': 'StaticBucket.Arn' },
{
'Fn::Sub': [
`\${bukkit}/*`,
{ bukkit: { 'Fn::GetAtt': 'StaticBucket.Arn' } },
],
},
],
Condition: {
Bool: { 'aws:SecureTransport': false },
},
Principal: '*',
}
)

// Mission Cloud Platform does not support user-defined public access block
// configurations; they must be set manually by an administrator
delete cloudformation.Resources.StaticBucket.Properties
Expand Down

0 comments on commit 7321140

Please sign in to comment.