Browse Source

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

tags/v3.0.0
RuoYi 4 years ago
parent
commit
af479c7838
  1. 14
      ruoyi-common/ruoyi-common-datascope/src/main/java/com/ruoyi/common/datascope/aspect/DataScopeAspect.java
  2. 2
      ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml

14
ruoyi-common/ruoyi-common-datascope/src/main/java/com/ruoyi/common/datascope/aspect/DataScopeAspect.java

@ -68,6 +68,7 @@ public class DataScopeAspect
@Before("dataScopePointCut()") @Before("dataScopePointCut()")
public void doBefore(JoinPoint point) throws Throwable public void doBefore(JoinPoint point) throws Throwable
{ {
clearDataScope(point);
handleDataScope(point); handleDataScope(point);
} }
@ -169,4 +170,17 @@ public class DataScopeAspect
} }
return null; return null;
} }
/**
* 拼接权限sql前先清空params.dataScope参数防止注入
*/
private void clearDataScope(final JoinPoint joinPoint)
{
Object params = joinPoint.getArgs()[0];
if (StringUtils.isNotNull(params) && params instanceof BaseEntity)
{
BaseEntity baseEntity = (BaseEntity) params;
baseEntity.getParams().put(DATA_SCOPE, "");
}
}
} }

2
ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml

@ -147,7 +147,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate() update_time = sysdate()
</set> </set>
where dept_id in (${ancestors}) where find_in_set(#{deptId}, ancestors)
</update> </update>
<delete id="deleteDeptById" parameterType="Long"> <delete id="deleteDeptById" parameterType="Long">

Loading…
Cancel
Save