diff --git a/soapbox/templates/admin/base.html b/soapbox/templates/admin/base.html index 7dd3d33..cba78ab 100644 --- a/soapbox/templates/admin/base.html +++ b/soapbox/templates/admin/base.html @@ -32,5 +32,13 @@ {% endwith %} {% block content %}{% endblock %} + diff --git a/soapbox/templates/admin/edit.html b/soapbox/templates/admin/edit.html index 4e6223e..3944193 100644 --- a/soapbox/templates/admin/edit.html +++ b/soapbox/templates/admin/edit.html @@ -56,8 +56,7 @@
  • ![]({{ name }}) -
    + @@ -68,8 +67,7 @@ {% endif %} - +
    diff --git a/soapbox/templates/admin/users.html b/soapbox/templates/admin/users.html index e1c3c18..ad07771 100644 --- a/soapbox/templates/admin/users.html +++ b/soapbox/templates/admin/users.html @@ -17,7 +17,7 @@ -
    + diff --git a/tests/test_app.py b/tests/test_app.py index 03f399f..0cf9bfb 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -146,3 +146,14 @@ def test_subpath_mount(tmp_path): assert 'href="theme/style.css"' in html assert re.search(r'href="admin/"', html) assert client.get("/blog/theme/style.css").status_code == 200 + + +def test_no_inline_js_with_content(client, cfg): + """Titler med anførselstegn skal ikke havne i en JS-kontekst (XSS).""" + post_id = _create_post(client) + token = csrf(client) + title = "Ola's \"test\" " + r = client.post(f"/admin/edit/{post_id}", data={"csrf": token, "title": title, "body": "x", "action": "save"}) + html = client.get(r.headers["Location"]).text + assert "onsubmit" not in html and "onclick" not in html + assert "Ola's" in html