feat(backend): 注册限流阈值改为可配置
This commit is contained in:
1 parent
3403a521eb
commit
758eb69f55
5 files changed
+73
-11
No files matched your search
+13
-2
@@ -113,10 +113,21 @@ POST /app/auth/register
|
||||
| `targetType=PHONE` | 维持原状:`code` **必填** |
|
||||
| 邮箱规范化 | 去空格 + 转小写(`batch1@Example.com ` → `batch1@example.com`);格式不合法直接 `400 邮箱格式不正确` |
|
||||
| 密码强度 | 8–64 位,且**同时包含字母与数字**(不强制特殊字符:低端机输入成本高,拦机器注册靠频控) |
|
||||
| 注册频控 | 同 IP 24h ≤ **5** 个、同设备 24h ≤ **3** 个,超出返回 `429`(`TOO_MANY_REQUESTS`) |
|
||||
| 注册频控 | 同 IP / 同设备 24h 默认上限分别为 5 / 3 个,超出返回 `429`(`TOO_MANY_REQUESTS`) |
|
||||
| 邮箱验证状态 | 免码注册时 `app_user_credential.verified = 0`(保留"待验证"),**不阻塞登录**;只有**验证码登录**会把 `verified` 置 1,密码登录不改变该状态 |
|
||||
|
||||
频控口径落库在 `app_user.register_ip` / `register_device_id` 上(按 24h 计数,不新建计数表)。
|
||||
频控口径落库在 `app_user.register_ip` / `app_user.register_device_id` 上(按 24h 计数,不新建计数表)。
|
||||
|
||||
注册频控阈值通过以下配置键调整:
|
||||
|
||||
```text
|
||||
fruitshorts.auth.register-max-per-ip-per-day
|
||||
fruitshorts.auth.register-max-per-device-per-day
|
||||
```
|
||||
|
||||
未配置时默认 5 / 3;值小于等于 0 表示对应维度不限制。开发
|
||||
`application.yml` 显式设为 0 / 0,`application-prod.yml` 固定为 5 / 3。
|
||||
|
||||
**残留风险**:IP 取自 `X-Forwarded-For`、设备号由客户端上报,都能伪造,只能挡脚本批量;
|
||||
真要防住需要接图形/行为验证码或风控服务,本阶段未做。验证码通道目前是 `LogOtpSender`(只写日志不发信),
|
||||
所以邮箱**可达性**未验证 —— 这也是"不阻塞注册"的前提。
|
||||
|
||||
Reference in new issue
Block a user