From cc9b634bb882017c4018a90da72298ba3bd04859 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Mon, 2 Jun 2025 19:14:48 +0200 Subject: [PATCH] Solved recaptcha csp bug (propably will lead to other bugs, which then need to be solved) --- filter_plugins/csp_filters.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/filter_plugins/csp_filters.py b/filter_plugins/csp_filters.py index 2a52a4d0..da774b94 100644 --- a/filter_plugins/csp_filters.py +++ b/filter_plugins/csp_filters.py @@ -91,6 +91,7 @@ class FilterModule(object): 'frame-ancestors', 'frame-src', 'script-src', + 'script-src-elem', 'style-src', 'font-src', 'worker-src', @@ -115,11 +116,11 @@ class FilterModule(object): tokens.append(f"{web_protocol}://{matomo_domain}") # ReCaptcha integration: allow loading scripts from Google if feature enabled - if ( - self.is_feature_enabled(applications, 'recaptcha', application_id) - and directive == 'script-src' - ): - tokens.append('https://www.google.com') + if self.is_feature_enabled(applications, 'recaptcha', application_id): + if directive == 'script-src': + tokens.append('https://www.google.com') + if directive == 'script-src-elem': + tokens.append('https://www.gstatic.com') # Enable loading via ancestors if (