mirror of
https://gitee.com/kekingcn/file-online-preview.git
synced 2026-03-13 20:53:47 +08:00
test(security): verify CIDR matching for IPv4 upper boundary
This commit is contained in:
@@ -43,6 +43,15 @@ public class TrustHostFilterTests {
|
||||
assert !trustHostFilter.isNotTrustHost("199.1.2.3");
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldSupportIpv4UpperBoundaryCidrMatching() {
|
||||
ConfigConstants.setTrustHostValue("*");
|
||||
ConfigConstants.setNotTrustHostValue("255.255.255.255/32");
|
||||
|
||||
assert trustHostFilter.isNotTrustHost("255.255.255.255");
|
||||
assert !trustHostFilter.isNotTrustHost("255.255.255.254");
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldDenyWhenHostIsBlankOrNull() {
|
||||
ConfigConstants.setTrustHostValue("*");
|
||||
|
||||
Reference in New Issue
Block a user