gpt4 book ai didi

spring-boot - 出于安全原因升级 netty 及其组件的正确方法是什么?

转载 作者:行者123 更新时间:2023-12-05 03:36:29 24 4
gpt4 key购买 nike

我们的spring boot(云)应用使用的是rx-netty,版本是0.4.20。并将 netty 及其组件设置为版本 4.1.5.Final

目前我们的安全审计系统发现当前的netty-codec版本(4.1.52.Final)存在漏洞,建议我们升级到4.1.68+版本.

我尝试将pom.xml中的netty-codec锁定为4.1.68.Final,但后来发现其他netty组件如netty-buffer netty-handler 仍然停留在 4.1.52

我想知道:

  • 我应该将所有 netty 组件保持在同一版本吗?
  • 升级个别易受攻击组件的正确方法是什么?

谢谢

更新:

mvn 依赖:树

...
[INFO] +- io.reactivex:rxnetty-contexts:jar:0.4.20:compile
[INFO] +- io.reactivex:rxnetty-servo:jar:0.4.20:compile
[INFO] | \- com.netflix.servo:servo-core:jar:0.12.21:runtime
[INFO] +- io.reactivex:rxnetty:jar:0.4.20:compile
[INFO] | +- io.netty:netty-codec-http:jar:4.1.69.Final:runtime
[INFO] | | +- io.netty:netty-common:jar:4.1.69.Final:runtime
[INFO] | | +- io.netty:netty-buffer:jar:4.1.52.Final:runtime
[INFO] | | +- io.netty:netty-transport:jar:4.1.52.Final:runtime
[INFO] | | \- io.netty:netty-codec:jar:4.1.52.Final:runtime
[INFO] | +- io.netty:netty-handler:jar:4.1.69.Final:runtime
[INFO] | | \- io.netty:netty-resolver:jar:4.1.52.Final:runtime
[INFO] | +- io.netty:netty-transport-native-epoll:jar:4.1.69.Final:runtime
[INFO] | | \- io.netty:netty-transport-native-unix-common:jar:4.1.52.Final:runtime
...

最佳答案

注意:Spring boot版本2.5.5使用 netty 4.1.68.Final ,所以如果你升级你应该没问题 spring-boot-starter-parent2.5.5

话虽这么说:

我如何在 spring-boot 中升级到更高/更低版本的依赖项:

  • 查看 spring-boot-dependencies 中配置的属性
  • 用想要的版本更改我的 pom.xml 中的该属性

在您的情况下,添加 netty.version:4.1.69.Final到您的属性:

    <properties>
<java.version>11</java.version>
<netty.version>4.1.69.Final</netty.version>

</properties>

更新:

使用 <netty.version>4.1.69.Final</netty.version> 时与 spring-boot-starter-parent:2.2.10.RELEASE , 引用要点 netty-upgrade

当你执行 mvn dependency:tree 时你可以看到每个 netty 依赖项都升级为 4.1.69.Final

在“netty”上过滤输出

    Regel 1: [INFO] --- maven-dependency-plugin:3.1.2:tree (default-cli) @ netty-upgrade ---
Regel 2: [INFO] com.example:netty-upgrade:jar:0.0.1-SNAPSHOT
Regel 25: [INFO] | +- org.springframework.boot:spring-boot-starter-reactor-netty:jar:2.2.10.RELEASE:compile
Regel 26: [INFO] | | +- io.projectreactor.netty:reactor-netty:jar:0.9.12.RELEASE:compile
Regel 26: [INFO] | | +- io.projectreactor.netty:reactor-netty:jar:0.9.12.RELEASE:compile
Regel 27: [INFO] | | | +- io.netty:netty-codec-http2:jar:4.1.69.Final:compile
Regel 27: [INFO] | | | +- io.netty:netty-codec-http2:jar:4.1.69.Final:compile
Regel 28: [INFO] | | | +- io.netty:netty-handler-proxy:jar:4.1.69.Final:compile
Regel 28: [INFO] | | | +- io.netty:netty-handler-proxy:jar:4.1.69.Final:compile
Regel 29: [INFO] | | | | \- io.netty:netty-codec-socks:jar:4.1.69.Final:compile
Regel 29: [INFO] | | | | \- io.netty:netty-codec-socks:jar:4.1.69.Final:compile
Regel 30: [INFO] | | | \- io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.69.Final:compile
Regel 30: [INFO] | | | \- io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.69.Final:compile
Regel 42: [INFO] +- io.reactivex:rxnetty:jar:0.5.1:runtime
Regel 44: [INFO] | +- io.netty:netty-codec-http:jar:4.1.69.Final:compile
Regel 44: [INFO] | +- io.netty:netty-codec-http:jar:4.1.69.Final:compile
Regel 45: [INFO] | | +- io.netty:netty-common:jar:4.1.69.Final:compile
Regel 45: [INFO] | | +- io.netty:netty-common:jar:4.1.69.Final:compile
Regel 46: [INFO] | | +- io.netty:netty-buffer:jar:4.1.69.Final:compile
Regel 46: [INFO] | | +- io.netty:netty-buffer:jar:4.1.69.Final:compile
Regel 47: [INFO] | | +- io.netty:netty-transport:jar:4.1.69.Final:compile
Regel 47: [INFO] | | +- io.netty:netty-transport:jar:4.1.69.Final:compile
Regel 48: [INFO] | | \- io.netty:netty-codec:jar:4.1.69.Final:compile
Regel 48: [INFO] | | \- io.netty:netty-codec:jar:4.1.69.Final:compile
Regel 49: [INFO] | +- io.netty:netty-handler:jar:4.1.69.Final:compile
Regel 49: [INFO] | +- io.netty:netty-handler:jar:4.1.69.Final:compile
Regel 50: [INFO] | | \- io.netty:netty-resolver:jar:4.1.69.Final:compile
Regel 50: [INFO] | | \- io.netty:netty-resolver:jar:4.1.69.Final:compile
Regel 51: [INFO] | +- io.netty:netty-transport-native-epoll:jar:4.1.69.Final:runtime
Regel 51: [INFO] | +- io.netty:netty-transport-native-epoll:jar:4.1.69.Final:runtime
Regel 52: [INFO] | | \- io.netty:netty-transport-native-unix-common:jar:4.1.69.Final:compile
Regel 52: [INFO] | | \- io.netty:netty-transport-native-unix-common:jar:4.1.69.Final:compile

因此,如果您仍然引用其他版本,请使用 mvn dependency:tree查看该引用的来源。

关于spring-boot - 出于安全原因升级 netty 及其组件的正确方法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69582105/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com