Skip to main content

Configuring the dependency graph

You can allow users to identify their projects' dependencies by enabling the dependency graph.

谁可以使用此功能?

具有管理员角色的存储库所有者、组织所有者、安全管理员和用户

About the dependency graph

依赖项关系图是存储在存储库中的清单和锁定文件以及使用 依赖项提交 API 提交给存储库的任何依赖项的摘要。 对于每个存储库,它显示:

  • 依赖项、它依赖的生态系统和包
  • 依赖项,是指依赖于它的存储库和包

对于每个依赖项,可以看到版本、许可证信息、包含它的清单文件,以及它是否具有已知漏洞。 对于支持传递性依赖项的包生态系统,将显示依赖关系状态。你可以单击 ,然后选择“Show paths”,以查看引入该依赖项的传递路径。

还可以使用搜索栏搜索特定依赖项。 依赖项会自动排序,存在漏洞的包排在最上方。

For more information, see 关于依赖关系图.

Configuring the dependency graph

To generate a dependency graph, GitHub needs read-only access to the dependency manifest and lock files for a repository. The dependency graph can be enabled or disabled for all repositories. For more information on viewing the dependency graph, see Exploring the dependencies of a repository.

此外,可以使用 依赖项提交 API 从所选的包管理器或生态系统提交依赖项,即使依赖项关系图不支持使用该生态系统进行清单或锁定文件分析也是如此。 使用 依赖项提交 API 提交到项目的依赖项将显示用于提交的检测器以及提交时间。 有关 依赖项提交 API 的详细信息,请参阅 Using the dependency submission API

Enabling and disabling the dependency graph

存储库管理员可启用或禁用你的用户帐户拥有的所有存储库的依赖项关系图,无论其可见性如何。 请参阅“管理安全和分析功能”。

还可以同时为组织中的多个存储库启用依赖项关系图。 有关详细信息,请参阅“保护你的组织”。

  1. 在 GitHub 上,导航到存储库的主页面。

  2. 在仓库名称下,单击 “Settings”****。 如果看不到“设置”选项卡,请选择“”下拉菜单,然后单击“设置”。

    存储库标头的屏幕截图,其中显示了选项卡。 “设置”选项卡以深橙色边框突出显示。

  3. 在边栏的“Security”部分中,单击“ Advanced Security”****。

  4. 阅读有关授予 GitHub 对仓库数据的只读访问权限的消息,以启用依赖项关系图,然后在“依赖项关系图”旁边单击“启用”****。

    可以随时单击“Advanced Security”的设置页上“依赖项关系图”旁边的“禁用”来禁用依赖项关系图****。

When the dependency graph is first enabled, any manifest and lock files for supported ecosystems are parsed immediately. The graph is usually populated within minutes but this may take longer for repositories with many dependencies. Once enabled, the graph is automatically updated with every push to the repository and every push to other repositories in the graph.

Further reading