fix(security): support wildcard/cidr host pattern matching (#710)

* fix(security): support wildcard/cidr host pattern matching

* fix(security): harden host matching against null and DNS rebinding

* fix(security): handle ipv4 unsigned range and deny template fallback

* test(security): verify CIDR matching for IPv4 upper boundary

* fix(security): set UTF-8 deny response and use Locale.ROOT

* fix(security): enforce whitelist with blacklist and harden wildcard rules
This commit is contained in:
kl
2026-03-03 15:26:35 +08:00
committed by GitHub
parent 92ca92bee6
commit 8c3bc81e08
3 changed files with 253 additions and 7 deletions

View File

@@ -146,11 +146,15 @@ trust.host = *
### Q4: 如何允许子域名
目前不支持通配符域名匹配需要明确列出每个子域名
支持通配符域名匹配可使用 `*.example.com`
```properties
trust.host = cdn.example.com,api.example.com,storage.example.com
trust.host = *.example.com
```
说明
- `*.example.com` 会匹配 `cdn.example.com``api.internal.example.com`但不匹配根域 `example.com`
- 对于 IP 风格通配 `192.168.*``10.*`仅匹配字面量 IPv4 地址不匹配域名
## 🚨 安全事件响应
如果发现可疑的预览请求