docs(plans): 增加 K16 注册限流配置化计划

This commit is contained in:
Zhou Weidong committed 2026-10-17 23:16:51 +08:00
1 parent 461fb8ea15
commit 3403a521eb
1 file changed
+35
+35
View File
@@ -0,0 +1,35 @@
# 2026-10-17 K16 注册限流可配置
## 范围
将 C 端注册的 IP/设备 24 小时限流阈值从硬编码改为 Spring 配置:
```text
fruitshorts.auth.register-max-per-ip-per-day
fruitshorts.auth.register-max-per-device-per-day
```
默认值保持 5/3;值小于等于 0 时跳过对应 guard。注册接口、错误码和错误文案不变。
## 实现
1. `AppAuthService` 用 `@Value` 字段注入阈值,保留现有 Lombok 构造器。
2. 开发 `application.yml` 显式配置 0/0,并注释生产建议 5/3。
3. `application-prod.yml` 显式配置 5/3。
4. `docs/api-phase1.md` §1.1 补充配置键和 0=不限制口径。
5. 测试用 `ReflectionTestUtils` 注入阈值,覆盖 IP/设备超限、IP 不限制、设备不限制。
## 验证与交付
- `mvn test`
- `mvn -pl fruitshorts-app-api -am package -DskipTests`
- 停止当前 8081 PID 30520,启动新 jar,`/healthz` 通过
- 使用新设备号连续注册至少 4 次,确认不再 429(接口自检)
- `feature/backend-register-rate-config` 以 `--no-ff` 合并回 `develop` 并 push
- PROGRESS 记录命令、原始输出和解读
## 风险
- 配置 0 会关闭注册滥用保护,仅用于当前开发环境;prod profile 固定恢复 5/3。
- 旧 8081 服务重启期间会有短暂不可用。
- 限流仍基于客户端可伪造 IP/设备号,本次不放宽其他风控。