我的專案通過我專案中使用的org.mobicents.servlet.sip包作為直接依賴項對 log4j v1.2.16 具有傳遞依賴關系。
但是org.mobicents.servlet.sip不再積極開發。
除了等待org.mobicents.servlet.sip來修復這個問題之外,還有什么方法可以修復這個漏洞。
uj5u.com熱心網友回復:
如果您使用 Maven 作為構建工具,那么您可以做的一種方法是:
- 排除傳遞依賴和
- 使其成為指定最新版本的直接依賴項。
<dependencies>
<dependency>
<groupId>org.mobicents.servlet.sip</groupId>
<artifactId>sip-servlets-spec</artifactId>
<version>4.0.128</version>
<exclusions>
<exclusion>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.17.1</version>
</dependency>
</dependencies>
您還可以參考maven 檔案以獲得詳細說明。
uj5u.com熱心網友回復:
您可能想要使用log4j-1.2-api 網橋。去做這個
- 排除對 log4j 1.x 的依賴(注意不同的 groupid,它在 1.x 和 2.x 之間發生了變化)
<dependencies>
<dependency>
<groupId>org.mobicents.servlet.sip</groupId>
<artifactId>sip-servlets-spec</artifactId>
<exclusions>
<exclusion>
<groupId>log4j</groupId><artifactId>log4j</artifactId>
</exclusion>
</exclusions>
</dependency>
- 使用網橋添加對 log4j 2.17.1 的依賴
<dependency><groupId>org.apache.logging.log4j</groupId><artifactId>log4j-api</artifactId><version>2.17.1</version></dependency>
<dependency><groupId>org.apache.logging.log4j</groupId><artifactId>log4j-1.2-api</artifactId><version>2.17.1</version></dependency>
<dependency><groupId>org.apache.logging.log4j</groupId><artifactId>log4j-core</artifactId><version>2.17.1</version></dependency>
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/418830.html
標籤:
