【问题标题】:web3 install fails due to Insecure Credential Storage and Insecure Credential Storage由于不安全的凭据存储和不安全的凭据存储,web3 安装失败
【发布时间】:2021-07-31 21:44:14
【问题描述】:

在带有 npm 版本 7.12.0 的 Ubuntu 上安装最新的 web3 版本 1.3.5 失败并出现几个严重错误。修复的典型时间范围是什么?

npm 审计报告

下划线 1.3.2 - 1.12.0
严重性:高
任意代码执行 - https://npmjs.com/advisories/1674\ 没有可用的修复
节点模块/下划线
..web3-bzz ..取决于易受攻击的下划线版本
..node_modules/web3-bzz
....web3 *
....取决于易受攻击的 web3-bzz 版本
....取决于易受攻击的 web3-eth 版本
....node_modules/web3
..web3-core-helpers *
..取决于易受攻击的下划线版本
..node_modules/web3-core-helpers
....web3-eth-ens *
....取决于易受攻击的下划线版本
....取决于易受攻击的 web3-core-helpers 版本
....node_modules/web3-eth-ens
......web3-eth *
......取决于下划线的易受攻击版本
......取决于易受攻击的 web3-eth-ens 版本
......node_modules/web3-eth
....web3-providers-http *
....取决于易受攻击的 web3-core-helpers 版本
....node_modules/web3-providers-http
..web3-core-method *
..取决于易受攻击的下划线版本
..node_modules/web3-core-method
....web3-core *
....取决于易受攻击的 web3-core-method 版本
....node_modules/web3-core
....web3-eth-个人 *
....取决于易受攻击的 web3-core-method 版本
....取决于易受攻击的 web3-net 版本
....node_modules/web3-eth-personal
....web3-net =1.2.0
....取决于易受攻击的 web3-core-method 版本
....node_modules/web3-net
......web3-shh ......取决于易受攻击的 web3-core-method 版本
......取决于易受攻击的 web3-net 版本
......node_modules/web3-shh
..web3-core-requestmanager *
..取决于易受攻击的下划线版本
..node_modules/web3-core-requestmanager
..web3-core-subscriptions *
..取决于易受攻击的下划线版本
..node_modules/web3-core-subscriptions
..web3-eth-abi *
..取决于易受攻击的下划线版本
..node_modules/web3-eth-abi
..web3-eth-accounts *
..取决于易受攻击的下划线版本
..node_modules/web3-eth-accounts
..web3-eth-contract *
..取决于易受攻击的下划线版本
..node_modules/web3-eth-contract
..web3-providers-ipc *
..取决于易受攻击的下划线版本
..node_modules/web3-providers-ipc
..web3-providers-ws *
..取决于易受攻击的下划线版本
..node_modules/web3-providers-ws
..web3-utils >=1.0.0-beta.8
..取决于易受攻击的下划线版本
..node_modules/web3-utils
....web3-eth-iban *
....取决于易受攻击的 web3-utils 版本
....node_modules/web3-eth-iban

网络3 *
严重性:高
不安全的凭证存储 - https://npmjs.com/advisories/877\ 取决于易受攻击的 web3-bzz 版本
取决于易受攻击的 web3-eth 版本
没有可用的修复
节点模块/web3

21 个高危漏洞\

【问题讨论】:

    标签: npm web3


    【解决方案1】:

    我们在项目的 CI 管道中运行 npm ci && npm audit --audit-level=high,今天遇到了这个下划线问题。

    已经有关于它的GitHub issue

    我们现在正在等待新版本(补丁)。在此之前,快速修复和可能的解决方案是在 package-lock.json 中搜索 underscore 并在那里手动更新 underscore 版本,因为 npm audit fix 不会修复它自动。

    我们使用了 1.9.1 版本并更新到 1.12.1(在审核日志中列为稳定版本)。请为每个 下划线 的出现更改这些行:

    • 版本:1.9.1 => 1.12.1;
    • 已解决:https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz => https://registry.npmjs.org/underscore/-/underscore-1.12.1.tgz;
    • 诚信:sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg== => sha512-hEQt0+ZLDVUMhebKxL4x1BTtDY7bavVofhZ9KZ4aI26X9SRaE+Y3m83XUL1UP2jn8ynjndwCCpEHdUG+9pP1Tw==

    这样npm ci 将从package-lock.json 中获取版本并且不会发生错误。但是npm install 会忽略它...

    如果需要,这两个命令之间的区别如下:Difference between npm install and npm ci

    更新

    你也可以使用npm-force-resolutions包来设置下划线包的具体版本:

    1. "resolutions": { "underscore": "1.12.1" } 添加到您的package.json
    2. 可选择添加 preinstall 脚本,该脚本将在每次npm install 启动之前运行:"scripts": { "preinstall": "npx npm-force-resolutions" };
    3. 运行 npm installnpx npm-force-resolutions 并在 package-lock.json 中查看您的更改。 npm audit 也不会发现这些漏洞。

    最终更新

    web3@1.3.6 提供所有修复,您可以更新本地包。

    【讨论】:

      【解决方案2】:

      谢谢,问题已关闭。我看到 github 上的 ChainSafe/web3.js 包含对下划线的修复,很快就会在 NPM 上。

      此外,npm ls -all | grep underscore 显示此库在第 2、第 3 和第 4 级嵌套依赖。感谢 NPM 上的 npm-force-resolution 链接以获取背景、进一步说明和警告,以警告可能存在的安全漏洞。我有一个用于学习的沙盒系统。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2012-06-05
        • 1970-01-01
        • 2013-11-19
        • 2019-04-17
        • 1970-01-01
        • 2020-04-06
        • 2012-10-20
        • 2012-10-05
        相关资源
        最近更新 更多