mirror of
https://gitee.com/kekingcn/file-online-preview.git
synced 2026-03-25 18:43:50 +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");
|
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
|
@Test
|
||||||
void shouldDenyWhenHostIsBlankOrNull() {
|
void shouldDenyWhenHostIsBlankOrNull() {
|
||||||
ConfigConstants.setTrustHostValue("*");
|
ConfigConstants.setTrustHostValue("*");
|
||||||
|
|||||||
Reference in New Issue
Block a user