From 7ded8514ac13b05aa7df53e35484725dbfdf74b9 Mon Sep 17 00:00:00 2001 From: "lancer.hong" Date: Wed, 21 Jul 2021 10:43:36 +0800 Subject: [PATCH] If ip whitelist of app is "1.2.3.6-8,1.2.3.86-88", and "1.2.3.6-8" "1.2.3.86-88" have some subnet "1.2.3", then "1.2.3.6-8" will be lost #255 --- fizz-core/src/main/java/we/plugin/auth/App.java | 2 +- fizz-core/src/test/java/we/plugin/auth/AppTests.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fizz-core/src/main/java/we/plugin/auth/App.java b/fizz-core/src/main/java/we/plugin/auth/App.java index efb0039..3d89a84 100644 --- a/fizz-core/src/main/java/we/plugin/auth/App.java +++ b/fizz-core/src/main/java/we/plugin/auth/App.java @@ -81,7 +81,7 @@ public class App { String subnet = ip.substring(0, i).trim(); String addrSeg = ip.substring(i + 1).trim(); if ("*".equals(addrSeg)) { - this.ips.put(subnet, Collections.singletonList(new String[]{"2", "254"})); + this.ips.put(subnet, Collections.singletonList(new String[]{"1", "255"})); } else if (addrSeg.indexOf('-') > 0) { String[] a = StringUtils.split(addrSeg, '-'); String beg = a[0].trim(); diff --git a/fizz-core/src/test/java/we/plugin/auth/AppTests.java b/fizz-core/src/test/java/we/plugin/auth/AppTests.java index c4e2ffd..6f07a41 100644 --- a/fizz-core/src/test/java/we/plugin/auth/AppTests.java +++ b/fizz-core/src/test/java/we/plugin/auth/AppTests.java @@ -22,9 +22,9 @@ public class AppTests { allow = app.allow("10.237.148.134"); assertTrue(allow); - allow = app.allow("172.25.102.2"); + allow = app.allow("172.25.102.1"); assertTrue(allow); - allow = app.allow("172.25.102.254"); + allow = app.allow("172.25.102.255"); assertTrue(allow); allow = app.allow("172.25.102.3"); assertTrue(allow);