升级yarn包以避免Docker镜像中的漏洞

问题描述 投票:0回答:1

我有一个如下所示的节点依赖树:

$:app user1$ npm ls d3-color
[email protected] /Users/user1/workspace/fe/app
├─┬ @ant-design/[email protected]
│ └─┬ @ant-design/[email protected]
│   └─┬ @antv/[email protected]
│     └─┬ @antv/[email protected]
│       ├─┬ @antv/[email protected]
│       │ └── [email protected]
│       └─┬ @antv/[email protected]
│         └── [email protected]
├─┬ @antv/[email protected]
│ └─┬ @antv/[email protected]
│   └─┬ @antv/[email protected]
│     └─┬ [email protected]
│       └── [email protected]
├─┬ @nivo/[email protected]
│ ├── [email protected]
│ ├─┬ [email protected]
│ │ └── [email protected] deduped
│ ├─┬ [email protected]
│ │ ├── [email protected]
│ │ └─┬ [email protected]
│ │   └── [email protected] deduped
│ └─┬ [email protected]
│   └─┬ [email protected]
│     └── [email protected]
├─┬ @nivo/[email protected]
│ └─┬ @nivo/[email protected]
│   └── [email protected]
└── [email protected]

我想将从上往下第 5 级的

[email protected]
更新为
[email protected]

我尝试过做

yarn upgrade [email protected]
,但没有成功。它只是更新了一些但不是全部,对于其他一些软件包,它根本不升级。

我需要这样做,以避免我的 Docker 映像中的

High
由这个特定(和其他类似)包引起的分类漏洞。

任何帮助将不胜感激!

javascript node.js security docker-image npm-vulnerabilities
1个回答
0
投票

要将

d3-color
包更新到版本 3.1.0,特别是在依赖关系树中从顶部向下的第 5 级,您可以使用带有
--scope
选项的纱线升级命令来定位特定包。这是您可以使用的命令:

yarn upgrade [email protected] --scope="@antv/l7-layers"

此命令将专门将

d3-color
范围内的
@antv/l7-layers
软件包升级到版本 3.1.0。您需要对第 5 级以下依赖于
d3-color
的另一个包(即
@antv/l7-utils
)重复此命令。因此,使用
--scope="@antv/l7-utils"
:

再次运行该命令
yarn upgrade [email protected] --scope="@antv/l7-utils"

运行这些命令后,您应该已将依赖项树中指定位置的

d3-color
包更新到版本 3.1.0。

确保检查新版本

d3-color
中是否存在任何潜在的重大更改,以确保它不会影响您的应用程序的功能。此外,如有必要,您可能需要对依赖于
d3-color
的其他软件包重复类似的步骤。

© www.soinside.com 2019 - 2024. All rights reserved.