Skip to content
Merged
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
3 changes: 3 additions & 0 deletions lib/httplib/httpheaders.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ func GetDefaultContentSecurityPolicy() string {
"frame-ancestors 'none'",
// additional default restrictions
"object-src 'none'",
// auto-pay plans in Cloud use stripe.com to manage billing information
"script-src 'self' https://js.stripe.com",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be applied globally to the DefaultContentSecurityPolicy? Instead could we just append to this policy when a page specifically needs to allow stripe code?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(With a few exceptions) the web UI is a single page app - the "pages" that use stripe are the same as any other part of the web UI, right?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If Stripe is being included as part of the single page app I understand this may make sense. But it sounded like this is new development, and if so, instead we should isolate the Stripe interaction on a different page. We would like to avoid providing stripe this level of trust across our entire application.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also display an upgrade banner on all pages via Main, and the banner has a CTA with the stripe payment element.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the above context it sounds like it does need to be included in the default CSP. But similar to this issue we should try to see if we can improve this. We want to be mindful when introducing these integrations to make sure their scope is as limited as possible.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@michellescripts @mcbattirola since it's a golang server side file, can we do:

if plan == "team" {
   headers["script-src 'self'] = "https://js.stripe.com"
}

This change alone will massively reduce the blast radius from any OSS or Enterprise customer

"frame-src https://js.stripe.com",
}, ";")
}

Expand Down