diff --git a/app/static/js/modal.js b/app/static/js/modal.js
index 470071a..013d143 100644
--- a/app/static/js/modal.js
+++ b/app/static/js/modal.js
@@ -1,3 +1,6 @@
+const i18nBlock = document.getElementById('i18n');
+window.I18N = i18nBlock ? JSON.parse(i18nBlock.textContent) : {};
+
function t(source) {
return (window.I18N || {})[source] || source;
}
diff --git a/app/templates/moduls/base.html.j2 b/app/templates/moduls/base.html.j2
index 4955545..2712fa1 100644
--- a/app/templates/moduls/base.html.j2
+++ b/app/templates/moduls/base.html.j2
@@ -71,7 +71,7 @@
{% include "moduls/modal.html.j2" %}
-
+
{% for name in [
'modal',
'navigation',
diff --git a/tests/integration/test_app_routes.py b/tests/integration/test_app_routes.py
index c2bcb0f..18e0a73 100644
--- a/tests/integration/test_app_routes.py
+++ b/tests/integration/test_app_routes.py
@@ -1,5 +1,6 @@
import json
import os
+import re
import shutil
import subprocess
import sys
@@ -111,6 +112,37 @@ class TestEscaping(AppRouteMixin, unittest.TestCase):
self.assertIn("<script>alert('config')", body)
+class TestContentSecurityPolicy(AppRouteMixin, unittest.TestCase):
+ def test_page_ships_no_executable_inline_script(self):
+ body = self.client.get("/de/").get_data(as_text=True)
+
+ inline = [
+ tag
+ for tag in re.findall(r""}
+
+ body = self.client.get("/de/").get_data(as_text=True)
+ block = re.search(
+ r'', body, re.S
+ )
+
+ self.assertIsNotNone(block)
+ self.assertEqual(
+ json.loads(block.group(1))["Open"], ""
+ )
+
+
class TestApodBackground(AppRouteMixin, unittest.TestCase):
def setUp(self):
super().setUp()