Implemented desktop csp policies

This commit is contained in:
2025-08-14 11:40:09 +02:00
parent bf7b24c3ee
commit 5e00deea19
2 changed files with 7 additions and 5 deletions

View File

@@ -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):

View File

@@ -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):