diff options
author | Haelwenn <contact+git.pleroma.social@hacktivis.me> | 2024-02-20 10:52:46 +0000 |
---|---|---|
committer | Haelwenn <contact+git.pleroma.social@hacktivis.me> | 2024-02-20 10:52:46 +0000 |
commit | f0468697cd74f4ec062f9c6feda53cfbe9e4500c (patch) | |
tree | 8c19daa6ac627ab8797eb90e96b028f2e182232b /test | |
parent | 0b9bc4a0d0e44a873bc59e8994f1996499ed0c4b (diff) | |
parent | e149ee6e225667ca964e30a08179ca84b8537aaf (diff) | |
download | pleroma-f0468697cd74f4ec062f9c6feda53cfbe9e4500c.tar.gz pleroma-f0468697cd74f4ec062f9c6feda53cfbe9e4500c.zip |
Merge branch 'mergeback/2.6.2' into 'develop'
Mergeback: Security Release 2.6.2
Closes #3245
See merge request pleroma/pleroma!4075
Diffstat (limited to 'test')
-rw-r--r-- | test/pleroma/web/activity_pub/mrf/steal_emoji_policy_test.exs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/pleroma/web/activity_pub/mrf/steal_emoji_policy_test.exs b/test/pleroma/web/activity_pub/mrf/steal_emoji_policy_test.exs index c477a093d..2c7497da5 100644 --- a/test/pleroma/web/activity_pub/mrf/steal_emoji_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/steal_emoji_policy_test.exs @@ -87,6 +87,32 @@ defmodule Pleroma.Web.ActivityPub.MRF.StealEmojiPolicyTest do assert File.exists?(fullpath) end + test "rejects invalid shortcodes", %{path: path} do + message = %{ + "type" => "Create", + "object" => %{ + "emoji" => [{"fired/fox", "https://example.org/emoji/firedfox"}], + "actor" => "https://example.org/users/admin" + } + } + + fullpath = Path.join(path, "fired/fox.png") + + Tesla.Mock.mock(fn %{method: :get, url: "https://example.org/emoji/firedfox"} -> + %Tesla.Env{status: 200, body: File.read!("test/fixtures/image.jpg")} + end) + + clear_config(:mrf_steal_emoji, hosts: ["example.org"], size_limit: 284_468) + + refute "firedfox" in installed() + refute File.exists?(path) + + assert {:ok, _message} = StealEmojiPolicy.filter(message) + + refute "fired/fox" in installed() + refute File.exists?(fullpath) + end + test "reject regex shortcode", %{message: message} do refute "firedfox" in installed() |