Repository navigation
Conversation
Owner
Author
|
结论:放行(pass)。真跑: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
改动
src/auth/throttle.py:新增('U', username)跨 IP 用户名窗口(模块级常量username_window_seconds=600/max_per_username_global=20,带取值依据注释)。check在哈希后按它拒绝(保证密码正确一定放行,不把爆破换成账号锁定 DoS),record_failure同时记u/U,record_success一并清空;用户名键统一strip+lower;_prune/_evict_over_capacity/_at_limit按键取窗口长度,已锁键淘汰时排最后。PROPOSAL.md:登录限流条目改为三级窗口。tests/auth/test_throttle.py新增 6 个用例(多 IP 同名被锁、其他用户不受影响、哈希前不拒、10 分钟窗口、大小写/空格归一化、成功清除、淘汰候选识别);tests/webapp/test_security.py新增登录端点端到端用例(429 同构文案 + 其他用户名不受影响 + 成功清计数)。不变:
max_per_ip=8/60s、max_per_user=5/60s、max_global仍只观测不拒绝、无持久化 / 跨实例共享、无 DB schema 与 API 契约变更。验证