From 3403a521eb646b4176eeee76dddbe3b98d27050e Mon Sep 17 00:00:00 2001 From: Zhou Weidong <502333560@qq.com> Date: Sat, 17 Oct 2026 23:16:51 +0800 Subject: [PATCH] =?UTF-8?q?docs(plans):=20=E5=A2=9E=E5=8A=A0=20K16=20?= =?UTF-8?q?=E6=B3=A8=E5=86=8C=E9=99=90=E6=B5=81=E9=85=8D=E7=BD=AE=E5=8C=96?= =?UTF-8?q?=E8=AE=A1=E5=88=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/plans/2026-10-17-K16.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 docs/plans/2026-10-17-K16.md diff --git a/docs/plans/2026-10-17-K16.md b/docs/plans/2026-10-17-K16.md new file mode 100644 index 0000000..55f64c6 --- /dev/null +++ b/docs/plans/2026-10-17-K16.md @@ -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/设备号,本次不放宽其他风控。