mirror of
https://github.com/netbirdio/netbird.git
synced 2026-09-23 23:29:08 +02:00
Accept an explicit empty allow_match as the default and cover the CIDR short-circuit against a country blocklist
This commit is contained in:
@@ -284,6 +284,13 @@ func TestFilter_Check_AllowMatchAny(t *testing.T) {
|
||||
config: FilterConfig{AllowMatch: AllowMatchAny, AllowedCIDRs: []string{"203.0.113.0/24"}, AllowedCountries: []string{"US"}},
|
||||
addr: "1.1.1.1", geo: &unavailableGeo{}, want: DenyGeoUnavailable,
|
||||
},
|
||||
{
|
||||
// The CIDR short-circuit must not skip the country blocklist: with geo
|
||||
// down the address cannot be cleared against it, so it fails closed.
|
||||
name: "CIDR match still needs geo for a country blocklist",
|
||||
config: FilterConfig{AllowMatch: AllowMatchAny, AllowedCIDRs: []string{"203.0.113.0/24"}, BlockedCountries: []string{"CN"}},
|
||||
addr: "203.0.113.7", geo: &unavailableGeo{}, want: DenyGeoUnavailable,
|
||||
},
|
||||
{
|
||||
name: "block gate wins over allowed CIDR (blocked country)",
|
||||
config: FilterConfig{AllowMatch: AllowMatchAny, AllowedCIDRs: []string{"0.0.0.0/0"}, BlockedCountries: []string{"CN"}},
|
||||
|
||||
Reference in New Issue
Block a user