
safe-chain v1.5.16
使用 Aikido Safe Chain 防范通过 npm、yarn、pnpm、npx、pnpx、pip、uv 和 poetry 安装的恶意代码。免费使用,无需令牌。
Aikido Safe Chain
- ✅ 在开发者笔记本电脑和 CI/CD 上阻止恶意软件
- ✅ 支持 npm 和 PyPI,更多包管理器即将支持
- ✅ 阻止发布时间少于 48 小时的软件包,且不会破坏你的构建
- ✅ 无需令牌、免费、不共享构建数据
需要超越 npm 和 PyPI 的保护?
Aikido Device Protection 基于 Safe Chain 构建,将软件包和扩展安全性扩展到更多生态系统:npm、PyPI、VS Code、Open VSX -(Cursor、Windsurf、Kiro、Vs Codium 等)、Maven、NuGet、Chrome 扩展、Go、Skills.sh AI 技能、Ruby、Rust 等。
获取集中式策略管理、请求与审批工作流,以及对你组织中每台开发者工作站的可见性。由相同的 Aikido Intel 数据源提供支持。可手动部署,或通过你的 MDM 工具(Jamf、Fleet 或 Iru)进行管理。
Aikido Safe Chain 支持以下包管理器:
- 📦 npm
- 📦 npx
- 📦 yarn
- 📦 pnpm
- 📦 pnpx
- 📦 rush
- 📦 rushx
- 📦 bun
- 📦 bunx
- 📦 pip
- 📦 pip3
- 📦 uv
- 📦 poetry
- 📦 uvx
- 📦 pipx
- 📦 pdm
使用方法

安装
使用安装脚本可以轻松安装 Aikido Safe Chain。
Unix/Linux/macOS```shell
curl -fsSL https://github.com/AikidoSec/safe-chain/releases/download/1.5.20/install-safe-chain.sh -o /tmp/install-safe-chain.sh
&& echo "0ad25efe15d1fa56105157a454d647223e78eb0c53d1f85e3d10afcd722e7bfd /tmp/install-safe-chain.sh" | sha256sum -c -
&& sh /tmp/install-safe-chain.sh
&& rm /tmp/install-safe-chain.sh
### Windows (PowerShell)```powershell
$installer = Join-Path $env:TEMP "install-safe-chain.ps1"
Invoke-WebRequest "https://github.com/AikidoSec/safe-chain/releases/download/1.5.20/install-safe-chain.ps1" -OutFile $installer -UseBasicParsing
$expectedHash = "468C342C5AABB71200B0BD19950984EDD5C4B39811B653B13A5AD15E0FBA4DFA"
if ((Get-FileHash $installer -Algorithm SHA256).Hash -ne $expectedHash) {
Remove-Item $installer -ErrorAction SilentlyContinue
throw "Checksum verification failed for install-safe-chain.ps1"
}
& $installer
Remove-Item $installer
上述安装命令始终引用特定版本。要安装其他版本,请将版本号替换为您所需的版本号。所有可用版本均在 releases page 上。
下载完整性
安装脚本从带版本号的发布 URL(releases/download/1.5.20/...)提供。GitHub 发布是不可变的——一旦某个构件在带版本号的 URL 上发布,就无法修改或替换,因此您下载的文件保证与发布时完全一致。
验证安装
-
❗重启您的终端以开始使用 Aikido Safe Chain。
- 此步骤至关重要,因为它确保 npm、npx、yarn、pnpm、pnpx、rush、rushx、bun、bunx、pip、pip3、poetry、uv、uvx、pipx 和 pdm 的 shell 别名被正确加载。如果您不重启终端,这些别名将不可用。
-
验证安装,通过运行验证命令: ```shell npm safe-chain-verify pnpm safe-chain-verify pip safe-chain-verify uv safe-chain-verify
Any other supported package manager: {packagemanager} safe-chain-verify
- 输出应显示 "OK: Safe-chain works!",确认 Aikido Safe Chain 已正确安装并运行。
-
(可选)测试恶意软件拦截,尝试安装一个测试包:
对于 JavaScript/Node.js: ```shell npm install safe-chain-test
对于 Python: ```shell pip3 install safe-chain-pi-test
- 输出应显示 Aikido Safe Chain 阻止了这些测试包的安装,因为它们被标记为恶意软件。
在运行 `npm`、`npx`、`yarn`、`pnpm`、`pnpx`、`rush`、`rushx`、`bun`、`bunx`、`pip`、`pip3`、`uv`、`uvx`、`poetry`、`pipx` 和 `pdm` 命令时,Aikido Safe Chain 会自动检查你尝试安装的包中是否存在恶意软件。它还会在可用时拦截 Python 模块对 pip 的调用(例如 `python -m pip install ...`、`python3 -m pip download ...`)。如果检测到任何恶意软件,它会提示你退出该命令。
你可以通过运行以下命令来检查已安装的版本:```shell
safe-chain --version
工作原理
恶意软件拦截
Aikido Safe Chain 通过运行一个轻量级代理服务器来拦截来自 npm registry 和 PyPI 的软件包下载。当你运行 npm、npx、yarn、pnpm、pnpx、rush、rushx、bun、bunx、pip、pip3、uv、uvx、poetry、pipx 或 pdm 命令时,所有软件包下载都会通过这个本地代理进行路由,该代理会实时对照 Aikido Intel - Open Sources Threat Intelligence 验证软件包。如果在任何软件包(包括深层依赖)中检测到恶意软件,代理会在恶意代码到达你的机器之前阻止下载。
最小软件包年龄
Safe Chain 对支持的生态系统应用最小软件包年龄检查。
当前的执行方式因生态系统而异:
- 基于 npm 的包管理器:
- 在正常的软件包解析过程中,Safe Chain 会从 registry 返回的软件包元数据中抑制比配置的最小年龄更新的版本
- 对于绕过该元数据流程的直接软件包下载请求,Safe Chain 可以使用新发布软件包的缓存列表来阻止该请求
- Python 包管理器:
- 在软件包解析过程中,Safe Chain 会从 PyPI 元数据响应中抑制过新的文件和发布版本
- 对于绕过该元数据流程的直接软件包下载请求,Safe Chain 可以使用新发布软件包的缓存列表来阻止该请求
默认情况下,最小软件包年龄为 48 小时。这在新发布的软件包最有可能包含未检测到的威胁的关键时期提供了额外的安全层。你可以配置此阈值或完全绕过此保护——请参阅下方的最小软件包年龄配置部分。
Shell 集成
Aikido Safe Chain 与你的 shell 集成,在使用 npm、npx、yarn、pnpm、pnpx、rush、rushx、bun、bunx 以及 Python 包管理器(pip、uv、uvx、poetry、pipx、pdm)时提供无缝体验。它为这些命令设置别名,使它们被 Aikido Safe Chain 命令包装,这些命令会在执行原始命令之前管理代理服务器。我们目前支持:
- ✅ Bash
- ✅ Zsh
- ✅ Fish
- ✅ PowerShell
- ✅ PowerShell Core
有关 shell 集成的更多信息,请参阅 shell 集成文档。
卸载
要卸载 Aikido Safe Chain,请使用我们的一行卸载程序:
Unix/Linux/macOS```shell
curl -fsSL https://github.com/AikidoSec/safe-chain/releases/download/1.5.20/uninstall-safe-chain.sh | sh
### Windows (PowerShell)```powershell
iex (iwr "https://github.com/AikidoSec/safe-chain/releases/download/1.5.20/uninstall-safe-chain.ps1" -UseBasicParsing)
❗卸载后请重启终端,以确保所有别名都被移除。
配置
日志记录
你可以使用 --safe-chain-logging 标志或 SAFE_CHAIN_LOGGING 环境变量来控制 Aikido Safe Chain 的输出。
配置选项
你可以通过多种来源设置日志级别(按优先级顺序):
-
CLI 参数(最高优先级):
-
--safe-chain-logging=silent- 抑制 Aikido Safe Chain 的所有输出,除非恶意软件被拦截。包管理器的输出会照常写入 stdout,而 Safe Chain 仅在拦截到恶意软件并导致进程退出时写入一条简短消息。npm install express --safe-chain-logging=silent -
--safe-chain-logging=verbose- 启用 Aikido Safe Chain 的详细诊断输出。适用于排查问题或了解 Safe Chain 在后台执行的操作。npm install express --safe-chain-logging=verbose
-
-
环境变量: ```shell export SAFE_CHAIN_LOGGING=verbose npm install express
有效值:silent、normal、verbose
这对于为终端会话或 CI/CD 环境中的所有包管理器命令设置默认日志级别非常有用。
文件日志记录
你可以使用 --safe-chain-log-file 标志或 SAFE_CHAIN_LOG_FILE 环境变量将 Aikido Safe Chain 的输出镜像到日志文件。文件日志记录默认禁用,设置路径后启用。文件格式(--safe-chain-log-file-format)和详细程度(--safe-chain-log-file-verbosity)独立于终端输出进行控制。
配置选项
通过以下任一方式设置(按优先级顺序):
- CLI 参数(最高优先级): ```shell
npm install express
--safe-chain-log-file=~/safe-chain.log
--safe-chain-log-file-format=plain
--safe-chain-log-file-verbosity=normal - 环境变量: ```shell
export SAFE_CHAIN_LOG_FILE=~/safe-chain.log
export SAFE_CHAIN_LOG_FILE_FORMAT=plain
export SAFE_CHAIN_LOG_FILE_VERBOSITY=normal
- 配置文件(
~/.safe-chain/config.json): ```json { "logFile": "~/safe-chain.log", "logFileFormat": "plain", "logFileVerbosity": "normal" }
logFileFormat — json(默认)或 plain。
logFileVerbosity — silent、normal 或 verbose(默认)。独立于 --safe-chain-logging。
最小包年龄
你可以配置包必须存在多长时间后,Safe Chain 才允许其安装。默认情况下,包必须至少存在 48 小时才能被安装。
对于基于 npm 的包管理器,此检查目前有两种执行模式:
- Safe Chain 在正常依赖解析期间从包元数据中抑制过于年轻的版本。
- 当直接包下载请求与缓存的新发布包列表匹配时,Safe Chain 会阻止这些请求。
对于 Python 包管理器,此检查目前有两种执行模式:
- Safe Chain 在依赖解析期间从 PyPI 元数据中抑制过于年轻的文件和发布版本。
- 当直接包下载请求与缓存的新发布包列表匹配时,Safe Chain 会阻止这些请求。
配置选项
你可以通过多种来源设置最小包年龄(按优先级顺序):
- CLI 参数(最高优先级): ```shell
npm install express --safe-chain-minimum-package-age-hours=48
- 环境变量: ```shell
export SAFE_CHAIN_MINIMUM_PACKAGE_AGE_HOURS=48
npm install express
- 配置文件(
~/.safe-chain/config.json): ```json { "minimumPackageAgeHours": 48 }
排除软件包
通过环境变量或配置文件(两者会合并)将受信任的软件包排除在最小年龄过滤之外。使用 @scope/* 信任某个组织下的所有软件包:```shell
export SAFE_CHAIN_MINIMUM_PACKAGE_AGE_EXCLUSIONS="@aikidosec/*"
## 使用示例
### 基本用法
```bash
# 扫描单个目标
python3 cve_2025_55182.py -u https://target.example.com
# 扫描多个目标
python3 cve_2025_55182.py -f targets.txt
# 使用代理
python3 cve_2025_55182.py -u https://target.example.com -p http://127.0.0.1:8080
# 详细输出
python3 cve_2025_55182.py -u https://target.example.com -v
高级用法
# 自定义超时和线程数
python3 cve_2025_55182.py -f targets.txt -t 20 --timeout 15
# 保存结果到文件
python3 cve_2025_55182.py -f targets.txt -o results.txt
# 使用自定义 User-Agent
python3 cve_2025_55182.py -u https://target.example.com -A "Mozilla/5.0 (Custom)"
输出示例
[+] 目标: https://target.example.com
[+] 正在检查 CVE-2025-55182...
[!] 目标存在漏洞!
[!] 响应时间: 3.45s
[!] 状态码: 200
[+] 结果已保存至 results.txt
检测方法
该工具通过以下方式检测漏洞:
- 时间延迟分析:发送特制请求并测量响应时间
- 响应差异对比:比较正常请求与恶意请求的响应
- 错误信息提取:分析服务器返回的错误信息
- 状态码验证:检查 HTTP 响应状态码
免责声明
本工具仅供安全研究和授权测试使用。未经授权对目标系统进行测试属于违法行为。使用者应自行承担因使用本工具而产生的一切法律责任。作者不对任何滥用行为负责。
参考资料
许可证
本项目采用 MIT 许可证 - 详见 LICENSE 文件。
贡献
欢迎提交 Issue 和 Pull Request!
- Fork 本仓库
- 创建特性分支 (
git checkout -b feature/AmazingFeature) - 提交更改 (
git commit -m 'Add some AmazingFeature') - 推送到分支 (
git push origin feature/AmazingFeature) - 开启 Pull Request
联系方式
- 作者: Security Researcher
- 邮箱: [email protected]
- Twitter: @researcher
致谢
感谢所有为本项目做出贡献的安全研究人员。```json { "npm": { "minimumPackageAgeExclusions": ["@aikidosec/*"] }, "pip": { "minimumPackageAgeExclusions": ["requests"] } }
## 自定义注册表
配置 Safe Chain 以扫描来自自定义或私有注册表的软件包。
支持的生态系统:
- Node.js
- Python
### 配置选项
你可以通过环境变量或配置文件设置自定义注册表。两个来源会合并在一起。
1. **环境变量**(逗号分隔): ```shell
export SAFE_CHAIN_NPM_CUSTOM_REGISTRIES="npm.company.com,registry.internal.net"
export SAFE_CHAIN_PIP_CUSTOM_REGISTRIES="pip.company.com,registry.internal.net"
- 配置文件(
~/.safe-chain/config.json): ```json { "npm": { "customRegistries": ["npm.company.com", "registry.internal.net"] }, "pip": { "customRegistries": ["pip.company.com", "registry.internal.net"] } }
PYPI 配置文件
如果你依赖 pip.conf 文件进行 pip 配置,你必须通过 PIP_CONFIG_FILE 环境变量显式地将其指向 pip,以便 Safe Chain 能够合并它。
Safe Chain 在其 MITM 代理后面运行 pip,并写入一个临时的 pip 配置文件以注入其证书和代理设置。当设置了 PIP_CONFIG_FILE 时,Safe Chain 会将其设置合并到你的文件副本中(你的原始文件永远不会被修改),从而保留你的 index-url、凭据和其他选项。当未设置 PIP_CONFIG_FILE 时,pip 的用户级配置(例如 ~/.config/pip/pip.conf)可能会被 Safe Chain 的临时文件覆盖,你的设置将不会被采用。
恶意软件列表基础 URL
配置 Safe Chain 从自定义镜像 URL 获取恶意软件数据库和新软件包列表。这允许你托管自己的 Aikido 恶意软件数据库副本。
配置选项
你可以通过多个来源设置恶意软件列表基础 URL(按优先级顺序):
- CLI 参数(最高优先级): ```shell
npm install express --safe-chain-malware-list-base-url=https://your-mirror.com
- 环境变量: ```shell
export SAFE_CHAIN_MALWARE_LIST_BASE_URL=https://your-mirror.com
npm install express
- 配置文件(
~/.safe-chain/config.json): ```json { "malwareListBaseUrl": "https://your-mirror.com" }
基础 URL 应指向一个镜像了 https://malware-list.aikido.dev/ 结构的服务器,包括以下路径:
/malware_predictions.json(JavaScript 生态系统恶意软件数据库)/malware_pypi.json(Python 生态系统恶意软件数据库)/releases/npm.json(JavaScript 新软件包列表)/releases/pypi.json(Python 新软件包列表)
项目配置文件
除了主目录配置文件(~/.safe-chain/config.json)之外,Safe Chain 还支持项目配置文件,这样设置就可以签入代码仓库并在团队中共享,而不必按机器逐一配置。
在仓库根目录的 .aikido 文件中添加一个 safe-chain: 部分(该文件与其他 Aikido 工具共用,Safe Chain 只读取自己的 safe-chain: 部分,忽略其余内容)。找到后,其设置会合并到主目录配置文件之上:项目配置中设置的值优先,而数组(例如 customRegistries)会从两个文件中合并,而不是一个替换另一个。
只有以下设置可以从项目配置文件中设置:```yaml safe-chain: minimumPackageAgeHours: 48 npm: customRegistries: - npm.company.com minimumPackageAgeExclusions: - "@aikidosec/*" pip: customRegistries: - pip.company.com minimumPackageAgeExclusions: - requests
像 `scanTimeout`、`malwareListBaseUrl` 以及 `logFile*` 这类设置无法从项目配置文件中设置——它们只能来自你的主目录配置、CLI 参数或环境变量。
## 自定义安装目录
默认情况下,Safe Chain 会将自身安装到 `~/.safe-chain`。你可以通过向安装程序传递一个显式的安装目录来更改这一点。这对于系统级安装(例如在 Docker 镜像内部)或当你需要避免与其他工具冲突时非常有用。
设置后,所有 Safe Chain 数据(二进制文件、shims、脚本、配置)都会放在自定义目录下,而不是 `~/.safe-chain`。
### Unix/Linux/macOS```shell
curl -fsSL https://github.com/AikidoSec/safe-chain/releases/download/1.5.20/install-safe-chain.sh -o /tmp/install-safe-chain.sh \
&& echo "0ad25efe15d1fa56105157a454d647223e78eb0c53d1f85e3d10afcd722e7bfd /tmp/install-safe-chain.sh" | sha256sum -c - \
&& sh /tmp/install-safe-chain.sh --install-dir /usr/local/.safe-chain \
&& rm /tmp/install-safe-chain.sh
Windows```powershell
$installer = Join-Path $env:TEMP "install-safe-chain.ps1" Invoke-WebRequest "https://github.com/AikidoSec/safe-chain/releases/download/1.5.20/install-safe-chain.ps1" -OutFile $installer -UseBasicParsing $expectedHash = "468C342C5AABB71200B0BD19950984EDD5C4B39811B653B13A5AD15E0FBA4DFA" if ((Get-FileHash $installer -Algorithm SHA256).Hash -ne $expectedHash) { Remove-Item $installer -ErrorAction SilentlyContinue throw "Checksum verification failed for install-safe-chain.ps1" } & $installer -InstallDir 'C:\ProgramData\safe-chain' Remove-Item $installer
# 在 CI/CD 中的使用
你可以通过将 Aikido Safe Chain 集成到构建流程中,保护你的 CI/CD 流水线免受恶意软件包的侵害。这确保在自动化构建过程中安装的任何软件包在安装前都会经过恶意软件检查。
## 为 CI/CD 安装
使用 `--ci` 标志可自动为 CI/CD 环境配置 Aikido Safe Chain。这会在 PATH 中设置可执行文件垫片,而不是 shell 别名。
### Unix/Linux/macOS(GitHub Actions、Azure Pipelines 等)```shell
curl -fsSL https://github.com/AikidoSec/safe-chain/releases/download/1.5.20/install-safe-chain.sh -o /tmp/install-safe-chain.sh \
&& echo "0ad25efe15d1fa56105157a454d647223e78eb0c53d1f85e3d10afcd722e7bfd /tmp/install-safe-chain.sh" | sha256sum -c - \
&& sh /tmp/install-safe-chain.sh --ci \
&& rm /tmp/install-safe-chain.sh
Windows(Azure Pipelines 等)```powershell
$installer = Join-Path $env:TEMP "install-safe-chain.ps1" Invoke-WebRequest "https://github.com/AikidoSec/safe-chain/releases/download/1.5.20/install-safe-chain.ps1" -OutFile $installer -UseBasicParsing $expectedHash = "468C342C5AABB71200B0BD19950984EDD5C4B39811B653B13A5AD15E0FBA4DFA" if ((Get-FileHash $installer -Algorithm SHA256).Hash -ne $expectedHash) { Remove-Item $installer -ErrorAction SilentlyContinue throw "Checksum verification failed for install-safe-chain.ps1" } & $installer -ci Remove-Item $installer
## 支持的平台
- ✅ **GitHub Actions**
- ✅ **Azure Pipelines**
- ✅ **CircleCI**
- ✅ **Jenkins**
- ✅ **Bitbucket Pipelines**
- ✅ **GitLab Pipelines**
## GitHub Actions 示例```yaml
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
cache: "npm"
- name: Install safe-chain
run: |
curl -fsSL https://github.com/AikidoSec/safe-chain/releases/download/1.5.20/install-safe-chain.sh -o /tmp/install-safe-chain.sh
echo "0ad25efe15d1fa56105157a454d647223e78eb0c53d1f85e3d10afcd722e7bfd /tmp/install-safe-chain.sh" | sha256sum -c -
sh /tmp/install-safe-chain.sh --ci
rm /tmp/install-safe-chain.sh
- name: Install dependencies
run: npm ci
Azure DevOps 示例```yaml
-
task: NodeTool@0 inputs: versionSpec: "22.x" displayName: "Install Node.js"
-
script: | curl -fsSL https://github.com/AikidoSec/safe-chain/releases/download/1.5.20/install-safe-chain.sh -o /tmp/install-safe-chain.sh echo "0ad25efe15d1fa56105157a454d647223e78eb0c53d1f85e3d10afcd722e7bfd /tmp/install-safe-chain.sh" | sha256sum -c - sh /tmp/install-safe-chain.sh --ci rm /tmp/install-safe-chain.sh displayName: "Install safe-chain"
-
script: npm ci displayName: "Install dependencies"
## CircleCI 示例```yaml
version: 2.1
jobs:
build:
docker:
- image: cimg/node:lts
steps:
- checkout
- run: |
curl -fsSL https://github.com/AikidoSec/safe-chain/releases/download/1.5.20/install-safe-chain.sh -o /tmp/install-safe-chain.sh
echo "0ad25efe15d1fa56105157a454d647223e78eb0c53d1f85e3d10afcd722e7bfd /tmp/install-safe-chain.sh" | sha256sum -c -
sh /tmp/install-safe-chain.sh --ci
rm /tmp/install-safe-chain.sh
- run: npm ci
workflows:
build_and_test:
jobs:
- build
Jenkins 示例
注意:此示例假设 Jenkins 代理上已安装 Node.js 和 npm。```groovy pipeline { agent any
environment { // Jenkins does not automatically persist PATH updates from setup-ci, // so add the shims + binary directory explicitly for all stages. // If you installed into a custom directory, replace ~/.safe-chain with that path here. PATH = "${env.HOME}/.safe-chain/shims:${env.HOME}/.safe-chain/bin:${env.PATH}" }
stages { stage('Install safe-chain') { steps { sh ''' set -euo pipefail
# Install Safe Chain for CI
curl -fsSL https://github.com/AikidoSec/safe-chain/releases/download/1.5.20/install-safe-chain.sh -o /tmp/install-safe-chain.sh
echo "0ad25efe15d1fa56105157a454d647223e78eb0c53d1f85e3d10afcd722e7bfd /tmp/install-safe-chain.sh" | sha256sum -c -
sh /tmp/install-safe-chain.sh --ci
rm /tmp/install-safe-chain.sh
'''
}
}
stage('Install project dependencies etc...') {
steps {
sh '''
set -euo pipefail
npm ci
'''
}
}
} }
## Bitbucket Pipelines 示例```yaml
image: node:22
steps:
- step:
name: Install
script:
- |
curl -fsSL https://github.com/AikidoSec/safe-chain/releases/download/1.5.20/install-safe-chain.sh -o /tmp/install-safe-chain.sh
echo "0ad25efe15d1fa56105157a454d647223e78eb0c53d1f85e3d10afcd722e7bfd /tmp/install-safe-chain.sh" | sha256sum -c -
sh /tmp/install-safe-chain.sh --ci
rm /tmp/install-safe-chain.sh
- export PATH=~/.safe-chain/shims:~/.safe-chain/bin:$PATH
- npm ci
设置完成后,CI 流水线中所有后续的包管理器命令都将自动受到 Aikido Safe Chain 恶意软件检测的保护。
GitLab Pipelines 示例
要在 GitLab 流水线中添加 safe-chain,您需要在运行流水线的镜像中安装它。可以通过以下方式完成:
-
定义一个 dockerfile 来运行您的构建 ```dockerfile FROM node:lts
Install safe-chain
RUN curl -fsSL https://github.com/AikidoSec/safe-chain/releases/download/1.5.20/install-safe-chain.sh -o /tmp/install-safe-chain.sh
&& echo "0ad25efe15d1fa56105157a454d647223e78eb0c53d1f85e3d10afcd722e7bfd /tmp/install-safe-chain.sh" | sha256sum -c -
&& sh /tmp/install-safe-chain.sh --ci
&& rm /tmp/install-safe-chain.shAdd safe-chain to PATH (update paths if you used a custom install dir)
ENV PATH="/root/.safe-chain/shims:/root/.safe-chain/bin:${PATH}"
-
在您的 CI 流水线中构建 Docker 镜像 ```yaml build-image: stage: build-image image: docker:latest services: - docker:dind script: - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - docker build -t $CI_REGISTRY_IMAGE:latest . - docker push $CI_REGISTRY_IMAGE:latest
-
在您的流水线中使用该镜像: ```yaml npm-ci: stage: install image: $CI_REGISTRY_IMAGE:latest script: - npm ci
此示例的完整流水线如下所示:```yaml stages:
- build-image
- install
build-image: stage: build-image image: docker:latest services: - docker:dind script: - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - docker build -t $CI_REGISTRY_IMAGE:latest . - docker push $CI_REGISTRY_IMAGE:latest
npm-ci: stage: install image: $CI_REGISTRY_IMAGE:latest script: - npm ci
# 故障排除
遇到问题?请参阅[故障排除指南](https://github.com/aikidosec/safe-chain/blob/main/docs/troubleshooting.md)以获取常见问题的帮助。
# 报告问题
如果您遇到问题:
1. 访问 [GitHub Issues](https://github.com/AikidoSec/safe-chain/issues)
2. 请包含以下内容:
* 操作系统及版本
* Shell 类型及版本
* `safe-chain --version` 的输出
* 验证命令的输出
* 失败命令的详细日志(添加 `--safe-chain-logging=verbose` 参数)