department-of-veterans-affairs / va.gov-team

Public resources for building on and in support of VA.gov. Visit complete Knowledge Hub:
https://depo-platform-documentation.scrollhelp.site/index.html
283 stars 204 forks source link

CSP policy/S3 configuration should be updated for content.www.va.gov assets #25941

Open patrickvinograd opened 3 years ago

patrickvinograd commented 3 years ago

Issue Description

Sentry reports that our content security policy directives are out of whack with reality: http://sentry.vfs.va.gov/organizations/vsp/issues/35909/?project=-1&query=is%3Aunresolved&statsPeriod=14d

It looks like some assets were moved to S3 bucket served from: https://s3-us-gov-west-1.amazonaws.com/content.www.va.gov/

such as https://s3-us-gov-west-1.amazonaws.com/content.www.va.gov/img/design/icons/apple-touch-icon-152x152.png and many others

But that host is not in our CSP directives. And in fact, it's not really desirable to put that host in our CSP because it would allow images from all of s3-us-gov-west-1.amazonaws.com - i.e. every bucket in GovCloud, not just VA-controlled buckets in GovCloud.

Instead:

Tasks

Acceptance Criteria


How to configure this issue

patrickvinograd commented 3 years ago

It looks like there's no way to override the bucket name -> virtual host mapping in S3: https://docs.aws.amazon.com/AmazonS3/latest/userguide/VirtualHosting.html

so there's no way to make the existing bucket names with dots work with SSL.

This adds significantly to the complexity of this ticket because new buckets without dots in the name need to be provisioned, all assets published to old and new buckets for a while, then do the steps listed above.