关于依赖项审查
依赖项审查帮助您了解依赖项变化以及这些变化在每个拉取请求中的安全影响。 它提供了一个易于理解的依赖项变化视图,多差异显示在拉取请求的“Files Changed(更改的文件)”选项卡上。 依赖项审查告知您:
- 哪些依赖项连同发行日期一起添加、删除或更新。
- 有多少项目使用这些组件。
- 这些依赖项的漏洞数据。
更多信息请参阅“关于依赖项审查”和“查看拉取请求中的依赖项更改”。
关于配置依赖项审查
依赖项审查在所有产品的所有公共存储库中都可用,并且无法禁用。 依赖项审查在使用 GitHub Enterprise Cloud 并具有 GitHub Advanced Security 许可证的组织拥有的私有存储库中可用。 更多信息请参阅 GitHub Enterprise Cloud 文档。
配置 依赖项审查 GitHub Action
Note: The 依赖项审查 GitHub Action is currently in public beta and subject to change.
For more information about the action and the API endpoint, see "About dependency review," and "Dependency review" in the API documentation, respectively.
以下是可用的配置选项:
选项 | 必选 | 用法 |
---|---|---|
fail-on-severity | 可选 | 定义严重性级别的阈值(低 、中 、高 、严重 )。对于引入指定严重性级别或更高级别的漏洞的任何拉取请求,该操作都将失败。 |
allow-licenses | 可选 | 包含允许的许可证的列表。 您可以在 API 文档的许可证页面中找到此参数的可能值。 对于引入与列表不匹配的许可证的依赖项的拉取请求,该操作将失败。 |
deny-licenses | 可选 | 包含禁止的许可证列表。 您可以在 API 文档的许可证页面中找到此参数的可能值。 对于引入与列表匹配的许可证的依赖项的拉取请求,该操作将失败。 |
提示: allow-licenses
和 deny-licenses
选项是互斥的。
此 依赖项审查 GitHub Action 示例文件说明了如何使用这些配置选项。
name: 'Dependency Review'
on: [pull_request]
permissions:
contents: read
jobs:
dependency-review:
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v3
- name: Dependency Review
uses: actions/dependency-review-action@v2
with:
# Possible values: "critical", "high", "moderate", "low"
fail-on-severity: critical
# You can only can only include one of these two options: `allow-licenses` and `deny-licences`
# ([String]). Only allow these licenses (optional)
# Possible values: Any `spdx_id` value(s) from https://docs.github.com/en/rest/licenses
# allow-licenses: GPL-3.0, BSD-3-Clause, MIT
# ([String]). Block the pull request on these licenses (optional)
# Possible values: Any `spdx_id` value(s) from https://docs.github.com/en/rest/licenses
# deny-licenses: LGPL-2.0, BSD-2-Clause
有关配置选项的更多详细信息,请参阅 dependency-review-action
。