Sign in
Sign up
Explore
Enterprise
Education
Search
Help
Terms of use
About Us
Explore
Enterprise
Education
Gitee Premium
Gitee AI
AI teammates
Sign in
Sign up
Fetch the repository succeeded.
Open Source
>
Web Development
>
Backend Management
&&
Donate
Please sign in before you donate.
Cancel
Sign in
Scan WeChat QR to Pay
Cancel
Complete
Prompt
Switch to Alipay.
OK
Cancel
Watch
Unwatch
Watching
Releases Only
Ignoring
6.2K
Star
48.2K
Fork
26.8K
GVP
若依
/
RuoYi
Code
Issues
2
Pull Requests
11
Wiki
Insights
Pipelines
Service
JavaDoc
Quality Analysis
Jenkins for Gitee
Tencent CloudBase
Tencent Cloud Serverless
悬镜安全
Aliyun SAE
Codeblitz
SBOM
DevLens
Don’t show this again
Update failed. Please try again later!
Remove this flag
Content Risk Flag
This task is identified by
as the content contains sensitive information such as code security bugs, privacy leaks, etc., so it is only accessible to contributors of this repository.
sysProfileController.java:update函数可能存在越权漏洞
Done
#IDIDK2
old6ma
Opened this issue
2026-01-08 09:45
sysProfileController.java:update函数调用SysUserServiceImpl.java:updateUserInfo,其功能是更新用户的信息,但是缺少checkUserDataScope用于检查当前用户可以访问的数据范围,可能导致用户可以修改合法数据范围外的信息,需要确认所有访问该接口的用户是否已经被认证为当前登录用户,否则应添加相关的权限检查或数据访问范围检查代码 sysProfileController.java:update: ``` /** * 修改用户 */ @Log(title = "个人信息", businessType = BusinessType.UPDATE) @PostMapping("/update") @ResponseBody public AjaxResult update(SysUser user) { SysUser currentUser = getSysUser(); currentUser.setUserName(user.getUserName()); currentUser.setEmail(user.getEmail()); currentUser.setPhonenumber(user.getPhonenumber()); currentUser.setSex(user.getSex()); if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(currentUser)) { return error("修改用户'" + currentUser.getLoginName() + "'失败,手机号码已存在"); } else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(currentUser)) { return error("修改用户'" + currentUser.getLoginName() + "'失败,邮箱账号已存在"); } if (userService.updateUserInfo(currentUser) > 0) { setSysUser(userService.selectUserById(currentUser.getUserId())); return success(); } return error(); } ``` SysUserServiceImpl.java:updateUserInfo ``` /** * 修改用户个人详细信息 * * @param user 用户信息 * @return 结果 */ @Override public int updateUserInfo(SysUser user) { return userMapper.updateUser(user); } ``` 建议添加代码: ``` checkUserDataScope(user.getId()) ```
sysProfileController.java:update函数调用SysUserServiceImpl.java:updateUserInfo,其功能是更新用户的信息,但是缺少checkUserDataScope用于检查当前用户可以访问的数据范围,可能导致用户可以修改合法数据范围外的信息,需要确认所有访问该接口的用户是否已经被认证为当前登录用户,否则应添加相关的权限检查或数据访问范围检查代码 sysProfileController.java:update: ``` /** * 修改用户 */ @Log(title = "个人信息", businessType = BusinessType.UPDATE) @PostMapping("/update") @ResponseBody public AjaxResult update(SysUser user) { SysUser currentUser = getSysUser(); currentUser.setUserName(user.getUserName()); currentUser.setEmail(user.getEmail()); currentUser.setPhonenumber(user.getPhonenumber()); currentUser.setSex(user.getSex()); if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(currentUser)) { return error("修改用户'" + currentUser.getLoginName() + "'失败,手机号码已存在"); } else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(currentUser)) { return error("修改用户'" + currentUser.getLoginName() + "'失败,邮箱账号已存在"); } if (userService.updateUserInfo(currentUser) > 0) { setSysUser(userService.selectUserById(currentUser.getUserId())); return success(); } return error(); } ``` SysUserServiceImpl.java:updateUserInfo ``` /** * 修改用户个人详细信息 * * @param user 用户信息 * @return 结果 */ @Override public int updateUserInfo(SysUser user) { return userMapper.updateUser(user); } ``` 建议添加代码: ``` checkUserDataScope(user.getId()) ```
Comments (
1
)
Sign in
to comment
Status
Done
Backlog
Doing
Done
Closed
Assignees
Not set
Labels
Not set
Label settings
Milestones
No related milestones
No related milestones
Pull Requests
None yet
None yet
Successfully merging a pull request will close this issue.
Branches
No related branch
Branches (
-
)
Tags (
-
)
Planed to start   -   Planed to end
-
Top level
Not Top
Top Level: High
Top Level: Medium
Top Level: Low
Priority
Not specified
Serious
Main
Secondary
Unimportant
参与者(2)
Java
1
https://gitee.com/y_project/RuoYi.git
git@gitee.com:y_project/RuoYi.git
y_project
RuoYi
RuoYi
Going to Help Center
Search
Git 命令在线学习
如何在 Gitee 导入 GitHub 仓库
Git 仓库基础操作
企业版和社区版功能对比
SSH 公钥设置
如何处理代码冲突
仓库体积过大,如何减小?
如何找回被删除的仓库数据
Gitee 产品配额说明
GitHub仓库快速导入Gitee及同步更新
什么是 Release(发行版)
将 PHP 项目自动发布到 packagist.org
Comment
Repository Report
Back to the top
Login prompt
This operation requires login to the code cloud account. Please log in before operating.
Go to login
No account. Register