Implemented desktop csp policies

This commit is contained in:
Kevin Veen-Birkenbach 2025-08-14 11:40:09 +02:00
parent bf7b24c3ee
commit 5e00deea19
No known key found for this signature in database
GPG Key ID: 44D8F11FD62F878E
2 changed files with 7 additions and 5 deletions

View File

@ -147,9 +147,10 @@ class FilterModule(object):
tokens.append('https://www.google.com') tokens.append('https://www.google.com')
# Allow the loading of js from the cdn # Allow the loading of js from the cdn
if directive == 'script-src-elem' and self.is_feature_enabled(applications, 'logout', application_id): if directive == 'script-src-elem':
domain = domains.get('web-svc-cdn')[0] if self.is_feature_enabled(applications, 'logout', application_id) or self.is_feature_enabled(applications, 'port-ui-desktop', application_id):
tokens.append(f"{domain}") domain = domains.get('web-svc-cdn')[0]
tokens.append(f"{domain}")
if directive == 'frame-ancestors': if directive == 'frame-ancestors':
# Enable loading via ancestors # Enable loading via ancestors

View File

@ -51,7 +51,8 @@ class TestCspFilters(unittest.TestCase):
'app2': {} 'app2': {}
} }
self.domains = { 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): def test_get_csp_whitelist_list(self):