作者 RuoYi

修复两处存在SQL注入漏洞问题

@@ -66,6 +66,7 @@ public class DataScopeAspect @@ -66,6 +66,7 @@ public class DataScopeAspect
66 @Before("dataScopePointCut()") 66 @Before("dataScopePointCut()")
67 public void doBefore(JoinPoint point) throws Throwable 67 public void doBefore(JoinPoint point) throws Throwable
68 { 68 {
  69 + clearDataScope(point);
69 handleDataScope(point); 70 handleDataScope(point);
70 } 71 }
71 72
@@ -166,4 +167,17 @@ public class DataScopeAspect @@ -166,4 +167,17 @@ public class DataScopeAspect
166 } 167 }
167 return null; 168 return null;
168 } 169 }
  170 +
  171 + /**
  172 + * 拼接权限sql前先清空params.dataScope参数防止注入
  173 + */
  174 + private void clearDataScope(final JoinPoint joinPoint)
  175 + {
  176 + Object params = joinPoint.getArgs()[0];
  177 + if (StringUtils.isNotNull(params) && params instanceof BaseEntity)
  178 + {
  179 + BaseEntity baseEntity = (BaseEntity) params;
  180 + baseEntity.getParams().put(DATA_SCOPE, "");
  181 + }
  182 + }
169 } 183 }
@@ -147,7 +147,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -147,7 +147,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
147 <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> 147 <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
148 update_time = sysdate() 148 update_time = sysdate()
149 </set> 149 </set>
150 - where dept_id in (${ancestors}) 150 + where find_in_set(#{deptId}, ancestors)
151 </update> 151 </update>
152 152
153 <delete id="deleteDeptById" parameterType="Long"> 153 <delete id="deleteDeptById" parameterType="Long">