diff --git a/lib/httplib/httpheaders.go b/lib/httplib/httpheaders.go index f4a2bafdf20..8e7dade8d94 100644 --- a/lib/httplib/httpheaders.go +++ b/lib/httplib/httpheaders.go @@ -189,7 +189,7 @@ var indexCSPStringCache *cspCache = newCSPCache() func getIndexContentSecurityPolicyString(cfg proto.Features, urlPath string) string { // Check for result with this cfg and urlPath in cache - withStripe := cfg.GetCloud() && cfg.GetIsUsageBased() + withStripe := cfg.GetProductType() == proto.ProductType_PRODUCT_TYPE_TEAM key := fmt.Sprintf("%v-%v", withStripe, urlPath) if cspString, ok := indexCSPStringCache.get(key); ok { return cspString diff --git a/lib/httplib/httplib_test.go b/lib/httplib/httplib_test.go index 45c168af36b..88419225a21 100644 --- a/lib/httplib/httplib_test.go +++ b/lib/httplib/httplib_test.go @@ -294,8 +294,8 @@ func TestSetIndexContentSecurityPolicy(t *testing.T) { }, }, { - name: "for cloud based usage (with stripe, no wasm)", - features: proto.Features{Cloud: true, IsUsageBased: true}, + name: "for cloud based usage, Team product (with stripe, no wasm)", + features: proto.Features{Cloud: true, IsUsageBased: true, ProductType: proto.ProductType_PRODUCT_TYPE_TEAM}, urlPath: "/web/index.js", expectedCspVals: map[string]string{ "default-src": "'self'", @@ -311,6 +311,22 @@ func TestSetIndexContentSecurityPolicy(t *testing.T) { "connect-src": "'self' wss:", }, }, + { + name: "for cloud based usage, EUB product (no stripe or wasm)", + features: proto.Features{Cloud: true, IsUsageBased: true, ProductType: proto.ProductType_PRODUCT_TYPE_EUB}, + urlPath: "/web/index.js", + expectedCspVals: map[string]string{ + "default-src": "'self'", + "base-uri": "'self'", + "form-action": "'self'", + "frame-ancestors": "'none'", + "object-src": "'none'", + "style-src": "'self' 'unsafe-inline'", + "img-src": "'self' data: blob:", + "font-src": "'self' data:", + "connect-src": "'self' wss:", + }, + }, { name: "for desktop session (no stripe, with wasm)", features: proto.Features{}, @@ -329,8 +345,8 @@ func TestSetIndexContentSecurityPolicy(t *testing.T) { }, }, { - name: "for cloud based usage & desktop session (with stripe, with wasm)", - features: proto.Features{Cloud: true, IsUsageBased: true}, + name: "for cloud based usage & desktop session, Team product (with stripe, with wasm)", + features: proto.Features{Cloud: true, IsUsageBased: true, ProductType: proto.ProductType_PRODUCT_TYPE_TEAM}, urlPath: "/web/cluster/:clusterId/desktops/:desktopName/:username", expectedCspVals: map[string]string{ "default-src": "'self'",