摆脱 spring-boot-starter-data-mongodb 对易受攻击的 Log4J 版本的依赖
Get rid of spring-boot-starter-data-mongodb dependency on vulnerable Log4J version
鉴于 Log4J 2.x 存在一个主要的远程代码执行漏洞(检查 vulnerability),我开始查看我的项目依赖项,看看我是否通过例如使用 Log4J slf4j 幸运的是我不是。
但是我通过spring-boot-starter-data-mongodb
发现了另一个对Log4J的依赖。该软件包的最新版本是在 Nov. 2021 上生成的,因此该问题并未得到缓解。
如何在不摆脱spring-boot-starter-data-mongodb
的情况下摆脱依赖,因为我非常依赖它。
➜ mvn dependency:tree | grep -B 5 log4j
[INFO] +- org.springframework.boot:spring-boot-starter-data-mongodb:jar:2.2.5.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter:jar:2.2.5.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot-starter-logging:jar:2.2.5.RELEASE:compile
[INFO] | | | +- ch.qos.logback:logback-classic:jar:1.2.3:compile
[INFO] | | | | \- ch.qos.logback:logback-core:jar:1.2.3:compile
[INFO] | | | +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.12.1:compile
[INFO] | | | | \- org.apache.logging.log4j:log4j-api:jar:2.12.1:compile
根据 the Spring blog,您不需要:
The log4j-to-slf4j
and log4j-api
jars that we include in
spring-boot-starter-logging
cannot be exploited on their own. Only
applications using log4j-core
and including user input in log
messages are vulnerable.
鉴于 Log4J 2.x 存在一个主要的远程代码执行漏洞(检查 vulnerability),我开始查看我的项目依赖项,看看我是否通过例如使用 Log4J slf4j 幸运的是我不是。
但是我通过spring-boot-starter-data-mongodb
发现了另一个对Log4J的依赖。该软件包的最新版本是在 Nov. 2021 上生成的,因此该问题并未得到缓解。
如何在不摆脱spring-boot-starter-data-mongodb
的情况下摆脱依赖,因为我非常依赖它。
➜ mvn dependency:tree | grep -B 5 log4j
[INFO] +- org.springframework.boot:spring-boot-starter-data-mongodb:jar:2.2.5.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter:jar:2.2.5.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot-starter-logging:jar:2.2.5.RELEASE:compile
[INFO] | | | +- ch.qos.logback:logback-classic:jar:1.2.3:compile
[INFO] | | | | \- ch.qos.logback:logback-core:jar:1.2.3:compile
[INFO] | | | +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.12.1:compile
[INFO] | | | | \- org.apache.logging.log4j:log4j-api:jar:2.12.1:compile
根据 the Spring blog,您不需要:
The
log4j-to-slf4j
andlog4j-api
jars that we include inspring-boot-starter-logging
cannot be exploited on their own. Only applications usinglog4j-core
and including user input in log messages are vulnerable.