检测 gradle 传递依赖项中是否存在 Apache Log4j 漏洞

Detecting Apache Log4j vulnerability presence in gradle transitive dependencies

最近在 log4j https://nvd.nist.gov/vuln/detail/CVE-2021-44228 中有一个漏洞,其严重程度得分为 10

如何检查 gradle 中是否存在 Log4j 漏洞版本,以便它列出所有依赖项,包括传递依赖项?

我们可以使用

./gradlew -q dependencies

列出依赖关系树。它将列出所有依赖项及其各自的版本。由于此输出可能很长,我们可以使用 grep:

对其进行过滤
./gradelw -q dependencies | grep -i log4j

这将列出所有 log4j 依赖项及其各自的版本。

gradle -q dependencyInsight --dependency org.apache.logging.log4j 
 --configuration scm

根据文章,还有另一种使用 dependencyInsight 检查此列表的方法:- https://venturebeat.com/2021/12/17/how-to-detect-whether-you-have-the-log4j2-vulnerability/