ip bans: allow full bans to overlap partial bans.

Allow full banning an IP that is part of a subnet that has already been
partially banned.
This commit is contained in:
evazion
2021-03-23 00:34:35 -05:00
parent d906de8192
commit 41e0cad458
2 changed files with 8 additions and 1 deletions

View File

@@ -16,6 +16,13 @@ class IpBanTest < ActiveSupport::TestCase
assert(IpBan.ip_matches("1.2.3.255").exists?)
end
should "allow a full ban to overlap a partial ban" do
@ip_ban1 = create(:ip_ban, ip_addr: "1.2.3.0/24", category: :partial)
@ip_ban2 = build(:ip_ban, ip_addr: "1.2.3.4", category: :full)
assert_equal(true, @ip_ban2.valid?)
end
context "validation" do
setup { create(:ip_ban, ip_addr: "5.6.7.8") }
subject { build(:ip_ban) }