bifrostsec/bifrost-cli
GitHub: bifrostsec/bifrost-cli
bifrost-cli 是一款将 SBOM 文件上传至 bifrost 容器运行时安全平台的命令行工具,支持本地自动化与 CI/CD 流水线集成。
Stars: 0 | Forks: 0
# bifrost-cli
一个用于将 SBOM (Software Bill of Materials) 文件上传到 bifrost 的命令行工具。
本仓库包含 `bifrost-cli`,它允许你为特定服务和版本将 SBOM 提交到你的 bifrost 组织。它适用于本地自动化和 CI/CD 工作流,前提是你已经在构建 pipeline 中生成了 SBOM。
## 什么是 bifrost?
bifrost 通过为容器化应用程序提供 runtime 安全,帮助团队了解并降低实际的工作负载风险。
了解更多:
- 网站:[bifrostsec.com](https://bifrostsec.com/)
- 文档:[docs.bifrostsec.com](https://docs.bifrostsec.com/)
- 控制台:[portal.bifrostsec.com](https://portal.bifrostsec.com/)
## 快速开始
要使用 CLI,你首先需要一个 bifrost 账户和一个 API token。
1. 创建账户或登录 [bifrost 控制台](https://portal.bifrostsec.com/)。
2. 在组织设置中为你的组织创建一个 API token。
3. 选择你想要安装 CLI 的方式。
使用 Homebrew 安装(macOS 和 Linux):
brew install bifrostsec/tap/bifrost-cli
这将从 [bifrostsec/homebrew-tap](https://github.com/bifrostsec/homebrew-tap) tap 安装 `bifrost` 命令。以后要更新:
brew update
brew upgrade bifrost-cli
*(Windows 不支持 Homebrew —— 请使用以下选项之一。)*
下载已发布的可执行文件:
# macOS Apple Silicon 示例
curl -L -o bifrost https://github.com/bifrostsec/bifrost-cli/releases/latest/download/bifrost-darwin-arm64
chmod +x ./bifrost
*macOS 注意:当前的 macOS 发布二进制文件没有使用 Apple Developer 证书签名。当你第一次运行 `./bifrost` 时,macOS 可能会阻止它并显示如下警告:*
要允许该二进制文件在 macOS 上运行:
1. 尝试运行一次 `./bifrost`,以便 macOS 记录该被阻止的可执行文件。
2. 打开 `系统设置` > `隐私与安全性`。
3. 向下滚动到 `安全性` 部分,并点击 `bifrost` 旁边的 `仍要打开`。
4. 如果出现提示,请使用你的登录密码进行确认。
5. 再次运行 `./bifrost`。
*`仍要打开` 按钮仅在阻止启动尝试后的有限时间内显示,因此如果你没有看到它,请再次运行 `./bifrost` 并返回 `隐私与安全性`。*
发布资产发布于:
- [github.com/bifrostsec/bifrost-cli/releases/latest](https://github.com/bifrostsec/bifrost-cli/releases/latest)
可用的可执行文件名称包括:
- `bifrost-darwin-amd64`
- `bifrost-darwin-arm64`
- `bifrost-linux-amd64`
- `bifrost-linux-arm64`
- `bifrost-windows-386`
- `bifrost-windows-amd64`
或者从源码构建 CLI:
make build
4. 为某个服务及其版本上传一个 SBOM:
```
BIFROST_API_KEY=my-key ./bifrost --service=name --service-version=34ha353 sbom upload /path/to/sbom.json
```
CLI 上传 SBOM 时,API token 会作为 bearer token 发送。
## 用法
CLI 会上传一个或多个 SBOM 文件,并将它们与某个 bifrost 服务及服务版本关联起来。
```
./bifrost --service=my-service --service-version=1.2.3 sbom upload /path/to/sbom.json
```
你还可以使用 `-` 作为路径,从标准输入读取 SBOM:
```
cat /path/to/sbom.json | ./bifrost --service=my-service --service-version=1.2.3 sbom upload -
```
你可以控制针对临时上传失败的重试行为:
```
./bifrost --service=my-service --service-version=1.2.3 --retry-attempts=5 --retry-delay=5s sbom upload /path/to/sbom.json
```
你可以将 Git 元数据附加到上传请求中:
```
./bifrost --service=my-service --service-version=1.2.3 --git-branch=main --git-commit-sha=abc123 --git-origin=https://github.com/example/project.git sbom upload /path/to/sbom.json
```
示例:使用 Trivy 为容器镜像生成 CycloneDX SBOM,并将其直接通过管道传递给 bifrost:
```
trivy image --format cyclonedx | ./bifrost --service=my-service --service-version=1.2.3 sbom upload -
```
示例:使用 GitHub CLI 导出仓库依赖图 SBOM,并将 SPDX 文档通过管道传递给 bifrost:
```
gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2026-03-10" \
/repos/OWNER/REPO/dependency-graph/sbom \
--jq '.sbom' | ./bifrost --service=my-service --service-version=1.2.3 sbom upload -
```
你可以通过以下方式提供 API token:
- `BIFROST_API_KEY` 环境变量
- `--api-key` 标志
## 相关链接
- 网站:[bifrostsec.com](https://bifrostsec.com/)
- 文档:[docs.bifrostsec.com](https://docs.bifrostsec.com/)
- 发布版本:[github.com/bifrostsec/bifrost-cli/releases/latest](https://github.com/bifrostsec/bifrost-cli/releases/latest)
- 入门指南:[docs.bifrostsec.com/guides/get-started](https://docs.bifrostsec.com/guides/get-started/)
- SBOM 参考:[https://docs.bifrostsec.com/reference/sbom/](https://docs.bifrostsec.com/reference/sbom/)
- API 参考:[docs.bifrostsec.com/api/v2](https://docs.bifrostsec.com/api/v2/)
- 控制台:[portal.bifrostsec.com](https://portal.bifrostsec.com/)
## 许可证
Apache-2.0。参见 [LICENSE](LICENSE)。
标签:DevSecOps, EVTX分析, SBOM管理, Web截图, 上游代理, 容器安全, 文档结构分析, 日志审计