From 98681e17ff3a892f21d7b95546dfcba438eaf5ed Mon Sep 17 00:00:00 2001 From: zhangdaiscott Date: Tue, 13 Oct 2026 12:02:50 -0400 Subject: [PATCH] =?UTF-8?q?fix(security):=20=E8=A1=A8=E5=AD=97=E5=85=B8?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2ds=E8=87=AA=E5=AE=9A=E4=B9=89=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=BA=90=E6=97=81=E8=B7=AF=E7=99=BD/=E9=BB=91?= =?UTF-8?q?=E5=90=8D=E5=8D=95=E6=A0=A1=E9=AA=8C=20GHSA-8j27/GHSA-x8p6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../service/impl/SysDictServiceImpl.java | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysDictServiceImpl.java b/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysDictServiceImpl.java index ed3c0f3f3..eed338a5a 100644 --- a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysDictServiceImpl.java +++ b/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysDictServiceImpl.java @@ -410,19 +410,17 @@ public class SysDictServiceImpl extends ServiceImpl impl public List queryTableDictTextByKeys(String table, String text, String code, List 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;