diff options
author | rinpatch <rinpatch@sdf.org> | 2020-03-15 19:53:52 +0000 |
---|---|---|
committer | rinpatch <rinpatch@sdf.org> | 2020-03-16 00:14:04 +0300 |
commit | fcf51a77baa4661d4b20d55b87577d5de0a8c422 (patch) | |
tree | 5cdd974aa99ccba9f25946bee0552e3c18cf8f8f /test | |
parent | 8096bfb891cf29b5e54e102ef1b3a3911cbda33d (diff) | |
download | pleroma-fcf51a77baa4661d4b20d55b87577d5de0a8c422.tar.gz |
Merge branch 'features/staticfe-sanitization' into 'develop'
static_fe: Sanitize HTML
Closes #1614
See merge request pleroma/pleroma!2299
Diffstat (limited to 'test')
-rw-r--r-- | test/web/static_fe/static_fe_controller_test.exs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/test/web/static_fe/static_fe_controller_test.exs b/test/web/static_fe/static_fe_controller_test.exs index 2ce8f9fa3..a3be90888 100644 --- a/test/web/static_fe/static_fe_controller_test.exs +++ b/test/web/static_fe/static_fe_controller_test.exs @@ -110,8 +110,20 @@ defmodule Pleroma.Web.StaticFE.StaticFEControllerTest do assert html =~ "testing a thing!" end - test "shows the whole thread", %{conn: conn} do + 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"}) CommonAPI.post(user, %{ |