mirror of
https://github.com/jeecgboot/JeecgBoot.git
synced 2026-11-18 08:40:29 +00:00
fix(security): 表字典查询ds自定义数据源旁路白/黑名单校验 GHSA-8j27/GHSA-x8p6
SysDictServiceImpl.queryTableDictTextByKeys 把白名单(dictTableWhiteListCheckByDict) 与黑名单(DictQueryBlackListHandler)校验放在 if(!isCustomDataSource) 内, 登录用户传入 ds=master 等已注册数据源名即可整段跳过,越权读取任意表任意列 (sys_user.email/realname 等PII、sys_tenant、sys_third_account 等)。 改为无条件执行白/黑名单校验,与同文件其余调用保持一致。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
997404e615
commit
98681e17ff
@ -410,19 +410,17 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
||||
public List<DictModel> queryTableDictTextByKeys(String table, String text, String code, List<String> codeValues, String dataSource) {
|
||||
SensitiveTableCheckUtil.checkForbiddenFields(table, text, code);
|
||||
String str = table+","+text+","+code;
|
||||
//update-begin---author:chenrui ---date:20231221 for:[issues/#5643]解决分布式下表字典跨库无法查询问题------------
|
||||
// 是否自定义数据源
|
||||
boolean isCustomDataSource = oConvertUtils.isNotEmpty(dataSource);
|
||||
// 如果是自定义数据源就不检查表字典白名单
|
||||
if (!isCustomDataSource) {
|
||||
// 【QQYUN-6533】表字典白名单check
|
||||
sysBaseAPI.dictTableWhiteListCheckByDict(table, text, code);
|
||||
// 1.表字典黑名单check
|
||||
if (!dictQueryBlackListHandler.isPass(str)) {
|
||||
log.error(dictQueryBlackListHandler.getError());
|
||||
return null;
|
||||
}
|
||||
//update-begin---author:scott ---date:20261013 for:【安全 GHSA-8j27-4v3v-m7xf/GHSA-x8p6-4wjm-5gg2】表字典白名单/黑名单校验不再因传入自定义数据源(如ds=master)而跳过,防止绕过校验越权读取任意表任意列(含sys_user.password)-----------
|
||||
// 【QQYUN-6533】表字典白名单check(无论是否自定义数据源都要校验表名/字段)
|
||||
sysBaseAPI.dictTableWhiteListCheckByDict(table, text, code);
|
||||
// 1.表字典黑名单check
|
||||
if (!dictQueryBlackListHandler.isPass(str)) {
|
||||
log.error(dictQueryBlackListHandler.getError());
|
||||
return null;
|
||||
}
|
||||
//update-end---author:scott ---date:20261013 for:【安全 GHSA-8j27-4v3v-m7xf/GHSA-x8p6-4wjm-5gg2】表字典白名单/黑名单校验不再因传入自定义数据源而跳过-----------
|
||||
|
||||
// 2.分割SQL获取表名和条件
|
||||
String filterSql = null;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user