diff --git a/lib/httplib/httpheaders.go b/lib/httplib/httpheaders.go index 2c1d500980c3c..9a62c8eb2703e 100644 --- a/lib/httplib/httpheaders.go +++ b/lib/httplib/httpheaders.go @@ -81,12 +81,6 @@ var defaultContentSecurityPolicy = CSPMap{ var defaultFontSrc = CSPMap{"font-src": {"'self'", "data:"}} var defaultConnectSrc = CSPMap{"connect-src": {"'self'", "wss:"}} -var stripeSecurityPolicy = CSPMap{ - // auto-pay plans in Cloud use stripe.com to manage billing information - "script-src": {"https://js.stripe.com"}, - "frame-src": {"https://js.stripe.com"}, -} - var wasmSecurityPolicy = CSPMap{ "script-src": {"'self'", "'wasm-unsafe-eval'"}, } @@ -176,13 +170,9 @@ func SetDefaultSecurityHeaders(h http.Header) { h.Set("Strict-Transport-Security", "max-age=31536000; includeSubDomains") } -func getIndexContentSecurityPolicy(withStripe, withWasm bool) CSPMap { +func getIndexContentSecurityPolicy(withWasm bool) CSPMap { cspMaps := []CSPMap{defaultContentSecurityPolicy, defaultFontSrc, defaultConnectSrc} - if withStripe { - cspMaps = append(cspMaps, stripeSecurityPolicy) - } - if withWasm { cspMaps = append(cspMaps, wasmSecurityPolicy) } @@ -202,19 +192,17 @@ var indexCSPStringCache *cspCache = newCSPCache() func getIndexContentSecurityPolicyString(cfg proto.Features, urlPath string) string { // Check for result with this cfg and urlPath in cache - withStripe := cfg.GetIsStripeManaged() - key := fmt.Sprintf("%v-%v", withStripe, urlPath) - if cspString, ok := indexCSPStringCache.get(key); ok { + if cspString, ok := indexCSPStringCache.get(urlPath); ok { return cspString } // Nothing found in cache, calculate regex and result withWasm := desktopSessionRe.MatchString(urlPath) || recordingRe.MatchString(urlPath) cspString := GetContentSecurityPolicyString( - getIndexContentSecurityPolicy(withStripe, withWasm), + getIndexContentSecurityPolicy(withWasm), ) // Add result to cache - indexCSPStringCache.set(key, cspString) + indexCSPStringCache.set(urlPath, cspString) return cspString } diff --git a/lib/httplib/httplib_test.go b/lib/httplib/httplib_test.go index 4de4a114461b2..ebea1db615a0c 100644 --- a/lib/httplib/httplib_test.go +++ b/lib/httplib/httplib_test.go @@ -278,7 +278,7 @@ func TestSetIndexContentSecurityPolicy(t *testing.T) { expectedCspVals map[string]string }{ { - name: "default (no stripe or wasm)", + name: "default (no wasm)", features: proto.Features{}, urlPath: "/web/index.js", expectedCspVals: map[string]string{ @@ -295,25 +295,7 @@ func TestSetIndexContentSecurityPolicy(t *testing.T) { }, }, { - name: "for cloud based usage, Stripe managed product (with stripe, no wasm)", - features: proto.Features{Cloud: true, IsUsageBased: true, IsStripeManaged: true}, - urlPath: "/web/index.js", - expectedCspVals: map[string]string{ - "default-src": "'self'", - "base-uri": "'self'", - "form-action": "'self'", - "frame-ancestors": "'none'", - "frame-src": "https://js.stripe.com", - "object-src": "'none'", - "script-src": "'self' https://js.stripe.com", - "style-src": "'self' 'unsafe-inline'", - "img-src": "'self' data: blob:", - "font-src": "'self' data:", - "connect-src": "'self' wss:", - }, - }, - { - name: "for cloud based usage, EUB product (no stripe or wasm)", + name: "for cloud based usage, EUB product (no wasm)", features: proto.Features{Cloud: true, IsUsageBased: true, ProductType: proto.ProductType_PRODUCT_TYPE_EUB}, urlPath: "/web/index.js", expectedCspVals: map[string]string{ @@ -329,7 +311,7 @@ func TestSetIndexContentSecurityPolicy(t *testing.T) { }, }, { - name: "for desktop session (no stripe, with wasm)", + name: "for desktop session (with wasm)", features: proto.Features{}, urlPath: "/web/cluster/:clusterId/desktops/:desktopName/:username", expectedCspVals: map[string]string{ @@ -346,7 +328,7 @@ func TestSetIndexContentSecurityPolicy(t *testing.T) { }, }, { - name: "for cloud based usage & desktop session, Stripe managed product (with stripe, with wasm)", + name: "for cloud based usage & desktop session, with wasm", features: proto.Features{Cloud: true, IsUsageBased: true, IsStripeManaged: true}, urlPath: "/web/cluster/:clusterId/desktops/:desktopName/:username", expectedCspVals: map[string]string{ @@ -355,8 +337,7 @@ func TestSetIndexContentSecurityPolicy(t *testing.T) { "form-action": "'self'", "frame-ancestors": "'none'", "object-src": "'none'", - "script-src": "'self' https://js.stripe.com 'wasm-unsafe-eval'", - "frame-src": "https://js.stripe.com", + "script-src": "'self' 'wasm-unsafe-eval'", "style-src": "'self' 'unsafe-inline'", "img-src": "'self' data: blob:", "font-src": "'self' data:", diff --git a/package.json b/package.json index cd35418211717..3c07dfa28af8b 100644 --- a/package.json +++ b/package.json @@ -70,8 +70,6 @@ "@nivo/bar": "^0.87.0", "@protobuf-ts/runtime": "^2.9.4", "@protobuf-ts/runtime-rpc": "^2.9.4", - "@stripe/react-stripe-js": "^1.16.5", - "@stripe/stripe-js": "^1.48.0", "@uiw/codemirror-themes": "^4.22.2", "@uiw/react-codemirror": "^4.22.2", "d3-scale": "^4.0.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4a376a5637e57..dc2ffb619fb03 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -40,12 +40,6 @@ importers: '@protobuf-ts/runtime-rpc': specifier: ^2.9.4 version: 2.9.4 - '@stripe/react-stripe-js': - specifier: ^1.16.5 - version: 1.16.5(@stripe/stripe-js@1.52.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@stripe/stripe-js': - specifier: ^1.48.0 - version: 1.52.1 '@uiw/codemirror-themes': specifier: ^4.22.2 version: 4.22.2(@codemirror/language@6.9.2)(@codemirror/state@6.2.1)(@codemirror/view@6.19.0) @@ -2310,16 +2304,6 @@ packages: react: ^16.8.0 || ^17.0.0 || ^18.0.0 react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 - '@stripe/react-stripe-js@1.16.5': - resolution: {integrity: sha512-lVPW3IfwdacyS22pP+nBB6/GNFRRhT/4jfgAK6T2guQmtzPwJV1DogiGGaBNhiKtSY18+yS8KlHSu+PvZNclvQ==} - peerDependencies: - '@stripe/stripe-js': ^1.44.1 - react: ^16.8.0 || ^17.0.0 || ^18.0.0 - react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 - - '@stripe/stripe-js@1.52.1': - resolution: {integrity: sha512-fza40OPSpGQlFxc5TZWiYC/6Lk89Sep1fLuv9ss33YS6lCAF8UZbfA1E6W+lwO4c7WRKZIZumHIEbPJfP/O9uw==} - '@styled-system/background@5.1.2': resolution: {integrity: sha512-jtwH2C/U6ssuGSvwTN3ri/IyjdHb8W9X/g8Y0JLcrH02G+BW3OS8kZdHphF1/YyRklnrKrBT2ngwGUK6aqqV3A==} @@ -10012,15 +9996,6 @@ snapshots: regenerator-runtime: 0.13.11 resolve-from: 5.0.0 - '@stripe/react-stripe-js@1.16.5(@stripe/stripe-js@1.52.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': - dependencies: - '@stripe/stripe-js': 1.52.1 - prop-types: 15.8.1 - react: 18.3.1 - react-dom: 18.3.1(react@18.3.1) - - '@stripe/stripe-js@1.52.1': {} - '@styled-system/background@5.1.2': dependencies: '@styled-system/core': 5.1.2 diff --git a/web/packages/teleport/src/types.ts b/web/packages/teleport/src/types.ts index 627755c6222bd..2b8cdfb572201 100644 --- a/web/packages/teleport/src/types.ts +++ b/web/packages/teleport/src/types.ts @@ -83,8 +83,6 @@ export enum NavTitle { // Billing BillingSummary = 'Summary', - PaymentsAndInvoices = 'Payments and Invoices', - InvoiceSettings = 'Invoice Settings', // Clusters ManageClusters = 'Manage Clusters',