mirror of
https://gitee.com/kekingcn/file-online-preview.git
synced 2026-03-13 20:53:47 +08:00
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:
@@ -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 地址,不匹配域名
|
||||
|
||||
## 🚨 安全事件响应
|
||||
|
||||
如果发现可疑的预览请求:
|
||||
|
||||
Reference in New Issue
Block a user