# Dependabot 安全更新

Dependabot 可以通过发起包含安全更新的拉取请求，为您修复存在漏洞的依赖项。

<!--Marketing-LINK: From /features/security/software-supply-chain page "About Dependabot security updates".-->

> \[!NOTE]
> 站点管理员必须先为 Dependabot updates设置 你的 GitHub Enterprise Server 实例，然后你才能使用此功能。 有关详细信息，请参阅 [为企业启用 Dependabot](/zh/enterprise-server@3.17/admin/configuration/configuring-github-connect/enabling-dependabot-for-your-enterprise).
>
> 如果企业所有者在企业级别设置了策略，你可能无法启用或禁用 Dependabot updates。 有关详细信息，请参阅“[强制实施企业的代码安全性和分析策略](/zh/enterprise-server@3.17/admin/policies/enforcing-policies-for-your-enterprise/enforcing-policies-for-code-security-and-analysis-for-your-enterprise)”。

## 关于 Dependabot security updates

Dependabot security updates 使你更轻松地修复存储库中易受攻击的依赖项。

如果启用 Dependabot security updates，当存储库的依赖项关系图中针对易受攻击的依赖项引发警报时 Dependabot ， Dependabot 会自动尝试修复它。 有关详细信息，请参阅 [Dependabot alerts](/zh/enterprise-server@3.17/code-security/dependabot/dependabot-alerts/about-dependabot-alerts) 和 [配置 Dependabot 安全更新](/zh/enterprise-server@3.17/code-security/dependabot/dependabot-security-updates/configuring-dependabot-security-updates)。

可以将配置文件添加到 `dependabot.yml` 存储库以自定义 Dependabot 行为，包括更新计划、拉取请求设置以及要监视的依赖项。  有关详细信息，请参阅“[关于 dependabot.yml 文件](/zh/enterprise-server@3.17/code-security/concepts/supply-chain-security/about-the-dependabot-yml-file)”。 然后，在此文件中配置选项，以告知 Dependabot 如何保护存储库所依赖的依赖项。

有关受支持的仓库和生态系统的详细信息，请参阅“[Dependabot 支持的生态系统和存储库](/zh/enterprise-server@3.17/code-security/dependabot/ecosystems-supported-by-dependabot/supported-ecosystems-and-repositories)”。

> \[!NOTE]
> 除以下情况外，`dependabot.yml` 文件中指定的设置与 Dependabot 安全警报之间没有任何交互：当合并由 Dependabot 为安全更新生成的相关拉取请求时，警报将会关闭。

Dependabot 默认对自己的提交进行签名，即使提交签名不是存储库的要求。 有关已验证提交的详细信息，请参阅“[关于提交签名验证](/zh/enterprise-server@3.17/authentication/managing-commit-signature-verification/about-commit-signature-verification)”。

> \[!NOTE]
> 为存储库启用 Dependabot security updates 时，Dependabot 将自动尝试打开拉取请求，以解决每个具有可用修补程序的打开的 Dependabot 警报。\*\*\*\* 如果希望自定义 Dependabot 为其打开拉取请求的警报，则应禁用 Dependabot security updates 并创建自动会审规则。\*\*\*\* 有关详细信息，请参阅“[自定义自动分类规则以确定 Dependabot 警报的优先级](/zh/enterprise-server@3.17/code-security/dependabot/dependabot-auto-triage-rules/customizing-auto-triage-rules-to-prioritize-dependabot-alerts)”。

GitHub 可能会向受最近发布的 Dependabot alerts 安全公告中披露的漏洞影响的仓库发送 GitHub。 有关详细信息，请参阅“[在 GitHub Advisory Database 中浏览安全公告](/zh/enterprise-server@3.17/code-security/security-advisories/working-with-global-security-advisories-from-the-github-advisory-database/browsing-security-advisories-in-the-github-advisory-database)”。

Dependabot 检查是否可以将易受攻击的依赖项升级到固定版本，而不会中断存储库的依赖项关系图。 然后 Dependabot 引发拉取请求，将依赖项更新到包含修补程序的最低版本，并将拉取请求 Dependabot 链接到警报，或报告警报上的错误。 有关详细信息，请参阅“[Dependabot 错误](/zh/enterprise-server@3.17/code-security/dependabot/troubleshooting-dependabot/troubleshooting-dependabot-errors)”。

Dependabot security updates 功能适用于你已启用依赖项图和 Dependabot alerts 的存储库。 对于在你的完整依赖关系图中识别出的每个易受攻击的依赖项，你都会看到一条 Dependabot 警报。 但是，安全更新仅针对清单或锁定文件中指定的依赖项而触发。 有关详细信息，请参阅“[依赖项关系图](/zh/enterprise-server@3.17/code-security/supply-chain-security/understanding-your-software-supply-chain/about-the-dependency-graph#dependencies-included)”。

> \[!NOTE]
> 对于 npm， Dependabot 将引发拉取请求以将显式定义的依赖项更新到安全版本，即使这意味着更新父依赖项或依赖项，甚至删除父级不再需要的子依赖项。 对于其他生态系统，如果还需要更新父依赖项， Dependabot 则无法更新间接或可传递依赖项。 有关详细信息，请参阅“[Dependabot 错误](/zh/enterprise-server@3.17/code-security/dependabot/troubleshooting-dependabot/troubleshooting-dependabot-errors#dependabot-tries-to-update-dependencies-without-an-alert)”。

可以启用相关功能， Dependabot version updates以便在 Dependabot 检测到过时依赖项时引发拉取请求，以将清单更新到最新版本的依赖项。 有关详细信息，请参阅“[Dependabot 版本更新](/zh/enterprise-server@3.17/code-security/dependabot/dependabot-version-updates/about-dependabot-version-updates)”。

当 Dependabot 提出拉取请求时，这些拉取请求可以是安全更新或版本更新：

* Dependabot security updates 是自动拉取请求，可帮助你更新已知漏洞的信赖项。
* Dependabot version updates 是自动拉取请求，即使它们没有任何漏洞，也会保持更新依赖项。 要检查版本更新的状态，请导航到你的仓库的“Insights”选项卡，然后选择“Dependency Graph”和“Dependabot”。\*\*\*\*\*\*\*\*

如果启用 *Dependabot security updates*，部分配置还可能影响针对 *Dependabot version updates* 创建的拉取请求。 这是因为某些配置设置是这两种类型的更新通用的。 有关详细信息，请参阅“[自定义 Dependabot 安全更新的拉取请求](/zh/enterprise-server@3.17/code-security/dependabot/dependabot-security-updates/customizing-dependabot-security-prs)”。

启用 Dependabot updates 之前，必须配置 你的 GitHub Enterprise Server 实例 以使用具有自托管运行器的 GitHub Actions。 和 GitHub Actions 需要 Dependabot version updates Dependabot security updates 才能在 GitHub 上运行。 有关详细信息，请参阅“[为企业启用 Dependabot](/zh/enterprise-server@3.17/admin/configuration/configuring-github-connect/enabling-dependabot-for-your-enterprise)”。

Dependabot security updates 可以修复 GitHub Actions 中有漏洞的依赖项。 启用安全更新后，Dependabot 将自动提出拉取请求，以将工作流中使用的存在漏洞的 GitHub Actions 更新到最低的已修补版本。

## 关于分组的安全更新

若要进一步减少可能看到的拉取请求数，你可以启用分组的安全更新将依赖项集分组在一起（每个包生态系统）。
Dependabot 然后引发单个拉取请求，以更新组中尽可能多的易受攻击的依赖项，以同时保护版本。

对于安全更新， Dependabot 仅在特定条件和配置下将来自每个生态系统的不同目录的依赖项分组。
Dependabot
**不会** 将来自不同包生态系统的依赖项组合在一起，并且 **不会** 使用版本更新对安全更新进行分组。

可以通过以下其中一种方式或两种方式为 Dependabot security updates 启用分组拉取请求。

* 若要将尽可能多的可用安全更新组合在一起，请跨目录和每个生态系统，在存储库的“设置”或组织下的“Advanced Security全局设置”中 Advanced Security 启用分组。
* 如需更精细地控制分组（例如按包名称、开发/生产依赖项、SemVer 级别或每个生态系统的多个目录进行分组），请在仓库中的 `dependabot.yml` 配置文件中添加配置选项。

> \[!NOTE]
> 如果已在 `dependabot.yml` 文件中为 Dependabot security updates 配置了组规则，则所有可用更新都将根据指定的规则进行分组。 如果还启用了组织或存储库级别的分组安全更新设置，则 Dependabot 只会跨那些未在 `dependabot.yml` 中配置的目录进行分组。

有关详细信息，请参阅“[配置 Dependabot 安全更新](/zh/enterprise-server@3.17/code-security/dependabot/dependabot-security-updates/configuring-dependabot-security-updates#grouping-dependabot-updates-into-a-single-pull-request)”。

## 关于自动停用 Dependabot updates

当仓库的维护者停止与 Dependabot 拉取请求交互时，Dependabot 会暂时暂停其更新并发出通知，请参阅 [不再生成 Dependabot 更新拉取请求](/zh/enterprise-server@3.17/code-security/dependabot/troubleshooting-dependabot/dependabot-updates-stopped)。

## 关于 Dependabot 安全更新的通知

您可以在 GitHub 上筛选通知，以仅显示 Dependabot 安全更新。 有关详细信息，请参阅“[在收件箱中管理通知](/zh/enterprise-server@3.17/account-and-profile/managing-subscriptions-and-notifications-on-github/viewing-and-triaging-notifications/managing-notifications-from-your-inbox#dependabot-custom-filters)”。