diff --git a/filter_plugins/csp_filters.py b/filter_plugins/csp_filters.py index 7ab7bcbb..1cf679d4 100644 --- a/filter_plugins/csp_filters.py +++ b/filter_plugins/csp_filters.py @@ -147,10 +147,11 @@ class FilterModule(object): tokens.append('https://www.google.com') # Allow the loading of js from the cdn - if directive == 'script-src-elem' and self.is_feature_enabled(applications, 'logout', application_id): - domain = domains.get('web-svc-cdn')[0] - tokens.append(f"{domain}") - + if directive == 'script-src-elem': + if self.is_feature_enabled(applications, 'logout', application_id) or self.is_feature_enabled(applications, 'port-ui-desktop', application_id): + domain = domains.get('web-svc-cdn')[0] + tokens.append(f"{domain}") + if directive == 'frame-ancestors': # Enable loading via ancestors if self.is_feature_enabled(applications, 'port-ui-desktop', application_id): diff --git a/tests/unit/filter_plugins/test_csp_filters.py b/tests/unit/filter_plugins/test_csp_filters.py index 9d0d6282..f2389d6e 100644 --- a/tests/unit/filter_plugins/test_csp_filters.py +++ b/tests/unit/filter_plugins/test_csp_filters.py @@ -51,7 +51,8 @@ class TestCspFilters(unittest.TestCase): 'app2': {} } self.domains = { - 'web-app-matomo': ['matomo.example.org'] + 'web-app-matomo': ['matomo.example.org'], + 'web-svc-cdn': ['cdn.example.org'], } def test_get_csp_whitelist_list(self):