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

pull/274/head^2
RuoYi 2021-05-27 14:17:34 +08:00
parent dfe7c1a4a3
commit e1cab589f2
2 changed files with 15 additions and 1 deletions

View File

@ -63,6 +63,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);
} }
@ -163,4 +164,17 @@ public class DataScopeAspect
} }
return null; return null;
} }
/**
* sqlparams.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, "");
}
}
} }

View File

@ -152,7 +152,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>
</mapper> </mapper>