Browse Source

安全:
1.更改分页插件为最新的
2.升级xstream>=1.4.18

lijie 3 years ago
parent
commit
8840b53a73

+ 12 - 0
dmp-business/dmp-dic/pom.xml

@@ -16,6 +16,18 @@
         <dependency>
         <dependency>
             <groupId>com.persagy</groupId>
             <groupId>com.persagy</groupId>
             <artifactId>integrated-config-client</artifactId>
             <artifactId>integrated-config-client</artifactId>
+            <exclusions>
+                <exclusion>
+                    <artifactId>xstream</artifactId>
+                    <groupId>com.thoughtworks.xstream</groupId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <!-- 阿里云扫描漏洞要求版本需>=1.4.18 -->
+        <dependency>
+            <groupId>com.thoughtworks.xstream</groupId>
+            <artifactId>xstream</artifactId>
+            <version>1.4.18</version>
         </dependency>
         </dependency>
         <!-- 项目启动 -->
         <!-- 项目启动 -->
         <dependency>
         <dependency>

+ 12 - 0
dmp-business/dmp-rwd-plus/pom.xml

@@ -16,6 +16,18 @@
         <dependency>
         <dependency>
             <groupId>com.persagy</groupId>
             <groupId>com.persagy</groupId>
             <artifactId>integrated-config-client</artifactId>
             <artifactId>integrated-config-client</artifactId>
+            <exclusions>
+                <exclusion>
+                    <artifactId>xstream</artifactId>
+                    <groupId>com.thoughtworks.xstream</groupId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <!-- 阿里云扫描漏洞要求版本需>=1.4.18 -->
+        <dependency>
+            <groupId>com.thoughtworks.xstream</groupId>
+            <artifactId>xstream</artifactId>
+            <version>1.4.18</version>
         </dependency>
         </dependency>
         <!-- 项目启动 -->
         <!-- 项目启动 -->
         <dependency>
         <dependency>

+ 12 - 0
dmp-business/dmp-rwd-version/pom.xml

@@ -16,6 +16,18 @@
         <dependency>
         <dependency>
             <groupId>com.persagy</groupId>
             <groupId>com.persagy</groupId>
             <artifactId>integrated-config-client</artifactId>
             <artifactId>integrated-config-client</artifactId>
+            <exclusions>
+                <exclusion>
+                    <artifactId>xstream</artifactId>
+                    <groupId>com.thoughtworks.xstream</groupId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <!-- 阿里云扫描漏洞要求版本需>=1.4.18 -->
+        <dependency>
+            <groupId>com.thoughtworks.xstream</groupId>
+            <artifactId>xstream</artifactId>
+            <version>1.4.18</version>
         </dependency>
         </dependency>
         <!-- 项目启动 -->
         <!-- 项目启动 -->
         <dependency>
         <dependency>

+ 12 - 0
dmp-business/dmp-rwd/pom.xml

@@ -34,6 +34,18 @@
         <dependency>
         <dependency>
             <groupId>com.persagy</groupId>
             <groupId>com.persagy</groupId>
             <artifactId>integrated-config-client</artifactId>
             <artifactId>integrated-config-client</artifactId>
+            <exclusions>
+                <exclusion>
+                    <artifactId>xstream</artifactId>
+                    <groupId>com.thoughtworks.xstream</groupId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <!-- 阿里云扫描漏洞要求版本需>=1.4.18 -->
+        <dependency>
+            <groupId>com.thoughtworks.xstream</groupId>
+            <artifactId>xstream</artifactId>
+            <version>1.4.18</version>
         </dependency>
         </dependency>
         <!-- 项目启动 -->
         <!-- 项目启动 -->
         <dependency>
         <dependency>

+ 12 - 0
dmp-cloud/dmp-file/pom.xml

@@ -16,6 +16,18 @@
         <dependency>
         <dependency>
             <groupId>com.persagy</groupId>
             <groupId>com.persagy</groupId>
             <artifactId>integrated-config-client</artifactId>
             <artifactId>integrated-config-client</artifactId>
+            <exclusions>
+                <exclusion>
+                    <artifactId>xstream</artifactId>
+                    <groupId>com.thoughtworks.xstream</groupId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <!-- 阿里云扫描漏洞要求版本需>=1.4.18 -->
+        <dependency>
+            <groupId>com.thoughtworks.xstream</groupId>
+            <artifactId>xstream</artifactId>
+            <version>1.4.18</version>
         </dependency>
         </dependency>
         <!-- 项目启动 -->
         <!-- 项目启动 -->
         <dependency>
         <dependency>

+ 12 - 0
dmp-cloud/dmp-message/pom.xml

@@ -16,6 +16,18 @@
         <dependency>
         <dependency>
             <groupId>com.persagy</groupId>
             <groupId>com.persagy</groupId>
             <artifactId>integrated-config-client</artifactId>
             <artifactId>integrated-config-client</artifactId>
+            <exclusions>
+                <exclusion>
+                    <artifactId>xstream</artifactId>
+                    <groupId>com.thoughtworks.xstream</groupId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <!-- 阿里云扫描漏洞要求版本需>=1.4.18 -->
+        <dependency>
+            <groupId>com.thoughtworks.xstream</groupId>
+            <artifactId>xstream</artifactId>
+            <version>1.4.18</version>
         </dependency>
         </dependency>
         <!-- 项目启动 -->
         <!-- 项目启动 -->
         <dependency>
         <dependency>

+ 21 - 25
dmp-comp/dmp-mybatis/src/main/java/com/persagy/dmp/mybatis/config/MybatisPlusConfig.java

@@ -1,5 +1,7 @@
 package com.persagy.dmp.mybatis.config;
 package com.persagy.dmp.mybatis.config;
 
 
+import com.baomidou.mybatisplus.annotation.DbType;
+import com.baomidou.mybatisplus.autoconfigure.ConfigurationCustomizer;
 import com.baomidou.mybatisplus.autoconfigure.MybatisPlusPropertiesCustomizer;
 import com.baomidou.mybatisplus.autoconfigure.MybatisPlusPropertiesCustomizer;
 import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
 import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
 import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
 import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
@@ -30,6 +32,8 @@ public class MybatisPlusConfig implements CommandLineRunner {
     private ObjectMapper objectMapper;
     private ObjectMapper objectMapper;
     @Value("${persagy.common.sql.limit:500}")
     @Value("${persagy.common.sql.limit:500}")
     private long sqlLimit;
     private long sqlLimit;
+    @Value("${persagy.common.sql.db.type:mysql}")
+    private String dbType;
 
 
     @Override
     @Override
     public void run(String... args) throws Exception {
     public void run(String... args) throws Exception {
@@ -37,36 +41,28 @@ public class MybatisPlusConfig implements CommandLineRunner {
         JacksonTypeHandler.setObjectMapper(objectMapper);
         JacksonTypeHandler.setObjectMapper(objectMapper);
     }
     }
 
 
-    @Bean
-    public PaginationInterceptor paginationInterceptor() {
-        PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
-        // 设置每页查询记录上限,默认500(与mp相同)
-        paginationInterceptor.setLimit(sqlLimit);
-        return paginationInterceptor;
-    }
-
     /**
     /**
-     * 注册Mybatis分页插件
+     * 注册Mybatis插件
      * 使用示例: IPage<Member> memberPage = new Page<>(1, 2,false) true查询总记录数量
      * 使用示例: IPage<Member> memberPage = new Page<>(1, 2,false) true查询总记录数量
      */
      */
-//    @Bean
-//    public PaginationInnerInterceptor paginationInnerInterceptor() {
-//        PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor();
-//        // 设置每页查询记录上限,默认500(与mp相同)
-//        paginationInnerInterceptor.setMaxLimit(sqlLimit);
-//        return paginationInnerInterceptor;
-//    }
+    @Bean
+    public MybatisPlusInterceptor mybatisPlusInterceptor() {
+        MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
+        PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor();
+        // 设置每页查询记录上限,默认500(与mp相同)
+        paginationInnerInterceptor.setMaxLimit(sqlLimit);
+        paginationInnerInterceptor.setDbType(DbType.getDbType(dbType));
+        // 添加分页插件
+        mybatisPlusInterceptor.addInnerInterceptor(paginationInnerInterceptor);
+        return mybatisPlusInterceptor;
+    }
     /**
     /**
-     * 注册Mybatis插件
-     * 使用示例: IPage<Member> memberPage = new Page<>(1, 2,false) true查询总记录数量
+     * 新的分页插件,一缓和二缓遵循mybatis的规则,需要设置 MybatisConfiguration#useDeprecatedExecutor = false 避免缓存出现问题(该属性会在旧插件移除后一同移除)
      */
      */
-//    @Bean
-//    public MybatisPlusInterceptor mybatisPlusInterceptor() {
-//        MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
-//        // 添加分页插件
-//        mybatisPlusInterceptor.addInnerInterceptor(paginationInnerInterceptor());
-//        return mybatisPlusInterceptor;
-//    }
+    @Bean
+    public ConfigurationCustomizer configurationCustomizer() {
+        return configuration -> configuration.setUseDeprecatedExecutor(false);
+    }
 
 
     /**
     /**
      * 自动扫描typeHandlers
      * 自动扫描typeHandlers