diff options
author | Haelwenn (lanodan) Monnier <contact@hacktivis.me> | 2020-03-15 15:45:57 +0100 |
---|---|---|
committer | Haelwenn (lanodan) Monnier <contact@hacktivis.me> | 2020-03-15 20:44:04 +0100 |
commit | 0ac6e296549f43e553bdd2350050efcf95d3b6fa (patch) | |
tree | ce1668ebf3704803b370402911a308e90e71c9b2 /test | |
parent | fa4ec17c841a65eccacdc35c98b6c047549b305b (diff) | |
download | pleroma-0ac6e296549f43e553bdd2350050efcf95d3b6fa.tar.gz |
static_fe: Sanitize HTML in posts
Note: Seems to have different sanitization with TwitterCard generator giving
the following:
<meta content=\"“alert('xss')”\" property=\"twitter:description\">
Diffstat (limited to 'test')
-rw-r--r-- | test/web/static_fe/static_fe_controller_test.exs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/web/static_fe/static_fe_controller_test.exs b/test/web/static_fe/static_fe_controller_test.exs index a072cc78f..c3d2ae3b4 100644 --- a/test/web/static_fe/static_fe_controller_test.exs +++ b/test/web/static_fe/static_fe_controller_test.exs @@ -92,6 +92,19 @@ defmodule Pleroma.Web.StaticFE.StaticFEControllerTest do assert html =~ "testing a thing!" end + test "filters HTML tags", %{conn: conn} do + user = insert(:user) + {:ok, activity} = CommonAPI.post(user, %{"status" => "<script>alert('xss')</script>"}) + + conn = + conn + |> put_req_header("accept", "text/html") + |> get("/notice/#{activity.id}") + + html = html_response(conn, 200) + assert html =~ ~s[<script>alert('xss')</script>] + end + test "shows the whole thread", %{conn: conn, user: user} do {:ok, activity} = CommonAPI.post(user, %{"status" => "space: the final frontier"}) |