Skip to content

Commit

Permalink
Add alternate bucket url to CSP
Browse files Browse the repository at this point in the history
The bucket url used to access recordings in the UI differs in
format across regions
In us-east-1 it is https://${AudioBucket}.s3.amazonaws.com
In other regions it is https://${AudioBucket}.s3.${AWS::Region}.amazonaws.com

This commit adds the second format to the content security policy
  • Loading branch information
ConnorKirk committed Mar 3, 2022
1 parent fad14a2 commit 1f164e9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pca-ui/cfn/lib/web.template
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ Resources:
Name: !Sub "${AWS::StackName}-SecurityHeaders"
SecurityHeadersConfig:
ContentSecurityPolicy:
ContentSecurityPolicy: !Sub "default-src 'none'; img-src 'self' https://${DataBucket}.s3.amazonaws.com data:; script-src 'self'; style-src 'self' 'unsafe-inline'; object-src 'none'; connect-src 'self' https://*.execute-api.${AWS::Region}.amazonaws.com https://*.auth.${AWS::Region}.amazoncognito.com; font-src data:; media-src https://${AudioBucket}.s3.amazonaws.com; manifest-src 'self';"
# Cover both S3 URL types for media-src entries as it
# varies by region
ContentSecurityPolicy: !Sub "default-src 'none'; img-src 'self' https://${DataBucket}.s3.amazonaws.com https://${DataBucket}.s3.${AWS::Region}.amazonaws.com data:; script-src 'self'; style-src 'self' 'unsafe-inline'; object-src 'none'; connect-src 'self' https://*.execute-api.${AWS::Region}.amazonaws.com https://*.auth.${AWS::Region}.amazoncognito.com; font-src data:; media-src https://${AudioBucket}.s3.amazonaws.com; manifest-src 'self';"
Override: True
ContentTypeOptions:
Override: True
Expand Down

0 comments on commit 1f164e9

Please sign in to comment.