diff --git a/app/__init__.py b/app/__init__.py
index 448c2d811..ebdfad08d 100644
--- a/app/__init__.py
+++ b/app/__init__.py
@@ -145,6 +145,7 @@ def _csp(config):
"frame-src": [
"https://www.youtube.com",
"https://www.youtube-nocookie.com",
+ "https://www.googletagmanager.com",
],
"frame-ancestors": "'none'",
"form-action": "'self'",
@@ -172,6 +173,12 @@ def _csp(config):
def create_app(application):
+ @application.after_request
+ def add_csp_header(response):
+ existing_csp = response.headers.get("Content-Security-Policy", "")
+ response.headers["Content-Security-Policy"] = existing_csp + "; form-action 'self';"
+ return response
+
@application.context_processor
def inject_feature_flags():
# this is where feature flags can be easily added as a dictionary within context
diff --git a/app/templates/base.html b/app/templates/base.html
index c37937cdb..f482d8f37 100644
--- a/app/templates/base.html
+++ b/app/templates/base.html
@@ -14,7 +14,7 @@
{% block bodyStart %}
{% block extra_javascripts_before_body %}
-
{% endblock %}
{% endblock %}
diff --git a/poetry.lock b/poetry.lock
index d1f1657be..1d0262110 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -1,4 +1,4 @@
-# This file is automatically @generated by Poetry 1.8.4 and should not be changed by hand.
+# This file is automatically @generated by Poetry 1.8.5 and should not be changed by hand.
[[package]]
name = "ago"
diff --git a/tests/app/main/views/test_headers.py b/tests/app/main/views/test_headers.py
index 7f72838db..c84fdc094 100644
--- a/tests/app/main/views/test_headers.py
+++ b/tests/app/main/views/test_headers.py
@@ -14,7 +14,7 @@ def test_owasp_useful_headers_set(
assert response.headers["X-Frame-Options"] == "deny"
assert response.headers["X-Content-Type-Options"] == "nosniff"
csp = response.headers["Content-Security-Policy"]
- assert search(r"default-src 'self' static\.example\.com;", csp)
+ assert search(r"frame-src.*https://www\.googletagmanager\.com", csp)
assert search(r"frame-ancestors 'none';", csp)
assert search(r"form-action 'self';", csp)
assert search(