简体   繁体   English

Log4j2漏洞和Lombok注解@log4j2

[英]Log4j2 vulnerability and Lombok annotation @log4j2

We are using spring boot 2.1.5 and starter parent as pom dependency.我们使用 spring boot 2.1.5 和 starter parent 作为 pom 依赖项。

Spring boot is using default logback for logging and we haven't explicitly switched to Log4j2 or changes any configurations. Spring 引导使用默认的 logback 进行日志记录,我们没有明确切换到 Log4j2 或更改任何配置。 Below is our project dependency tree.下面是我们的项目依赖树。

在此处输入图像描述

We have lot of lombok @log4j2 annotations in our project.我们的项目中有很多 lombok @log4j2 注释。 But, we find in dependency tree we do not have any log4j2-core jar dependency (that has been found vulnerable to recent issues with log4j).但是,我们在依赖树中发现我们没有任何 log4j2-core jar 依赖项(已发现容易受到 log4j 最近问题的影响)。

@Log4j2
@Service
@DependsOn("applicationDependencyCheck")

Is lombok @log4j2 not dependent on log4j2-core.jar. lombok @log4j2 是否不依赖于 log4j2-core.jar。 Is it correct to assume this would show up in maven dependency tree or are we missing something.假设这会出现在 maven 依赖树中是正确的还是我们遗漏了什么。

This is our lombok entry -这是我们的 lombok 条目 -

<dependency>
    <groupId>org.projectlombok</groupId>
    <artifactId>lombok</artifactId>
    <optional>true</optional>
</dependency>

Please share some insights.请分享一些见解。

thanks谢谢

In lombok documentation you can find it here https://projectlombok.org/api/lombok/extern/log4j/Log4j2.html在 lombok 文档中,您可以在此处找到它https://projectlombok.org/api/lombok/extern/log4j/Log4j2.html

@Log4j2 public class LogExample { } @Log4j2 public class LogExample { }

will generate:将产生:

public class LogExample { private static final org.apache.logging.log4j.Logger log = org.apache.logging.log4j.LogManager.getLogger(LogExample.class); public class LogExample { private static final org.apache.logging.log4j.Logger log = org.apache.logging.log4j.LogManager.getLogger(LogExample.class); } }

Both classes are present in log4j API jar这两个类都存在于 log4j API jar

There are no known vulnerabilities listed here https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-api这里没有列出已知漏洞

As described here https://logging.apache.org/log4j/2.x/log4j-api/index.html log4j api is just an interface. As described here https://logging.apache.org/log4j/2.x/log4j-api/index.html log4j api is just an interface.

I think in such case your code does not depend on log4j core.我认为在这种情况下,您的代码不依赖于 log4j 内核。 You can double check the output of build (eg maven /target folder, war file etc)您可以仔细检查构建的 output(例如 maven /target 文件夹,war 文件等)

Definitely @Mariusz W.'s answer is the best.绝对@Mariusz W. 的回答是最好的。

Despite that, I notice your print shows dependency from logback-core-1.2.3 [1] , which has the CVE-2021-42550 vulnerability [2] .尽管如此,我注意到您的打印显示来自 logback-core-1.2.3 [1]的依赖性,它具有 CVE-2021-42550 漏洞[2]

Keep an eye on that.密切关注这一点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM