RuoYi
2021-05-27 c24cd14fd700b2846623d0c3e9683adb30c7062b
修复两处存在SQL注入漏洞问题
已修改2个文件
16 ■■■■■ 文件已修改
src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mybatis/system/SysDeptMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java
@@ -66,6 +66,7 @@
    @Before("dataScopePointCut()")
    public void doBefore(JoinPoint point) throws Throwable
    {
        clearDataScope(point);
        handleDataScope(point);
    }
@@ -166,4 +167,17 @@
        }
        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, "");
        }
    }
}
src/main/resources/mybatis/system/SysDeptMapper.xml
@@ -147,7 +147,7 @@
             <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
             update_time = sysdate()
        </set>
         where dept_id in (${ancestors})
         where find_in_set(#{deptId}, ancestors)
    </update>
    
    <delete id="deleteDeptById" parameterType="Long">