Skip to content

fix: remove NodeSource APT repo to fix SHA1 GPG key rejection - #60

Merged
acmerfight merged 1 commit into
mainfrom
fix/remove-nodesource-apt-repo
Apr 7, 2026
Merged

fix: remove NodeSource APT repo to fix SHA1 GPG key rejection#60
acmerfight merged 1 commit into
mainfrom
fix/remove-nodesource-apt-repo

Conversation

@acmerfight

@acmerfight acmerfight commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

问题

sandbox 模板构建和运行时,apt-get update 对 NodeSource 仓库产生签名验证失败:

W: OpenPGP signature verification failed: https://deb.nodesource.com/node_20.x nodistro InRelease:
Signing key on 6F71F525282841EEDAF851B42F59B5F99B1BE0B4 is not bound:
  No binding signature at time 2026-03-30T18:58:23Z
  because: SHA1 is not considered secure since 2026-02-01T00:00:00Z

根因

我们的模板基于 E2B 官方的 code-interpreter-v1 基础镜像。该基础镜像通过 NodeSource 安装脚本安装 Node.js:

# e2b-dev/code-interpreter 的 template.py
.run_cmd("curl -fsSL https://deb.nodesource.com/setup_20.x | bash -")
.apt_install("nodejs")

这个 setup_20.x 脚本做了两件事:

  1. 安装 Node.js
  2. /etc/apt/sources.list.d/nodesource.list 注册 NodeSource APT 源,并导入其 GPG 签名密钥

问题出在这个 GPG 密钥(6F71F525...0B4)的绑定签名使用了 SHA1 摘要算法

sandbox 基础镜像使用 Sequoia PGP(/usr/bin/sqv)做 APT 签名验证。Sequoia 有硬编码的安全策略:2026-02-01 起拒绝 SHA1 签名。所以从该日期起,任何触及 NodeSource 仓库的 apt-get update 都会签名验证失败。

为什么这个修复有效

.run_cmd("rm -f /etc/apt/sources.list.d/nodesource.list")

删除 NodeSource APT 源文件,这样 apt-get update 不再尝试访问 NodeSource 仓库,也就不会触发 SHA1 签名验证。

这么做是安全的,因为:

  1. Node.js 已经装好了:基础镜像在构建时已通过 NodeSource 安装了 Node.js 二进制文件,安装完成后 APT 源的唯一作用是后续更新 Node.js 版本
  2. 我们不需要通过 APT 更新 Node.js:sandbox 模板固定 Node.js 版本,不需要运行时升级
  3. 不影响其他包:只删除 NodeSource 源,Debian 官方源和 GitHub CLI 源不受影响

改动

template.pyapt-get update 前添加一行:

+    # Remove NodeSource APT repo inherited from base image (SHA1 GPG key rejected by sqv since 2026-02-01)
+    .run_cmd("rm -f /etc/apt/sources.list.d/nodesource.list")
     .run_cmd("apt-get update")

验证计划

  • 模板构建成功,apt-get update 输出无 NodeSource 相关 Warning
  • sandbox 运行时 node --version 正常返回
  • sandbox 运行时 npm --version 正常返回

Closes #59

The base image `code-interpreter-v1` includes a NodeSource APT source
whose GPG key uses SHA1 binding signature. Since 2026-02-01, Sequoia
PGP (sqv) rejects SHA1 signatures, causing `apt-get update` to fail
with signature verification warnings.

Node.js is already pre-installed by the base image, so the NodeSource
repo is unnecessary.

Closes #59
@acmerfight
acmerfight merged commit 0dcd5f4 into main Apr 7, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

apt-get update 失败:NodeSource GPG 密钥使用已弃用的 SHA1 签名

1 participant