feat: 新增 SaFirewallCheckHookForPathBannedCharacter 禁用字符校验

This commit is contained in:
click33
2025-02-28 05:26:50 +08:00
parent 6c55de0ef3
commit 8f51d1af8d
4 changed files with 90 additions and 6 deletions

View File

@@ -15,6 +15,10 @@
*/
package cn.dev33.satoken.core.util;
import cn.dev33.satoken.util.SaFoxUtil;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import java.time.Instant;
import java.time.ZoneId;
import java.time.ZonedDateTime;
@@ -23,11 +27,6 @@ import java.util.Arrays;
import java.util.List;
import java.util.Map;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import cn.dev33.satoken.util.SaFoxUtil;
/**
* SaFoxUtil 工具类测试
*
@@ -401,4 +400,12 @@ public class SaFoxUtilTest {
Assertions.assertEquals(list.get(2), "c");
}
@Test
public void hasNonPrintableASCII() {
Assertions.assertFalse(SaFoxUtil.hasNonPrintableASCII("Hello World!"));
Assertions.assertTrue(SaFoxUtil.hasNonPrintableASCII("Hello\u0007World"));
Assertions.assertTrue(SaFoxUtil.hasNonPrintableASCII("Hello\tWorld"));
Assertions.assertTrue(SaFoxUtil.hasNonPrintableASCII("Hello\nWorld"));
}
}