如何通过 GitHub API 获取 dependabot 警报列表?
How to GET the list of dependabot alerts via GitHub API?
如何通过 GitHub API 在 https://github.com/{user}/{repo}/security/dependabot?page=1&q=is%3Aopen 获取可用的 dependabot 警报列表?
我搜索了 the documentation 但在那里找不到任何东西。
谢谢!
有这个RepositoryVulnerabilityAlert object available with the Graphql API.
例如,对于特定存储库,您可以使用以下查询获取所有警报(在 the explorer 中查看):
{
repository(name: "repo-name", owner: "repo-owner") {
vulnerabilityAlerts(first: 100) {
nodes {
createdAt
dismissedAt
securityVulnerability {
package {
name
}
advisory {
description
}
}
}
}
}
}
它还有 returns 被关闭的警报,可以使用 dismissedAt
字段发现。但是似乎没有办法只过滤“活动”警报
示例输出:
{
"data": {
"repository": {
"vulnerabilityAlerts": {
"nodes": [
{
"createdAt": "2018-03-05T19:13:26Z",
"dismissedAt": null,
"securityVulnerability": {
"package": {
"name": "moment"
},
"advisory": {
"description": "Affected versions of `moment` are vulnerable to a low severity regular expression denial of service when parsing dates as strings.\n\n\n## Recommendation\n\nUpdate to version 2.19.3 or later."
}
}
},
....
]
}
}
}
}
如何通过 GitHub API 在 https://github.com/{user}/{repo}/security/dependabot?page=1&q=is%3Aopen 获取可用的 dependabot 警报列表?
我搜索了 the documentation 但在那里找不到任何东西。
谢谢!
有这个RepositoryVulnerabilityAlert object available with the Graphql API.
例如,对于特定存储库,您可以使用以下查询获取所有警报(在 the explorer 中查看):
{
repository(name: "repo-name", owner: "repo-owner") {
vulnerabilityAlerts(first: 100) {
nodes {
createdAt
dismissedAt
securityVulnerability {
package {
name
}
advisory {
description
}
}
}
}
}
}
它还有 returns 被关闭的警报,可以使用 dismissedAt
字段发现。但是似乎没有办法只过滤“活动”警报
示例输出:
{
"data": {
"repository": {
"vulnerabilityAlerts": {
"nodes": [
{
"createdAt": "2018-03-05T19:13:26Z",
"dismissedAt": null,
"securityVulnerability": {
"package": {
"name": "moment"
},
"advisory": {
"description": "Affected versions of `moment` are vulnerable to a low severity regular expression denial of service when parsing dates as strings.\n\n\n## Recommendation\n\nUpdate to version 2.19.3 or later."
}
}
},
....
]
}
}
}
}