Skip to content

fea: sec empUser saver#38

Open
aibot88 wants to merge 1 commit into
thinkgem:v5.springboot3from
aibot88:dev/sec/v5.springboot3
Open

fea: sec empUser saver#38
aibot88 wants to merge 1 commit into
thinkgem:v5.springboot3from
aibot88:dev/sec/v5.springboot3

Conversation

@aibot88
Copy link
Copy Markdown

@aibot88 aibot88 commented May 25, 2026

vuln-fix: Issue 1:organizations and post rebinding

Used interface

POST ${adminPath}/sys/empUser/save

Missing Porpety Checks

  • empUser.employee.office.officeCode
  • empUser.employee.company.companyCode
  • empUser.employee.employeePostList[].postCode
  • empUser.employee.employeeOfficeList[].officeCode
  • empUser.employee.employeeOfficeList[].postCode

@suansuaner
Copy link
Copy Markdown

suansuaner commented May 25, 2026 via email

@jsonxie
Copy link
Copy Markdown

jsonxie commented May 25, 2026 via email

@think-gem
Copy link
Copy Markdown
Member

谢谢您的 pr,我这有更好的方案,您参考一下:

查看 EmpUserController 的 get 方法,有添加 addDataScopeFilter 权限过滤

	@ModelAttribute
	public EmpUser get(String userCode, boolean isNewRecord, Boolean isAll, String ctrlPermi) {
		EmpUser empUser = new EmpUser();
		empUser.setUserCode(userCode);
		empUser.setIsNewRecord(isNewRecord);
		// 更严格的权限控制,对单条数据进行数据权限过滤(isAll 是一个开关,正常不需要添加)
		if (StringUtils.isNotBlank(userCode) && !(isAll != null && isAll) || Global.isStrictMode()) {
			empUserService.addFieldScopeFilter(empUser);
			empUserService.addDataScopeFilter(empUser, ctrlPermi);
		}
		return empUserService.getAndValid(empUser);
	}

修改 EmpUserServiceSupport 的 get 方法,super.get修改为 super.getByEntity 支持实体中的查询条件配置

	@Override
	public EmpUser get(EmpUser empUser) {
		return super.getByEntity(empUser);
	}

配置后,如果当前用户无权限,则无法获取到对应用户信息。这样就就无法对该数据进行操作。

当获取不到信息时,可能会认为新增数据,这时会有 登录名 员工账号 等重复校验。

@aibot88
Copy link
Copy Markdown
Author

aibot88 commented May 26, 2026 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants