projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'release/2.1.0' into 'stable'
[akkoma]
/
test
/
web
/
activity_pub
/
object_validators
/
types
/
safe_text_test.exs
diff --git
a/test/web/activity_pub/object_validators/types/safe_text_test.exs
b/test/web/activity_pub/object_validators/types/safe_text_test.exs
index 59ed0a1febbc675744d6f3045b12f78266f44304..9c08606f6419aed0d164108685ba21838f3482f3 100644
(file)
--- a/
test/web/activity_pub/object_validators/types/safe_text_test.exs
+++ b/
test/web/activity_pub/object_validators/types/safe_text_test.exs
@@
-5,7
+5,7
@@
defmodule Pleroma.Web.ActivityPub.ObjectValidators.Types.SafeTextTest do
use Pleroma.DataCase
defmodule Pleroma.Web.ActivityPub.ObjectValidators.Types.SafeTextTest do
use Pleroma.DataCase
- alias Pleroma.
Web.ActivityPub.ObjectValidators.Type
s.SafeText
+ alias Pleroma.
EctoType.ActivityPub.ObjectValidator
s.SafeText
test "it lets normal text go through" do
text = "hey how are you"
test "it lets normal text go through" do
text = "hey how are you"
@@
-17,6
+17,13
@@
defmodule Pleroma.Web.ActivityPub.ObjectValidators.Types.SafeTextTest do
assert {:ok, "hey look xss alert('foo')"} == SafeText.cast(text)
end
assert {:ok, "hey look xss alert('foo')"} == SafeText.cast(text)
end
+ test "it keeps basic html tags" do
+ text = "hey <a href='http://gensokyo.2hu'>look</a> xss <script>alert('foo')</script>"
+
+ assert {:ok, "hey <a href=\"http://gensokyo.2hu\">look</a> xss alert('foo')"} ==
+ SafeText.cast(text)
+ end
+
test "errors for non-text" do
assert :error == SafeText.cast(1)
end
test "errors for non-text" do
assert :error == SafeText.cast(1)
end