X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;ds=sidebyside;f=test%2Fplugs%2Fremote_ip_test.exs;h=6d01c812de291379aab4c9c6c1f7fb1cf515f2ce;hb=66e00ace7c0708f2f9361bc6e1008ccea08cb6ef;hp=849c7fc3da4fea6e8ed30d502ecfb05cacb5f19c;hpb=9783e9cd8023533d05bf78e3db3375102a199fc0;p=akkoma diff --git a/test/plugs/remote_ip_test.exs b/test/plugs/remote_ip_test.exs index 849c7fc3d..6d01c812d 100644 --- a/test/plugs/remote_ip_test.exs +++ b/test/plugs/remote_ip_test.exs @@ -93,4 +93,16 @@ defmodule Pleroma.Plugs.RemoteIpTest do assert conn.remote_ip == {1, 1, 1, 1} end + + test "proxies set `nonsensical` CIDR" do + Pleroma.Config.put([RemoteIp, :reserved], ["127.0.0.0/8"]) + Pleroma.Config.put([RemoteIp, :proxies], ["10.0.0.3/24"]) + + conn = + conn(:get, "/") + |> put_req_header("x-forwarded-for", "10.0.0.3, 1.1.1.1") + |> RemoteIp.call(nil) + + assert conn.remote_ip == {1, 1, 1, 1} + end end