1 defmodule Pleroma.Object.ContainmentTest do
4 alias Pleroma.Object.Containment
9 describe "general origin containment" do
10 test "contain_origin_from_id() catches obvious spoofing attempts" do
12 "id" => "http://example.com/~alyssa/activities/1234.json"
16 Containment.contain_origin_from_id(
17 "http://example.org/~alyssa/activities/1234.json",
22 test "contain_origin_from_id() allows alternate IDs within the same origin domain" do
24 "id" => "http://example.com/~alyssa/activities/1234.json"
28 Containment.contain_origin_from_id(
29 "http://example.com/~alyssa/activities/1234",
34 test "contain_origin_from_id() allows matching IDs" do
36 "id" => "http://example.com/~alyssa/activities/1234.json"
40 Containment.contain_origin_from_id(
41 "http://example.com/~alyssa/activities/1234.json",
46 test "users cannot be collided through fake direction spoofing attempts" do
49 nickname: "rye@niu.moe",
51 ap_id: "https://niu.moe/users/rye",
52 follower_address: User.ap_followers(%User{nickname: "rye@niu.moe"})
55 {:error, _} = User.get_or_fetch_by_ap_id("https://n1u.moe/users/rye")