# JFrog Xray

**JFrog Xray** 是 JFrog 推出的一款软件成分分析（Software Composition Analysis，SCA）工具，可扫描源代码与二进制文件，以检测开源及第三方组件中的漏洞、恶意软件包、许可证风险和运维问题。<sup>[1](https://docs.jfrog.com/security/docs/xray)</sup> 它是 JFrog 软件供应链平台的组成部分，并与 [JFrog Artifactory](https://www.edgepedia.org/zh/jfrog-artifactory) 原生集成——后者是存储 Xray 所分析二进制文件的制品仓库。<sup>[1](https://docs.jfrog.com/security/docs/xray)</sup> JFrog 于 2016 年 5 月 23 日在其 swampUP 用户大会上推出 Xray，作为公司的第四款产品。<sup>[2](https://devops.com/jfrog-introduces-xray-makes-devops-omniscient/)</sup>

| 关键事实 | 详情 |
|---|---|
| 类别 | 用于检测漏洞、恶意软件包、许可证风险和运维问题的软件成分分析（SCA）工具<sup>[1](https://docs.jfrog.com/security/docs/xray)</sup> |
| 首次发布 | 2016 年 5 月 23 日，在 JFrog 的 swampUP 大会上发布<sup>[2](https://devops.com/jfrog-introduces-xray-makes-devops-omniscient/)</sup> |
| 核心机制 | 对仓库、构建和发布包（Release Bundles）建立索引是前提；Xray 只扫描已索引的资源<sup>[3](https://docs.jfrog.com/security/docs/index-xray-resources)</sup> |
| 强制执行 | 策略（Policies）与监控（Watches）会生成违规项，可阻止下载、使构建失败或阻止分发<sup>[4](https://docs.jfrog.com/security/docs/continuous-monitoring)</sup> |
| 持续监控 | 当 JFrog 全球漏洞数据库更新时，影响分析（Impact Analysis）会重新评估已索引的制品；在 SaaS 和在线同步环境中约每小时一次<sup>[4](https://docs.jfrog.com/security/docs/continuous-monitoring)</sup> |
| CI/CD 集成 | 支持 Jenkins、Azure DevOps、Bamboo、TeamCity 和 JFrog CLI，由 Artifactory 中转扫描请求<sup>[5](https://docs.jfrog.com/security/docs/ci-cd-integration-with-xray)</sup> |
| SBOM 格式 | 可读取并生成 CycloneDX 1.3 至 1.7（JSON 和 XML）以及 SPDX 2（JSON）<sup>[6](https://docs.jfrog.com/security/docs/supported-technologies-xray)</sup> |
| 版本支持 | 每个版本自发布起提供 18 个月支持<sup>[7](https://docs.jfrog.com/releases/docs/xray)</sup> |

## 用途与在平台中的定位

Xray 应对的是基于开源和第三方组件构建的软件所带来的风险：它清点应用内部的组件，将其与漏洞和许可证数据进行交叉比对，并标记出违反组织安全或合规阈值的项目。<sup>[1](https://docs.jfrog.com/security/docs/xray)</sup><sup> • </sup><sup>[8](https://jfrog.com/xray/)</sup> JFrog 将其描述为一款企业级 SCA 工具，用于识别、排序并修复开源软件中的漏洞与许可证合规问题。<sup>[8](https://jfrog.com/xray/)</sup>

由于 Xray 内建于 Artifactory，它扫描组织已存储的二进制文件，而无需另行上传。对于源代码，JFrog 提供互补路径：Frogbot 和 IDE 插件可就代码给出即时反馈与自动修复，而构建信息（build-info）扫描则能捕捉构建过程中引入的风险。<sup>[1](https://docs.jfrog.com/security/docs/xray)</sup> 扫描发现由厂商的威胁情报团队 JFrog Security Research 进行增强，该团队在原始 CVE 数据之上补充自有的严重性评分与可利用性背景。<sup>[1](https://docs.jfrog.com/security/docs/xray)</sup><sup> • </sup><sup>[4](https://docs.jfrog.com/security/docs/continuous-monitoring)</sup>

## 架构

Xray 服务由六个微服务组成，各自职责不同：<sup>[9](https://docs.jfrog.com/installation/docs/jfrog-xray-service)</sup>

1. **索引器（Indexer）** 递归解包制品与构建，从随附文件中收集制品元数据，并为每个制品构建组件图表示。
2. **持久化（Persist）** 将组件图与公开组件信息匹配，补全组件命名，并把图数据与元数据存入 [PostgreSQL](https://www.edgepedia.org/zh/postgresql)。
3. **分析（Analysis）** 用漏洞、许可证和版本信息增强组件元数据。
4. **服务端（Server）** 承载 API 与 UI 端点，运行数据库同步等定时任务，并发送通知。
5. **策略执行器（Policy Enforcer）** 将分析数据与 Xray 的监控和策略匹配，生成违规项。
6. **SBOM** 管理、存储并增强 Xray 及 JFrog Security 中其他产品的扫描结果。

服务之间通过消息队列传递工作流；例如，向已索引的仓库上传新制品会在索引队列中生成一条消息。<sup>[10](https://jfrog.com/help/r/xray-understanding-jfrog-xray-rabbitmq-queues-architecture-workers-and-scaling)</sup>

## 索引与扫描

索引是 Xray 一切工作的前提：该工具分析、映射并存储软件组件的元数据，使深度安全扫描与合规监控成为可能；它只扫描已被明确索引的资源。<sup>[3](https://docs.jfrog.com/security/docs/index-xray-resources)</sup> 可索引三类资源：Artifactory 中存放制品的仓库、CI/CD 生成并包含全部依赖的构建，以及为分发而打包的发布包。<sup>[3](https://docs.jfrog.com/security/docs/index-xray-resources)</sup>

用户控制索引范围。Xray 不会自动索引所有资源；管理员选择纳入哪些仓库、构建和发布包，并可微调诸如按制品存在时长建立索引之类的规则。<sup>[11](https://docs.jfrog.com/security/docs/configure-xray)</sup> 扫描范围也可按资源配置：既可扫描此后上传到某仓库的全部制品，也可只扫描符合既定模式的制品。<sup>[11](https://docs.jfrog.com/security/docs/configure-xray)</sup> 已索引资源有保留期，默认 90 天，可通过系统 YAML 配置；下载某个制品会重置该期限。<sup>[11](https://docs.jfrog.com/security/docs/configure-xray)</sup>

覆盖范围取决于包生态系统以及扫描运行的位置。源代码扫描通过 `jf audit`、Frogbot 和 JFrog IDE 插件读取清单文件与锁文件；平台扫描则在索引之后读取 Artifactory 中存储的构建产物。<sup>[6](https://docs.jfrog.com/security/docs/supported-technologies-xray)</sup> 支持的生态系统包括 Maven、Gradle、npm、Yarn、pnpm、PyPI、RubyGems、Cargo、SwiftPM、CocoaPods 等，还包括容器镜像内的操作系统包、Docker 与 OCI 镜像以及 Helm Chart；对 Helm Chart，Xray 的扫描方式是扫描其部署的容器镜像，而非 Chart 自身的文件。<sup>[6](https://docs.jfrog.com/security/docs/supported-technologies-xray)</sup> 对远程仓库，Xray 只扫描已缓存的制品，而非整个上游仓库。<sup>[6](https://docs.jfrog.com/security/docs/supported-technologies-xray)</sup>

## 策略、监控与违规项

两类配置对象把扫描发现转化为行动。策略是一组无上下文的安全或许可证合规规则，决定扫描中要标记什么；例如，安全策略可以设定取自 JFrog 漏洞数据库的最低漏洞严重级别。<sup>[12](https://jfrog.com/help/r/xray-xray-3-x-quickstart/3.-policies-and-watches?contentId=CYu4S_yyylRhw6NRnfOmsw)</sup> 监控针对特定仓库、构建和发布包进行监视，并对它们应用策略。<sup>[11](https://docs.jfrog.com/security/docs/configure-xray)</sup> 当某项发现与被监控资源上的策略规则匹配时，Xray 会生成违规项，并可执行自动操作：阻止下载不合规制品、使构建任务失败、阻止发布包分发，或通过电子邮件、Slack、Webhook 或 Jira 通知团队。<sup>[4](https://docs.jfrog.com/security/docs/continuous-monitoring)</sup>

## 持续监控与影响分析

Xray 的监控并不止于首次扫描。当 JFrog 全球漏洞数据库收到新的漏洞或恶意软件包数据时，影响分析会找出受影响的已索引制品，更新其扫描报告，并重新评估所有匹配的监控与策略。<sup>[4](https://docs.jfrog.com/security/docs/continuous-monitoring)</sup> 该过程是事件驱动的：每次数据库变更都会生成一个扫描事件，Xray 复用原始扫描中的依赖图，套用新数据，只重新检查受影响的已索引资源。<sup>[4](https://docs.jfrog.com/security/docs/continuous-monitoring)</sup> 这包括某个 CVE 是否出现在 CISA 已知被利用漏洞（KEV）目录中的变化。<sup>[4](https://docs.jfrog.com/security/docs/continuous-monitoring)</sup>

更新频率取决于部署方式。在 SaaS 以及启用在线数据库同步的自管安装中，更新约每小时到达一次；离线环境则在管理员应用下载的数据库包时更新。在重大安全事件期间，包括活跃的恶意软件包攻击活动，JFrog 会加快漏洞情报更新。<sup>[4](https://docs.jfrog.com/security/docs/continuous-monitoring)</sup> 影响分析只覆盖保留期尚未过期的已索引资源。<sup>[4](https://docs.jfrog.com/security/docs/continuous-monitoring)</sup>

## CI/CD 集成

Xray 与 CI 服务器集成，使包含有漏洞制品或依赖的构建能在进入生产之前被阻止。支持的系统有 Jenkins、Azure DevOps、Bamboo、TeamCity 和 JFrog CLI。<sup>[5](https://docs.jfrog.com/security/docs/ci-cd-integration-with-xray)</sup> 在工作流中，成功的 CI 构建会将构建信息发布到 Artifactory，后者通过 `scanBuild` REST API 端点把扫描请求传给 Xray；Xray 依据配置了“使构建任务失败”操作的所有监控扫描该构建，若发现匹配的漏洞，则返回应使构建失败的指示。<sup>[5](https://docs.jfrog.com/security/docs/ci-cd-integration-with-xray)</sup> Artifactory 只充当中介，在 CI 服务器与 Xray 之间传递信息。<sup>[5](https://docs.jfrog.com/security/docs/ci-cd-integration-with-xray)</sup>

JFrog 的文档指出了一个具有实际后果的行为细节：如果 Xray 收到 `scanBuild` 请求，而未定义任何带“使构建任务失败”操作的监控，它总是返回使构建任务失败的指示，即使未发现漏洞。<sup>[5](https://docs.jfrog.com/security/docs/ci-cd-integration-with-xray)</sup> 文档还建议不要强制对每次开发者构建进行扫描，称这会抑制生产力，并建议采用定期扫描，例如在多名开发者的代码合并后进行夜间构建扫描。<sup>[5](https://docs.jfrog.com/security/docs/ci-cd-integration-with-xray)</sup>

## SBOM 支持与机器学习模型扫描

Xray 既读取也生成软件物料清单：它可以导入 SBOM 进行扫描，也可从扫描结果导出 SBOM，支持 JSON 与 XML 格式的 [CycloneDX](https://www.edgepedia.org/zh/cyclonedx) 1.3 至 1.7 版本以及 JSON 格式的 SPDX 2。<sup>[6](https://docs.jfrog.com/security/docs/supported-technologies-xray)</sup> 专门的 SBOM 微服务负责管理、存储并增强 Xray 及 JFrog 其他安全产品的扫描结果。<sup>[9](https://docs.jfrog.com/installation/docs/jfrog-xray-service)</sup>

Xray 还扫描存储在 Artifactory 中的机器学习模型，无论它们位于 ML 仓库、通用仓库还是容器镜像内。它能识别以 `safetensors`、`onnx`、`gguf`、`pkl` 和 `pt` 等格式保存的模型；对 [Hugging Face](https://www.edgepedia.org/zh/hugging-face) 模型，它会报告识别结果、许可证和恶意模型检测；来自其他来源的模型只做识别。模型本身不携带 CVE，因此 Xray 不会为其报告漏洞。<sup>[6](https://docs.jfrog.com/security/docs/supported-technologies-xray)</sup> JFrog 在 2024 年收购 Qwak 之后，将这一能力定位为保障 AI 开发流程的安全。<sup>[13](https://investors.jfrog.com/files/doc_news/2024/06/1/JFrogLettertoShareholders_June2024_FINAL.pdf)</sup>

## 近期变化

两项产品调整说明了 Xray 在 JFrog 平台内的角色正如何被调整。JFrog 正在弃用 Xray 中针对远程仓库的“阻止下载”功能，并将其迁移至 JFrog Curation；弃用将自 2026 年 4 月 1 日起至 2026 年 11 月分阶段推进。给出的理由是：Xray 作为扫描器，必须看到内容才能分析，这意味着文件已经进入缓存；而 Curation 会在软件包进入环境之前依据元数据将其阻止。<sup>[7](https://docs.jfrog.com/releases/docs/xray)</sup> 另外，JFrog 对每个 Xray 版本自发布之日起提供 18 个月支持；近期版本新增了自定义机密扫描器（Custom Secrets Scanner）等功能，可使用用户自定义模式在二进制文件和文本文件中搜索敏感信息。<sup>[7](https://docs.jfrog.com/releases/docs/xray)</sup>

## 在 SCA 领域的背景

Xray 所处的市场中，不同工具的输出可能差异巨大。2021 年一项针对单一大型 Web 应用、对九款业界领先 SCA 工具进行的比较研究发现，Maven 项目报告的易受攻击依赖数量从 17 到 332 不等，npm 项目则从 32 到 239 不等；研究结论是，从业者不应依赖任何单一工具，因为这样做可能导致遗漏已知漏洞。<sup>[14](https://arxiv.org/abs/2108.12078)</sup> 该研究指出，底层漏洞数据库的准确性是 SCA 工具之间的关键差异所在，而这正是 JFrog 通过其持续更新的全球漏洞数据库与 Security Research 增强所处理的层面。<sup>[14](https://arxiv.org/abs/2108.12078)</sup><sup> • </sup><sup>[4](https://docs.jfrog.com/security/docs/continuous-monitoring)</sup>

## References

1. [Xray, JFrog Documentation](https://docs.jfrog.com/security/docs/xray)
2. [JFrog Introduces Xray – Makes DevOps Omniscient, DevOps.com (May 23, 2016)](https://devops.com/jfrog-introduces-xray-makes-devops-omniscient/)
3. [Index Xray Resources, JFrog Documentation](https://docs.jfrog.com/security/docs/index-xray-resources)
4. [Continuous Monitoring, JFrog Documentation](https://docs.jfrog.com/security/docs/continuous-monitoring)
5. [CI-CD Integration with Xray, JFrog Documentation](https://docs.jfrog.com/security/docs/ci-cd-integration-with-xray)
6. [Supported Technologies, JFrog Documentation](https://docs.jfrog.com/security/docs/supported-technologies-xray)
7. [Xray Releases, JFrog Documentation](https://docs.jfrog.com/releases/docs/xray)
8. [Xray | Enterprise Grade SCA, JFrog](https://jfrog.com/xray/)
9. [Xray Service, JFrog Documentation](https://docs.jfrog.com/installation/docs/jfrog-xray-service)
10. [XRAY: Understanding JFrog Xray RabbitMQ Queues: Architecture, Workers, and Scaling, JFrog Help Center](https://jfrog.com/help/r/xray-understanding-jfrog-xray-rabbitmq-queues-architecture-workers-and-scaling)
11. [Configure Xray, JFrog Documentation](https://docs.jfrog.com/security/docs/configure-xray)
12. [Policies and Watches, Xray 3.x Quickstart, JFrog Help Center](https://jfrog.com/help/r/xray-xray-3-x-quickstart/3.-policies-and-watches?contentId=CYu4S_yyylRhw6NRnfOmsw)
13. [Letter to Shareholders, JFrog Investor Relations (June 2024)](https://investors.jfrog.com/files/doc_news/2024/06/1/JFrogLettertoShareholders_June2024_FINAL.pdf)
14. [Imtiaz, Thorne, and Williams (2021). A Comparative Study of Vulnerability Reporting by Software Composition Analysis Tools. arXiv:2108.12078](https://arxiv.org/abs/2108.12078)

---
*Initially written Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 软件与编程 › 具名软件产品与平台 › 静态分析与代码质量工具

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/jfrog-xray

English original: https://www.edgepedia.org/jfrog-xray
