fix: validate canLoginWebUi permission in middleware#4
Merged
Conversation
修复 key 不允许登陆 web 面板的设置无效的问题 **问题描述**: - 登录接口正确检查了 canLoginWebUi 权限 - 但中间件只检查 cookie 是否存在,没有重新验证 key 的权限 - 导致用户登录后,管理员修改 canLoginWebUi=false 时,用户仍可访问 dashboard **修复方案**: - 在 middleware 中调用 validateKey() 验证完整权限 - 包括 canLoginWebUi、isEnabled、expiresAt 等检查 - 如果验证失败,清除 cookie 并重定向到登录页 Fixes #3 Co-authored-by: Ding <ding113@users.noreply.github.com>
Contributor
|
Claude finished @ding113's task —— View job 代码审查完成 ✅任务清单
审查结果:✅ 批准合并这个 PR 很好地解决了 Issue #3 中描述的安全漏洞。代码质量高,逻辑清晰,修复方案完善。 优点
技术细节验证我已验证以下关键点:
建议(可选)虽然当前实现已经很好,但如果考虑性能优化,未来可以:
测试建议建议手动测试以下场景:
总结这是一个高质量的安全修复 PR,建议立即合并。修复方案简洁有效,没有引入不必要的复杂性,同时解决了多个相关的权限实时性问题。 |
Merged
This was referenced Jan 1, 2026
3 tasks
4 tasks
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.
修复 Bug: key 不允许登陆 web 面板的设置无效
问题描述
canLoginWebUi权限canLoginWebUi=false时,用户仍可访问 dashboard修复方案
validateKey()验证完整权限canLoginWebUi、isEnabled、expiresAt等检查Fixes #3
🤖 Generated with Claude Code