Skip to content

Commit e209e42

Browse files
authored
Add billing.stripe.com to form-action CSP (#18328)
closes #18315 Allow `https://billing.stripe.com` in form-action CSP. When an organization's subscription lapses and they are marked as inactive, the POST to /manage/organization/<ORG_SLUG>/subscription/activate reidrects to /manage/organization/<ORG_SLUG>/subscription/ which ultimately redirects to billing.stripe.com since they have an existing customer/subscription. This does not align with CSP. NEW Organizations/customers are redirected to checkout.stripe.com, which aligns with CSP. Adding this allows for both states to successfully gain access to the stripe portal.
1 parent c6d92fd commit e209e42

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

tests/unit/test_csp.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,11 @@ def test_includeme():
250250
],
251251
"default-src": ["'none'"],
252252
"font-src": ["'self'", "fonts.gstatic.com"],
253-
"form-action": ["'self'", "https://checkout.stripe.com"],
253+
"form-action": [
254+
"'self'",
255+
"https://checkout.stripe.com",
256+
"https://billing.stripe.com",
257+
],
254258
"frame-ancestors": ["'none'"],
255259
"frame-src": ["'none'"],
256260
"img-src": [

warehouse/csp.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,11 @@ def includeme(config):
155155
"connect-src": _connect_src_settings(config),
156156
"default-src": [NONE],
157157
"font-src": [SELF, "fonts.gstatic.com"],
158-
"form-action": [SELF, "https://checkout.stripe.com"],
158+
"form-action": [
159+
SELF,
160+
"https://checkout.stripe.com",
161+
"https://billing.stripe.com",
162+
],
159163
"frame-ancestors": [NONE],
160164
"frame-src": [NONE],
161165
"img-src": [

0 commit comments

Comments
 (0)