V4.0 安全扩展:29个新模块 + 60项API端点 + 164项新测试全部通过

新增模块(5组29个):

反作弊扩展(6个):
- AntiKillAuraService: 杀戮光环检测(攻击频率/目标切换/旋转角度)
- AntiReachService: 超距攻击检测(攻击距离/位置回溯验证)
- AntiSpeedService: 水平速度检测(移动速度/GroundSpoof异常)
- AntiJesusService: 水上行走检测(水面/岩浆面移动验证)
- AntiNoFallService: 无摔落伤害检测(落地检测/伤害验证)
- AntiScaffoldService: 自动搭路检测(方块放置频率/角度/速度)

玩家行为安全(6个):
- AntiNukerService: 快速破坏检测(挖矿速度/范围/模式识别)
- AntiAutoClickerService: 自动点击检测(CPS统计/点击间隔熵值分析)
- AntiChestStealService: 自动偷箱检测(开箱/取物速度模式识别)
- AntiAutoFishService: 自动钓鱼检测(钓鱼行为时序/反应速度)
- AntiInventoryManipulationService: 背包操作检测(非法丢弃/槽位异常)
- AntiBaritoneService: AI寻路机器人检测(路径平滑度/行为重复率)

服务器保护(6个):
- PacketFloodProtectionService: 数据包洪水防护(窗口/递增惩罚机制)
- AntiSignExploitService: 告示牌漏洞防护(超长JSON/NBT/命令注入)
- AntiBookBanService: 书与笔漏洞防护(超大页码/翻译键滥用/命令注入)
- AntiResourcePackExploitService: 资源包漏洞防护(内网SSRF/SHA-1黑名单)
- AntiTabCompleteCrashService: Tab补全崩溃防护(深度嵌套/洪水/无效UTF-8)
- AntiOfflineModeSpoofService: 离线UUID欺诈防护(格式校验/IP-UUID关联)

访问控制(6个):
- OPPrivilegeMonitorService: OP权限监控(权限变更/敏感命令审计)
- ConfigTamperDetectionService: 配置文件篡改检测(SHA-256基线监控)
- BackdoorPluginScannerService: 后门插件扫描(恶意类名/远程执行检测)
- AntiVPNProxyService: VPN代理检测(托管ASN/IP范围匹配)
- AntiAltAccountService: 小号检测(IP关联/行为相似度/封禁逃逸)
- AntiNameSpoofService: 名称冒充检测(Unicode同形字/空白字符/编辑距离)

聊天社交安全(5个):
- ChatFloodProtectionService: 聊天洪水防护(双窗口频率/相似度/递增静音)
- AntiAdvertisementService: 广告检测(IP/域名/QQ群/Discord邀请正则)
- AntiPhishingLinkService: 钓鱼链接检测(短链接/可疑域名/显示文本不匹配)
- AntiCommandAbuseService: 命令滥用检测(洪水/插件探测/Shell注入)
- PlayerPrivacyService: 玩家隐私保护(IP脱敏/GDPR合规/数据保留策略)

配置与API:
- ServerGuardConfig新增29个boolean开关(默认true),全部独立可控
- application.yml新增29行YAML配置(含中文注释说明功能)
- DashboardController整合29个新服务,新增60个REST API端点(总计108个端点)
- 所有模块使用双构造函数(无参+@Autowired)、静态结果类工厂方法

测试:新增5个测试类164项测试,全部通过(全项目278项/17测试类/159源文件)

修复:
- AntiBookBanService: helper方法改为返回int得分贡献,修复translate/score/clickEvent检测不生效
- AntiResourcePackExploitService: 修复Set.of()中.vbs重复导致ExceptionInInitializer
- AntiTabCompleteCrashService: 深度嵌套得分提高至75(触发blocked阈值)
- AntiOfflineModeSpoofService: 快速UUID切换得分提高至75(触发blocked阈值)
- PacketFloodProtectionService: 重构检测流程,移除提前返回导致的检测屏蔽
This commit is contained in:
Peijun Zhao
2026-05-16 11:47:59 +08:00
parent f82fb616cc
commit 1269d4dfa5
37 changed files with 13890 additions and 1 deletions
+34
View File
@@ -184,6 +184,40 @@ serverguard:
connection-throttle: true # 连接速率限制(IP/时间窗口/递增延迟)
backup-integrity: true # 备份完整性校验(SHA-256/文件计数/大小对比)
anti-skin-spoof: true # 皮肤伪造检测(模型数据异常/皮肤URL检测)
# === V4.0 反作弊扩展模块 ===
anti-kill-aura: true # 杀戮光环检测(攻击频率/目标切换/旋转角度)
anti-reach: true # 超距攻击检测(攻击距离/位置回溯验证)
anti-speed: true # 水平速度检测(移动速度/GroundSpoof异常)
anti-jesus: true # 水上行走检测(水面/岩浆面移动验证)
anti-no-fall: true # 无摔落伤害检测(落地检测/伤害验证)
anti-scaffold: true # 自动搭路检测(方块放置频率/角度/速度)
# === V4.0 玩家行为安全模块 ===
anti-nuker: true # 快速破坏检测(挖矿速度/范围/模式识别)
anti-auto-clicker: true # 自动点击检测(CPS统计/点击间隔熵值分析)
anti-chest-steal: true # 自动偷箱检测(开箱/取物速度模式识别)
anti-auto-fish: true # 自动钓鱼检测(钓鱼行为时序/反应速度)
anti-inventory-manipulation: true # 背包操作检测(非正常速度/非法槽位操作)
anti-baritone: true # AI寻路机器人检测(路径平滑度/行为重复率)
# === V4.0 服务器保护模块 ===
packet-flood-protection: true # 数据包洪水防护(窗口/自定义负载/品牌包限制)
anti-sign-exploit: true # 告示牌漏洞防护(超长JSON/无效组件/NBT炸弹)
anti-book-ban: true # 书与笔封禁防护(超大页码/超深JSON层级)
anti-resource-pack-exploit: true # 资源包漏洞防护(恶意URL/超大文件/格式校验)
anti-tab-complete-crash: true # Tab补全崩溃防护(长文本/深度嵌套补全限制)
anti-offline-mode-spoof: true # 离线UUID欺诈防护(正版UUID冲突/IP关联验证)
# === V4.0 访问控制模块 ===
op-privilege-monitor: true # OP权限监控(权限变更/敏感命令执行审计)
config-tamper-detection: true # 配置文件篡改检测(Hash基线/实时监控ops/whitelist)
backdoor-plugin-scanner: true # 后门插件扫描(已知恶意类名/远程执行/隐藏命令)
anti-vpn-proxy: true # VPN代理检测(已知VPN IP库/托管ASN匹配)
anti-alt-account: true # 小号检测(IP关联/行为相似度/登录时间模式)
anti-name-spoof: true # 名称冒充检测(管理员/知名玩家昵称伪造)
# === V4.0 聊天社交安全模块 ===
chat-flood-protection: true # 聊天洪水防护(消息频率/相似度/长度激增)
anti-advertisement: true # 广告检测(IP地址/域名/群号正则匹配)
anti-phishing-link: true # 钓鱼链接检测(可疑域名/短链接/SSL证书校验)
anti-command-abuse: true # 命令滥用检测(频率限制/敏感命令拦截/权限校验)
player-privacy: true # 玩家隐私保护(IP脱敏/坐标隐藏/日志匿名化)
dashboard:
enabled: true