exein-io/analyzer-scan
GitHub: exein-io/analyzer-scan
该 Action 将 Exein Analyzer 集成到 GitHub Actions 中,实现对固件、容器镜像和 SBOM 的自动化漏洞与安全风险扫描。
Stars: 3 | Forks: 0
[Exein Analyzer](https://www.exein.io/platform/exein-analyzer) 的 GitHub Action。在每次构建时扫描预构建的固件镜像、容器镜像和 SBOM,以检测漏洞、供应链风险和安全配置错误。
## 支持的固件
| OS / 框架 / 运行时 | 硬件平台 |
|---|---|
| Linux | 所有支持的平台[^2] |
| Docker | 所有支持的平台 |
| ESP-IDF | xtensa |
| ESP-IDF | riscv32 |
| ESP-IDF (PlatformIO) | xtensa |
| ESP-IDF (PlatformIO) | riscv32 |
| FreeRTOS | 所有支持的平台[^3] |
[^2]: https://docs.kernel.org/arch/index.html
[^3]: https://www.freertos.org/Documentation/02-Kernel/03-Supported-devices/00-Supported-devices
[^4]: https://docs.zephyrproject.org/latest/boards/index.html
## 前置条件
- 拥有带有 API key 的 Exein Analyzer 账户
- 已在 Analyzer 平台中创建对象 —— 使用 [Analyzer CLI](https://github.com/exein-io/homebrew-tools) 或 Web UI 创建
## 用法
该 Action 需要一个预构建的固件镜像。各项目的构建工具链差异很大(Docker、Yocto、Buildroot、ESP-IDF 等),因此该 Action 旨在补充您现有的构建流水线,而不是替换或合并它。
### 扫描固件镜像
```
- uses: exein-io/analyzer-scan@v1
with:
api-key: ${{ secrets.ANALYZER_API_KEY }}
object-id: '14e383ce-947f-11f0-8a00-0b80b65337cb'
scan-type: linux
file-path: ./image.tar.gz
```
### 在 Docker 构建后扫描
```
- uses: docker/build-push-action@v5
with:
context: .
outputs: type=docker,dest=/tmp/image.tar
- uses: exein-io/analyzer-scan@v1
with:
api-key: ${{ secrets.ANALYZER_API_KEY }}
object-id: '14e383ce-947f-11f0-8a00-0b80b65337cb'
scan-type: docker
file-path: /tmp/image.tar
```
### 下载报告和 SBOM
```
- uses: exein-io/analyzer-scan@v1
id: scan
with:
api-key: ${{ secrets.ANALYZER_API_KEY }}
object-id: '14e383ce-947f-11f0-8a00-0b80b65337cb'
scan-type: linux
file-path: ./build/firmware.tar.gz
download-report: 'true'
download-sbom: 'true'
- run: echo "Scan results: ${{ steps.scan.outputs.scan-url }}"
- uses: actions/upload-artifact@v4
with:
name: scan-artifacts
path: |
${{ steps.scan.outputs.report-path }}
${{ steps.scan.outputs.sbom-path }}
```
### 并行扫描多个镜像
```
jobs:
scan:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- name: gateway
object-id: 'a1b2c3d4-5678-9abc-def0-1234567890ab'
scan-type: linux
file-path: ./build/gateway.bin
- name: sensor
object-id: 'e5f6a7b8-9012-3456-7890-abcdef123456'
scan-type: idf
file-path: ./build/sensor.bin
- name: api-server
object-id: 'a9b0c1d2-3456-7890-abcd-ef1234567890'
scan-type: docker
file-path: ./build/api-server.tar
steps:
- uses: actions/checkout@v7
- uses: exein-io/analyzer-scan@v1
with:
api-key: ${{ secrets.ANALYZER_API_KEY }}
object-id: ${{ matrix.object-id }}
scan-type: ${{ matrix.scan-type }}
file-path: ${{ matrix.file-path }}
```
## 输入
| 输入 | 必需 | 默认值 | 描述 |
|---|---|---|---|
| `api-key` | 是 | — | Exein Analyzer API key |
| `api-url` | 否 | `https://analyzer.exein.io/api/` | 基础 API URL |
| `object-id` | 是 | — | 要扫描的 Analyzer 对象的 UUID |
| `scan-type` | 是 | — | `docker`、`linux`、`idf` 或 `sbom` |
| `file-path` | 是 | — | 固件/镜像/SBOM 文件的路径 |
| `download-report` | 否 | `false` | 扫描后下载 PDF 报告 |
| `download-sbom` | 否 | `false` | 扫描后下载 SBOM JSON |
| `cli-version` | 否 | `latest` | 指定 [Analyzer CLI](https://github.com/exein-io/homebrew-tools) 版本(例如 `v1.0.0`) |
## 输出
| 输出 | 描述 |
|---|---|
| `scan-id` | 创建的扫描的 UUID |
| `scan-url` | 指向 Analyzer UI 中扫描结果的直接链接 |
| `report-path` | 下载的 PDF 报告的路径(当 `download-report: true` 时设置) |
| `sbom-path` | 下载的 SBOM JSON 的路径(当 `download-sbom: true` 时设置) |
## 分析类型
每种扫描类型都会运行一组固定的分析(不可配置):
| 分析 | `docker` | `linux` | `idf` | `sbom` |
|---|---|---|---|---|
| `info` | 是 | 是 | 是 | — |
| `cve` | 是 | 是 | 是 | 是 |
| `software-bom` | 是 | 是 | 是 | 是 |
| `password-hash` | 是 | 是 | — | — |
| `crypto` | 是 | 是 | — | — |
| `malware` | 是 | 是 | — | — |
| `hardening` | 是 | 是 | — | — |
| `capabilities` | 是 | 是 | — | — |
| `kernel` | — | 是 | — | — |
| `symbols` | — | — | 是 | — |
| `tasks` | — | — | 是 | — |
| `stack-overflow` | — | — | 是 | — |
## 许可证
Apache-2.0
标签:Docker, GitHub Action, SBOM, 固件安全, 安全合规, 安全防御评估, 硬件无关, 网络代理, 自动化攻击, 自定义DNS解析器, 请求拦截