密钥扫描的 REST API 端点
使用 REST API 检索和更新代码仓库中的密钥警报。
关于密钥扫描
您可以使用 API 来
- 启用或禁用代码仓库的密钥扫描和推送保护。有关更多信息,请参阅“代码仓库的 REST API 端点”并展开“
security_and_analysis
对象的属性”部分。 - 检索和更新代码仓库中的密钥扫描警报。有关更多详细信息,请参阅以下部分。
有关密钥扫描的更多信息,请参阅“关于密钥扫描”。
列出企业中的密钥扫描警报
列出企业中符合条件的代码仓库的密钥扫描警报,从最新到最旧。
仅返回企业中经过身份验证的用户为组织所有者或安全管理员的组织的警报。
经过身份验证的用户必须是企业的成员才能使用此端点。
OAuth 应用令牌和个人访问令牌(经典)需要 repo
范围或 security_events
范围才能使用此端点。
“列出企业中的密钥扫描警报”的细粒度访问令牌
此端点不适用于 GitHub App 用户访问令牌、GitHub App 安装访问令牌或细粒度个人访问令牌。
“列出企业中的密钥扫描警报”的参数
名称、类型、描述 |
---|
accept 字符串建议设置为 |
名称、类型、描述 |
---|
enterprise 字符串 必需企业的 slug 版本名称。您也可以用企业 ID 替换此值。 |
名称、类型、描述 |
---|
state 字符串设置为 可以是以下之一: |
secret_type 字符串要返回的密钥类型的逗号分隔列表。默认情况下,将返回所有密钥类型。有关密钥类型的完整列表,请参阅“支持的密钥扫描模式”。 |
resolution 字符串逗号分隔的分辨率列表。仅列出具有以下任一分辨率的密钥扫描警报。有效分辨率为 |
sort 字符串用于对结果进行排序的属性。 默认值: 可以是以下之一: |
direction 字符串用于对结果进行排序的方向。 默认值: 可以是以下之一: |
per_page 整数每页的结果数(最大 100)。有关更多信息,请参阅“在 REST API 中使用分页”。 默认值: |
before 字符串光标,如链接标头中所示。如果指定,则查询仅搜索此光标之前的结果。有关更多信息,请参阅“在 REST API 中使用分页”。 |
after 字符串光标,如链接标头中所示。如果指定,则查询仅搜索此光标之后的结果。有关更多信息,请参阅“在 REST API 中使用分页”。 |
validity 字符串逗号分隔的有效性列表,当存在时,将返回与该列表中的有效性匹配的警报。有效选项为 |
is_publicly_leaked 布尔值一个布尔值,表示是否根据公开泄露标签是否存在来筛选警报。 默认值: |
is_multi_repo 布尔值一个布尔值,表示是否根据多代码仓库标签是否存在来筛选警报。 默认值: |
“列出企业中的密钥扫描警报”的 HTTP 响应状态码
状态码 | 描述 |
---|---|
200 | OK |
404 | 资源未找到 |
503 | 服务不可用 |
“列出企业中的密钥扫描警报”的代码示例
请求示例
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/enterprises/ENTERPRISE/secret-scanning/alerts
响应
状态:200
[ { "number": 2, "created_at": "2020-11-06T18:48:51Z", "url": "https://api.github.com/repos/owner/private-repo/secret-scanning/alerts/2", "html_url": "https://github.com/owner/private-repo/security/secret-scanning/2", "locations_url": "https://api.github.com/repos/owner/private-repo/secret-scanning/alerts/2/locations", "state": "已解决", "resolution": "误报", "resolved_at": "2020-11-07T02:47:13Z", "resolved_by": { "login": "monalisa", "id": 2, "node_id": "MDQ6VXNlcjI=", "avatar_url": "https://alambic.github.com/avatars/u/2?", "gravatar_id": "", "url": "https://api.github.com/users/monalisa", "html_url": "https://github.com/monalisa", "followers_url": "https://api.github.com/users/monalisa/followers", "following_url": "https://api.github.com/users/monalisa/following{/other_user}", "gists_url": "https://api.github.com/users/monalisa/gists{/gist_id}", "starred_url": "https://api.github.com/users/monalisa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/monalisa/subscriptions", "organizations_url": "https://api.github.com/users/monalisa/orgs", "repos_url": "https://api.github.com/users/monalisa/repos", "events_url": "https://api.github.com/users/monalisa/events{/privacy}", "received_events_url": "https://api.github.com/users/monalisa/received_events", "type": "User", "site_admin": true }, "secret_type": "adafruit_io_key", "secret_type_display_name": "Adafruit IO 密钥", "secret": "aio_XXXXXXXXXXXXXXXXXXXXXXXXXXXX", "repository": { "id": 1296269, "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5", "name": "Hello-World", "full_name": "octocat/Hello-World", "owner": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "private": false, "html_url": "https://github.com/octocat/Hello-World", "description": "这是你的第一个仓库!", "fork": false, "url": "https://api.github.com/repos/octocat/Hello-World", "archive_url": "https://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}", "assignees_url": "https://api.github.com/repos/octocat/Hello-World/assignees{/user}", "blobs_url": "https://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}", "branches_url": "https://api.github.com/repos/octocat/Hello-World/branches{/branch}", "collaborators_url": "https://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}", "comments_url": "https://api.github.com/repos/octocat/Hello-World/comments{/number}", "commits_url": "https://api.github.com/repos/octocat/Hello-World/commits{/sha}", "compare_url": "https://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}", "contents_url": "https://api.github.com/repos/octocat/Hello-World/contents/{+path}", "contributors_url": "https://api.github.com/repos/octocat/Hello-World/contributors", "deployments_url": "https://api.github.com/repos/octocat/Hello-World/deployments", "downloads_url": "https://api.github.com/repos/octocat/Hello-World/downloads", "events_url": "https://api.github.com/repos/octocat/Hello-World/events", "forks_url": "https://api.github.com/repos/octocat/Hello-World/forks", "git_commits_url": "https://api.github.com/repos/octocat/Hello-World/git/commits{/sha}", "git_refs_url": "https://api.github.com/repos/octocat/Hello-World/git/refs{/sha}", "git_tags_url": "https://api.github.com/repos/octocat/Hello-World/git/tags{/sha}", "issue_comment_url": "https://api.github.com/repos/octocat/Hello-World/issues/comments{/number}", "issue_events_url": "https://api.github.com/repos/octocat/Hello-World/issues/events{/number}", "issues_url": "https://api.github.com/repos/octocat/Hello-World/issues{/number}", "keys_url": "https://api.github.com/repos/octocat/Hello-World/keys{/key_id}", "labels_url": "https://api.github.com/repos/octocat/Hello-World/labels{/name}", "languages_url": "https://api.github.com/repos/octocat/Hello-World/languages", "merges_url": "https://api.github.com/repos/octocat/Hello-World/merges", "milestones_url": "https://api.github.com/repos/octocat/Hello-World/milestones{/number}", "notifications_url": "https://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}", "pulls_url": "https://api.github.com/repos/octocat/Hello-World/pulls{/number}", "releases_url": "https://api.github.com/repos/octocat/Hello-World/releases{/id}", "stargazers_url": "https://api.github.com/repos/octocat/Hello-World/stargazers", "statuses_url": "https://api.github.com/repos/octocat/Hello-World/statuses/{sha}", "subscribers_url": "https://api.github.com/repos/octocat/Hello-World/subscribers", "subscription_url": "https://api.github.com/repos/octocat/Hello-World/subscription", "tags_url": "https://api.github.com/repos/octocat/Hello-World/tags", "teams_url": "https://api.github.com/repos/octocat/Hello-World/teams", "trees_url": "https://api.github.com/repos/octocat/Hello-World/git/trees{/sha}", "hooks_url": "https://api.github.com/repos/octocat/Hello-World/hooks" }, "push_protection_bypassed_by": { "login": "monalisa", "id": 2, "node_id": "MDQ6VXNlcjI=", "avatar_url": "https://alambic.github.com/avatars/u/2?", "gravatar_id": "", "url": "https://api.github.com/users/monalisa", "html_url": "https://github.com/monalisa", "followers_url": "https://api.github.com/users/monalisa/followers", "following_url": "https://api.github.com/users/monalisa/following{/other_user}", "gists_url": "https://api.github.com/users/monalisa/gists{/gist_id}", "starred_url": "https://api.github.com/users/monalisa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/monalisa/subscriptions", "organizations_url": "https://api.github.com/users/monalisa/orgs", "repos_url": "https://api.github.com/users/monalisa/repos", "events_url": "https://api.github.com/users/monalisa/events{/privacy}", "received_events_url": "https://api.github.com/users/monalisa/received_events", "type": "User", "site_admin": true }, "push_protection_bypassed": true, "push_protection_bypassed_at": "2020-11-06T21:48:51Z", "push_protection_bypass_request_reviewer": { "login": "octocat", "id": 3, "node_id": "MDQ6VXNlcjI=", "avatar_url": "https://alambic.github.com/avatars/u/3?", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": true }, "push_protection_bypass_request_comment": "示例注释", "push_protection_bypass_request_html_url": "https://github.com/owner/repo/secret_scanning_exemptions/1", "resolution_comment": "示例注释", "validity": "有效", "publicly_leaked": false, "multi_repo": false }, { "number": 1, "created_at": "2020-11-06T18:18:30Z", "url": "https://api.github.com/repos/owner/repo/secret-scanning/alerts/1", "html_url": "https://github.com/owner/repo/security/secret-scanning/1", "locations_url": "https://api.github.com/repos/owner/private-repo/secret-scanning/alerts/1/locations", "state": "打开", "resolution": null, "resolved_at": null, "resolved_by": null, "secret_type": "mailchimp_api_key", "secret_type_display_name": "Mailchimp API 密钥", "secret": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-us2", "repository": { "id": 1296269, "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5", "name": "Hello-World", "full_name": "octocat/Hello-World", "owner": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "private": false, "html_url": "https://github.com/octocat/Hello-World", "description": "这是你的第一个仓库!", "fork": false, "url": "https://api.github.com/repos/octocat/Hello-World", "archive_url": "https://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}", "assignees_url": "https://api.github.com/repos/octocat/Hello-World/assignees{/user}", "blobs_url": "https://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}", "branches_url": "https://api.github.com/repos/octocat/Hello-World/branches{/branch}", "collaborators_url": "https://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}", "comments_url": "https://api.github.com/repos/octocat/Hello-World/comments{/number}", "commits_url": "https://api.github.com/repos/octocat/Hello-World/commits{/sha}", "compare_url": "https://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}", "contents_url": "https://api.github.com/repos/octocat/Hello-World/contents/{+path}", "contributors_url": "https://api.github.com/repos/octocat/Hello-World/contributors", "deployments_url": "https://api.github.com/repos/octocat/Hello-World/deployments", "downloads_url": "https://api.github.com/repos/octocat/Hello-World/downloads", "events_url": "https://api.github.com/repos/octocat/Hello-World/events", "forks_url": "https://api.github.com/repos/octocat/Hello-World/forks", "git_commits_url": "https://api.github.com/repos/octocat/Hello-World/git/commits{/sha}", "git_refs_url": "https://api.github.com/repos/octocat/Hello-World/git/refs{/sha}", "git_tags_url": "https://api.github.com/repos/octocat/Hello-World/git/tags{/sha}", "issue_comment_url": "https://api.github.com/repos/octocat/Hello-World/issues/comments{/number}", "issue_events_url": "https://api.github.com/repos/octocat/Hello-World/issues/events{/number}", "issues_url": "https://api.github.com/repos/octocat/Hello-World/issues{/number}", "keys_url": "https://api.github.com/repos/octocat/Hello-World/keys{/key_id}", "labels_url": "https://api.github.com/repos/octocat/Hello-World/labels{/name}", "languages_url": "https://api.github.com/repos/octocat/Hello-World/languages", "merges_url": "https://api.github.com/repos/octocat/Hello-World/merges", "milestones_url": "https://api.github.com/repos/octocat/Hello-World/milestones{/number}", "notifications_url": "https://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}", "pulls_url": "https://api.github.com/repos/octocat/Hello-World/pulls{/number}", "releases_url": "https://api.github.com/repos/octocat/Hello-World/releases{/id}", "stargazers_url": "https://api.github.com/repos/octocat/Hello-World/stargazers", "statuses_url": "https://api.github.com/repos/octocat/Hello-World/statuses/{sha}", "subscribers_url": "https://api.github.com/repos/octocat/Hello-World/subscribers", "subscription_url": "https://api.github.com/repos/octocat/Hello-World/subscription", "tags_url": "https://api.github.com/repos/octocat/Hello-World/tags", "teams_url": "https://api.github.com/repos/octocat/Hello-World/teams", "trees_url": "https://api.github.com/repos/octocat/Hello-World/git/trees{/sha}", "hooks_url": "https://api.github.com/repos/octocat/Hello-World/hooks" }, "push_protection_bypassed_by": null, "push_protection_bypassed": false, "push_protection_bypassed_at": null, "push_protection_bypass_request_reviewer": null, "push_protection_bypass_request_comment": null, "push_protection_bypass_request_html_url": null, "resolution_comment": null, "validity": "未知", "publicly_leaked": false, "multi_repo": false } ]
列出组织的秘密扫描警报
列出组织中符合条件的仓库的秘密扫描警报,从最新到最旧。
经过身份验证的用户必须是组织的管理员或安全管理员才能使用此端点。
OAuth 应用令牌和个人访问令牌(经典)需要repo
或security_events
范围才能使用此端点。如果此端点仅与公共仓库一起使用,则令牌可以使用public_repo
范围。
“列出组织的秘密扫描警报”的细粒度访问令牌
此端点适用于以下细粒度令牌类型:
细粒度令牌必须具有以下权限集
- “秘密扫描警报”存储库权限(读取)
“列出组织的秘密扫描警报”的参数
名称、类型、描述 |
---|
accept 字符串建议设置为 |
名称、类型、描述 |
---|
org 字符串 必需组织名称。名称不区分大小写。 |
名称、类型、描述 |
---|
state 字符串设置为 可以是以下之一: |
secret_type 字符串要返回的密钥类型的逗号分隔列表。默认情况下,将返回所有密钥类型。有关密钥类型的完整列表,请参阅“支持的密钥扫描模式”。 |
resolution 字符串逗号分隔的分辨率列表。仅列出具有以下任一分辨率的密钥扫描警报。有效分辨率为 |
sort 字符串用于对结果进行排序的属性。 默认值: 可以是以下之一: |
direction 字符串用于对结果进行排序的方向。 默认值: 可以是以下之一: |
page 整数要获取的结果的页码。有关更多信息,请参阅“在 REST API 中使用分页”。 默认值: |
per_page 整数每页的结果数(最大 100)。有关更多信息,请参阅“在 REST API 中使用分页”。 默认值: |
before 字符串游标,如链接标头中所示。如果指定,查询仅搜索此游标之前的事件。要在您的第一个请求中接收初始游标,请包含一个空的“before”查询字符串。 |
after 字符串游标,如链接标头中所示。如果指定,查询仅搜索此游标之后的事件。要在您的第一个请求中接收初始游标,请包含一个空的“after”查询字符串。 |
validity 字符串逗号分隔的有效性列表,当存在时,将返回与该列表中的有效性匹配的警报。有效选项为 |
is_publicly_leaked 布尔值一个布尔值,表示是否根据公开泄露标签是否存在来筛选警报。 默认值: |
is_multi_repo 布尔值一个布尔值,表示是否根据多代码仓库标签是否存在来筛选警报。 默认值: |
“列出组织的秘密扫描警报”的 HTTP 响应状态代码
状态码 | 描述 |
---|---|
200 | OK |
404 | 资源未找到 |
503 | 服务不可用 |
“列出组织的秘密扫描警报”的代码示例
请求示例
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/orgs/ORG/secret-scanning/alerts
响应
状态:200
[ { "number": 2, "created_at": "2020-11-06T18:48:51Z", "url": "https://api.github.com/repos/owner/private-repo/secret-scanning/alerts/2", "html_url": "https://github.com/owner/private-repo/security/secret-scanning/2", "locations_url": "https://api.github.com/repos/owner/private-repo/secret-scanning/alerts/2/locations", "state": "已解决", "resolution": "误报", "resolved_at": "2020-11-07T02:47:13Z", "resolved_by": { "login": "monalisa", "id": 2, "node_id": "MDQ6VXNlcjI=", "avatar_url": "https://alambic.github.com/avatars/u/2?", "gravatar_id": "", "url": "https://api.github.com/users/monalisa", "html_url": "https://github.com/monalisa", "followers_url": "https://api.github.com/users/monalisa/followers", "following_url": "https://api.github.com/users/monalisa/following{/other_user}", "gists_url": "https://api.github.com/users/monalisa/gists{/gist_id}", "starred_url": "https://api.github.com/users/monalisa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/monalisa/subscriptions", "organizations_url": "https://api.github.com/users/monalisa/orgs", "repos_url": "https://api.github.com/users/monalisa/repos", "events_url": "https://api.github.com/users/monalisa/events{/privacy}", "received_events_url": "https://api.github.com/users/monalisa/received_events", "type": "User", "site_admin": true }, "secret_type": "adafruit_io_key", "secret_type_display_name": "Adafruit IO 密钥", "secret": "aio_XXXXXXXXXXXXXXXXXXXXXXXXXXXX", "repository": { "id": 1296269, "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5", "name": "Hello-World", "full_name": "octocat/Hello-World", "owner": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "private": false, "html_url": "https://github.com/octocat/Hello-World", "description": "这是你的第一个仓库!", "fork": false, "url": "https://api.github.com/repos/octocat/Hello-World", "archive_url": "https://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}", "assignees_url": "https://api.github.com/repos/octocat/Hello-World/assignees{/user}", "blobs_url": "https://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}", "branches_url": "https://api.github.com/repos/octocat/Hello-World/branches{/branch}", "collaborators_url": "https://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}", "comments_url": "https://api.github.com/repos/octocat/Hello-World/comments{/number}", "commits_url": "https://api.github.com/repos/octocat/Hello-World/commits{/sha}", "compare_url": "https://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}", "contents_url": "https://api.github.com/repos/octocat/Hello-World/contents/{+path}", "contributors_url": "https://api.github.com/repos/octocat/Hello-World/contributors", "deployments_url": "https://api.github.com/repos/octocat/Hello-World/deployments", "downloads_url": "https://api.github.com/repos/octocat/Hello-World/downloads", "events_url": "https://api.github.com/repos/octocat/Hello-World/events", "forks_url": "https://api.github.com/repos/octocat/Hello-World/forks", "git_commits_url": "https://api.github.com/repos/octocat/Hello-World/git/commits{/sha}", "git_refs_url": "https://api.github.com/repos/octocat/Hello-World/git/refs{/sha}", "git_tags_url": "https://api.github.com/repos/octocat/Hello-World/git/tags{/sha}", "issue_comment_url": "https://api.github.com/repos/octocat/Hello-World/issues/comments{/number}", "issue_events_url": "https://api.github.com/repos/octocat/Hello-World/issues/events{/number}", "issues_url": "https://api.github.com/repos/octocat/Hello-World/issues{/number}", "keys_url": "https://api.github.com/repos/octocat/Hello-World/keys{/key_id}", "labels_url": "https://api.github.com/repos/octocat/Hello-World/labels{/name}", "languages_url": "https://api.github.com/repos/octocat/Hello-World/languages", "merges_url": "https://api.github.com/repos/octocat/Hello-World/merges", "milestones_url": "https://api.github.com/repos/octocat/Hello-World/milestones{/number}", "notifications_url": "https://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}", "pulls_url": "https://api.github.com/repos/octocat/Hello-World/pulls{/number}", "releases_url": "https://api.github.com/repos/octocat/Hello-World/releases{/id}", "stargazers_url": "https://api.github.com/repos/octocat/Hello-World/stargazers", "statuses_url": "https://api.github.com/repos/octocat/Hello-World/statuses/{sha}", "subscribers_url": "https://api.github.com/repos/octocat/Hello-World/subscribers", "subscription_url": "https://api.github.com/repos/octocat/Hello-World/subscription", "tags_url": "https://api.github.com/repos/octocat/Hello-World/tags", "teams_url": "https://api.github.com/repos/octocat/Hello-World/teams", "trees_url": "https://api.github.com/repos/octocat/Hello-World/git/trees{/sha}", "hooks_url": "https://api.github.com/repos/octocat/Hello-World/hooks" }, "push_protection_bypassed_by": { "login": "monalisa", "id": 2, "node_id": "MDQ6VXNlcjI=", "avatar_url": "https://alambic.github.com/avatars/u/2?", "gravatar_id": "", "url": "https://api.github.com/users/monalisa", "html_url": "https://github.com/monalisa", "followers_url": "https://api.github.com/users/monalisa/followers", "following_url": "https://api.github.com/users/monalisa/following{/other_user}", "gists_url": "https://api.github.com/users/monalisa/gists{/gist_id}", "starred_url": "https://api.github.com/users/monalisa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/monalisa/subscriptions", "organizations_url": "https://api.github.com/users/monalisa/orgs", "repos_url": "https://api.github.com/users/monalisa/repos", "events_url": "https://api.github.com/users/monalisa/events{/privacy}", "received_events_url": "https://api.github.com/users/monalisa/received_events", "type": "User", "site_admin": true }, "push_protection_bypassed": true, "push_protection_bypassed_at": "2020-11-06T21:48:51Z", "push_protection_bypass_request_reviewer": { "login": "octocat", "id": 3, "node_id": "MDQ6VXNlcjI=", "avatar_url": "https://alambic.github.com/avatars/u/3?", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": true }, "push_protection_bypass_request_comment": "示例注释", "push_protection_bypass_request_html_url": "https://github.com/owner/repo/secret_scanning_exemptions/1", "resolution_comment": "示例注释", "validity": "有效", "publicly_leaked": false, "multi_repo": false }, { "number": 1, "created_at": "2020-11-06T18:18:30Z", "url": "https://api.github.com/repos/owner/repo/secret-scanning/alerts/1", "html_url": "https://github.com/owner/repo/security/secret-scanning/1", "locations_url": "https://api.github.com/repos/owner/private-repo/secret-scanning/alerts/1/locations", "state": "打开", "resolution": null, "resolved_at": null, "resolved_by": null, "secret_type": "mailchimp_api_key", "secret_type_display_name": "Mailchimp API 密钥", "secret": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-us2", "repository": { "id": 1296269, "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5", "name": "Hello-World", "full_name": "octocat/Hello-World", "owner": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "private": false, "html_url": "https://github.com/octocat/Hello-World", "description": "这是你的第一个仓库!", "fork": false, "url": "https://api.github.com/repos/octocat/Hello-World", "archive_url": "https://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}", "assignees_url": "https://api.github.com/repos/octocat/Hello-World/assignees{/user}", "blobs_url": "https://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}", "branches_url": "https://api.github.com/repos/octocat/Hello-World/branches{/branch}", "collaborators_url": "https://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}", "comments_url": "https://api.github.com/repos/octocat/Hello-World/comments{/number}", "commits_url": "https://api.github.com/repos/octocat/Hello-World/commits{/sha}", "compare_url": "https://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}", "contents_url": "https://api.github.com/repos/octocat/Hello-World/contents/{+path}", "contributors_url": "https://api.github.com/repos/octocat/Hello-World/contributors", "deployments_url": "https://api.github.com/repos/octocat/Hello-World/deployments", "downloads_url": "https://api.github.com/repos/octocat/Hello-World/downloads", "events_url": "https://api.github.com/repos/octocat/Hello-World/events", "forks_url": "https://api.github.com/repos/octocat/Hello-World/forks", "git_commits_url": "https://api.github.com/repos/octocat/Hello-World/git/commits{/sha}", "git_refs_url": "https://api.github.com/repos/octocat/Hello-World/git/refs{/sha}", "git_tags_url": "https://api.github.com/repos/octocat/Hello-World/git/tags{/sha}", "issue_comment_url": "https://api.github.com/repos/octocat/Hello-World/issues/comments{/number}", "issue_events_url": "https://api.github.com/repos/octocat/Hello-World/issues/events{/number}", "issues_url": "https://api.github.com/repos/octocat/Hello-World/issues{/number}", "keys_url": "https://api.github.com/repos/octocat/Hello-World/keys{/key_id}", "labels_url": "https://api.github.com/repos/octocat/Hello-World/labels{/name}", "languages_url": "https://api.github.com/repos/octocat/Hello-World/languages", "merges_url": "https://api.github.com/repos/octocat/Hello-World/merges", "milestones_url": "https://api.github.com/repos/octocat/Hello-World/milestones{/number}", "notifications_url": "https://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}", "pulls_url": "https://api.github.com/repos/octocat/Hello-World/pulls{/number}", "releases_url": "https://api.github.com/repos/octocat/Hello-World/releases{/id}", "stargazers_url": "https://api.github.com/repos/octocat/Hello-World/stargazers", "statuses_url": "https://api.github.com/repos/octocat/Hello-World/statuses/{sha}", "subscribers_url": "https://api.github.com/repos/octocat/Hello-World/subscribers", "subscription_url": "https://api.github.com/repos/octocat/Hello-World/subscription", "tags_url": "https://api.github.com/repos/octocat/Hello-World/tags", "teams_url": "https://api.github.com/repos/octocat/Hello-World/teams", "trees_url": "https://api.github.com/repos/octocat/Hello-World/git/trees{/sha}", "hooks_url": "https://api.github.com/repos/octocat/Hello-World/hooks" }, "push_protection_bypassed_by": null, "push_protection_bypassed": false, "push_protection_bypassed_at": null, "push_protection_bypass_request_reviewer": null, "push_protection_bypass_request_comment": null, "push_protection_bypass_request_html_url": null, "resolution_comment": null, "validity": "未知", "publicly_leaked": false, "multi_repo": false } ]
列出仓库的秘密扫描警报
列出符合条件的仓库的秘密扫描警报,从最新到最旧。
经过身份验证的用户必须是仓库的管理员或拥有该仓库的组织的管理员才能使用此端点。
OAuth 应用令牌和个人访问令牌(经典)需要repo
或security_events
范围才能使用此端点。如果此端点仅与公共仓库一起使用,则令牌可以使用public_repo
范围。
“列出仓库的秘密扫描警报”的细粒度访问令牌
此端点适用于以下细粒度令牌类型:
细粒度令牌必须具有以下权限集
- “秘密扫描警报”存储库权限(读取)
“列出仓库的秘密扫描警报”的参数
名称、类型、描述 |
---|
accept 字符串建议设置为 |
名称、类型、描述 |
---|
owner 字符串 必需仓库的账户所有者。名称不区分大小写。 |
repo 字符串 必需仓库的名称,不带 |
名称、类型、描述 |
---|
state 字符串设置为 可以是以下之一: |
secret_type 字符串要返回的密钥类型的逗号分隔列表。默认情况下,将返回所有密钥类型。有关密钥类型的完整列表,请参阅“支持的密钥扫描模式”。 |
resolution 字符串逗号分隔的分辨率列表。仅列出具有以下任一分辨率的密钥扫描警报。有效分辨率为 |
sort 字符串用于对结果进行排序的属性。 默认值: 可以是以下之一: |
direction 字符串用于对结果进行排序的方向。 默认值: 可以是以下之一: |
page 整数要获取的结果的页码。有关更多信息,请参阅“在 REST API 中使用分页”。 默认值: |
per_page 整数每页的结果数(最大 100)。有关更多信息,请参阅“在 REST API 中使用分页”。 默认值: |
before 字符串游标,如链接标头中所示。如果指定,查询仅搜索此游标之前的事件。要在您的第一个请求中接收初始游标,请包含一个空的“before”查询字符串。 |
after 字符串游标,如链接标头中所示。如果指定,查询仅搜索此游标之后的事件。要在您的第一个请求中接收初始游标,请包含一个空的“after”查询字符串。 |
validity 字符串逗号分隔的有效性列表,当存在时,将返回与该列表中的有效性匹配的警报。有效选项为 |
is_publicly_leaked 布尔值一个布尔值,表示是否根据公开泄露标签是否存在来筛选警报。 默认值: |
is_multi_repo 布尔值一个布尔值,表示是否根据多代码仓库标签是否存在来筛选警报。 默认值: |
“列出仓库的秘密扫描警报”的 HTTP 响应状态代码
状态码 | 描述 |
---|---|
200 | OK |
404 | 仓库是公开的或已为仓库禁用秘密扫描 |
503 | 服务不可用 |
“列出仓库的密钥扫描警报”代码示例
请求示例
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/secret-scanning/alerts
响应
状态:200
[ { "number": 2, "created_at": "2020-11-06T18:48:51Z", "url": "https://api.github.com/repos/owner/private-repo/secret-scanning/alerts/2", "html_url": "https://github.com/owner/private-repo/security/secret-scanning/2", "locations_url": "https://api.github.com/repos/owner/private-repo/secret-scanning/alerts/2/locations", "state": "resolved", "resolution": "false_positive", "resolved_at": "2020-11-07T02:47:13Z", "resolved_by": { "login": "monalisa", "id": 2, "node_id": "MDQ6VXNlcjI=", "avatar_url": "https://alambic.github.com/avatars/u/2?", "gravatar_id": "", "url": "https://api.github.com/users/monalisa", "html_url": "https://github.com/monalisa", "followers_url": "https://api.github.com/users/monalisa/followers", "following_url": "https://api.github.com/users/monalisa/following{/other_user}", "gists_url": "https://api.github.com/users/monalisa/gists{/gist_id}", "starred_url": "https://api.github.com/users/monalisa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/monalisa/subscriptions", "organizations_url": "https://api.github.com/users/monalisa/orgs", "repos_url": "https://api.github.com/users/monalisa/repos", "events_url": "https://api.github.com/users/monalisa/events{/privacy}", "received_events_url": "https://api.github.com/users/monalisa/received_events", "type": "User", "site_admin": true }, "secret_type": "adafruit_io_key", "secret_type_display_name": "Adafruit IO Key", "secret": "aio_XXXXXXXXXXXXXXXXXXXXXXXXXXXX", "push_protection_bypassed_by": { "login": "monalisa", "id": 2, "node_id": "MDQ6VXNlcjI=", "avatar_url": "https://alambic.github.com/avatars/u/2?", "gravatar_id": "", "url": "https://api.github.com/users/monalisa", "html_url": "https://github.com/monalisa", "followers_url": "https://api.github.com/users/monalisa/followers", "following_url": "https://api.github.com/users/monalisa/following{/other_user}", "gists_url": "https://api.github.com/users/monalisa/gists{/gist_id}", "starred_url": "https://api.github.com/users/monalisa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/monalisa/subscriptions", "organizations_url": "https://api.github.com/users/monalisa/orgs", "repos_url": "https://api.github.com/users/monalisa/repos", "events_url": "https://api.github.com/users/monalisa/events{/privacy}", "received_events_url": "https://api.github.com/users/monalisa/received_events", "type": "User", "site_admin": true }, "push_protection_bypassed": true, "push_protection_bypassed_at": "2020-11-06T21:48:51Z", "push_protection_bypass_request_reviewer": { "login": "octocat", "id": 3, "node_id": "MDQ6VXNlcjI=", "avatar_url": "https://alambic.github.com/avatars/u/3?", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": true }, "push_protection_bypass_request_comment": "Example comment", "push_protection_bypass_request_html_url": "https://github.com/owner/repo/secret_scanning_exemptions/1", "resolution_comment": "Example comment", "validity": "inactive", "publicly_leaked": false, "multi_repo": false }, { "number": 1, "created_at": "2020-11-06T18:18:30Z", "url": "https://api.github.com/repos/owner/repo/secret-scanning/alerts/1", "html_url": "https://github.com/owner/repo/security/secret-scanning/1", "locations_url": "https://api.github.com/repos/owner/private-repo/secret-scanning/alerts/1/locations", "state": "open", "resolution": null, "resolved_at": null, "resolved_by": null, "secret_type": "mailchimp_api_key", "secret_type_display_name": "Mailchimp API Key", "secret": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-us2", "push_protection_bypassed_by": null, "push_protection_bypassed": false, "push_protection_bypassed_at": null, "push_protection_bypass_request_reviewer": null, "push_protection_bypass_request_comment": null, "push_protection_bypass_request_html_url": null, "resolution_comment": null, "validity": "unknown", "publicly_leaked": false, "multi_repo": false } ]
获取密钥扫描警报
获取在符合条件的仓库中检测到的单个密钥扫描警报。
经过身份验证的用户必须是仓库的管理员或拥有该仓库的组织的管理员才能使用此端点。
OAuth 应用令牌和个人访问令牌(经典)需要repo
或security_events
范围才能使用此端点。如果此端点仅与公共仓库一起使用,则令牌可以使用public_repo
范围。
“获取密钥扫描警报”的细粒度访问令牌
此端点适用于以下细粒度令牌类型:
细粒度令牌必须具有以下权限集
- “秘密扫描警报”存储库权限(读取)
“获取密钥扫描警报”的参数
名称、类型、描述 |
---|
accept 字符串建议设置为 |
名称、类型、描述 |
---|
owner 字符串 必需仓库的账户所有者。名称不区分大小写。 |
repo 字符串 必需仓库的名称,不带 |
alert_number 整数 必需标识警报的编号。您可以在 GitHub 中代码扫描警报的 URL 末尾找到此编号,以及在 |
“获取密钥扫描警报”的 HTTP 响应状态代码
状态码 | 描述 |
---|---|
200 | OK |
304 | 未修改 |
404 | 仓库是公开的,或者已为仓库禁用密钥扫描,或者找不到资源。 |
503 | 服务不可用 |
“获取密钥扫描警报”代码示例
请求示例
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/secret-scanning/alerts/ALERT_NUMBER
响应
状态:200
{ "number": 42, "created_at": "2020-11-06T18:18:30Z", "url": "https://api.github.com/repos/owner/private-repo/secret-scanning/alerts/42", "html_url": "https://github.com/owner/private-repo/security/secret-scanning/42", "locations_url": "https://api.github.com/repos/owner/private-repo/secret-scanning/alerts/42/locations", "state": "open", "resolution": null, "resolved_at": null, "resolved_by": null, "secret_type": "mailchimp_api_key", "secret_type_display_name": "Mailchimp API Key", "secret": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-us2", "push_protection_bypassed_by": null, "push_protection_bypassed": false, "push_protection_bypassed_at": null, "push_protection_bypass_request_reviewer": null, "push_protection_bypass_request_comment": null, "push_protection_bypass_request_html_url": null, "resolution_comment": null, "validity": "unknown", "publicly_leaked": false, "multi_repo": false }
更新密钥扫描警报
更新符合条件的仓库中密钥扫描警报的状态。
经过身份验证的用户必须是仓库的管理员或拥有该仓库的组织的管理员才能使用此端点。
OAuth 应用令牌和个人访问令牌(经典)需要repo
或security_events
范围才能使用此端点。如果此端点仅与公共仓库一起使用,则令牌可以使用public_repo
范围。
“更新密钥扫描警报”的细粒度访问令牌
此端点适用于以下细粒度令牌类型:
细粒度令牌必须具有以下权限集
- “密钥扫描警报”仓库权限(写入)
“更新密钥扫描警报”的参数
名称、类型、描述 |
---|
accept 字符串建议设置为 |
名称、类型、描述 |
---|
owner 字符串 必需仓库的账户所有者。名称不区分大小写。 |
repo 字符串 必需仓库的名称,不带 |
alert_number 整数 必需标识警报的编号。您可以在 GitHub 中代码扫描警报的 URL 末尾找到此编号,以及在 |
名称、类型、描述 |
---|
state 字符串 必需设置密钥扫描警报的状态。将状态设置为 可以是以下之一: |
resolution 字符串或 null当 可以是以下之一: |
resolution_comment 字符串或 null关闭警报时的可选注释。无法更新或删除。将 |
“更新密钥扫描警报”的 HTTP 响应状态代码
状态码 | 描述 |
---|---|
200 | OK |
400 | 错误请求,解析注释无效或未更改解析。 |
404 | 仓库是公开的,或者已为仓库禁用密钥扫描,或者找不到资源。 |
422 | 状态与解析或解析注释不匹配 |
503 | 服务不可用 |
“更新密钥扫描警报”代码示例
请求示例
curl -L \ -X PATCH \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/secret-scanning/alerts/ALERT_NUMBER \ -d '{"state":"resolved","resolution":"false_positive"}'
响应
状态:200
{ "number": 42, "created_at": "2020-11-06T18:18:30Z", "url": "https://api.github.com/repos/owner/private-repo/secret-scanning/alerts/42", "html_url": "https://github.com/owner/private-repo/security/secret-scanning/42", "locations_url": "https://api.github.com/repos/owner/private-repo/secret-scanning/alerts/42/locations", "state": "resolved", "resolution": "used_in_tests", "resolved_at": "2020-11-16T22:42:07Z", "resolved_by": { "login": "monalisa", "id": 2, "node_id": "MDQ6VXNlcjI=", "avatar_url": "https://alambic.github.com/avatars/u/2?", "gravatar_id": "", "url": "https://api.github.com/users/monalisa", "html_url": "https://github.com/monalisa", "followers_url": "https://api.github.com/users/monalisa/followers", "following_url": "https://api.github.com/users/monalisa/following{/other_user}", "gists_url": "https://api.github.com/users/monalisa/gists{/gist_id}", "starred_url": "https://api.github.com/users/monalisa/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/monalisa/subscriptions", "organizations_url": "https://api.github.com/users/monalisa/orgs", "repos_url": "https://api.github.com/users/monalisa/repos", "events_url": "https://api.github.com/users/monalisa/events{/privacy}", "received_events_url": "https://api.github.com/users/monalisa/received_events", "type": "User", "site_admin": true }, "secret_type": "mailchimp_api_key", "secret_type_display_name": "Mailchimp API Key", "secret": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-us2", "push_protection_bypassed": false, "push_protection_bypassed_by": null, "push_protection_bypassed_at": null, "push_protection_bypass_request_reviewer": null, "push_protection_bypass_request_comment": null, "push_protection_bypass_request_html_url": null, "resolution_comment": "Example comment", "validity": "unknown", "publicly_leaked": false, "multi_repo": false }
列出密钥扫描警报的位置
列出符合条件的仓库中给定密钥扫描警报的所有位置。
经过身份验证的用户必须是仓库的管理员或拥有该仓库的组织的管理员才能使用此端点。
OAuth 应用令牌和个人访问令牌(经典)需要repo
或security_events
范围才能使用此端点。如果此端点仅与公共仓库一起使用,则令牌可以使用public_repo
范围。
“列出密钥扫描警报的位置”的细粒度访问令牌
此端点适用于以下细粒度令牌类型:
细粒度令牌必须具有以下权限集
- “秘密扫描警报”存储库权限(读取)
“列出密钥扫描警报的位置”的参数
名称、类型、描述 |
---|
accept 字符串建议设置为 |
名称、类型、描述 |
---|
owner 字符串 必需仓库的账户所有者。名称不区分大小写。 |
repo 字符串 必需仓库的名称,不带 |
alert_number 整数 必需标识警报的编号。您可以在 GitHub 中代码扫描警报的 URL 末尾找到此编号,以及在 |
名称、类型、描述 |
---|
page 整数要获取的结果的页码。有关更多信息,请参阅“在 REST API 中使用分页”。 默认值: |
per_page 整数每页的结果数(最大 100)。有关更多信息,请参阅“在 REST API 中使用分页”。 默认值: |
“列出密钥扫描警报的位置”的 HTTP 响应状态代码
状态码 | 描述 |
---|---|
200 | OK |
404 | 仓库是公开的,或者已为仓库禁用密钥扫描,或者找不到资源。 |
503 | 服务不可用 |
“列出密钥扫描警报的位置”代码示例
请求示例
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/secret-scanning/alerts/ALERT_NUMBER/locations
响应
状态:200
[ { "type": "commit", "details": { "path": "/example/secrets.txt", "start_line": 1, "end_line": 1, "start_column": 1, "end_column": 64, "blob_sha": "af5626b4a114abcb82d63db7c8082c3c4756e51b", "blob_url": "https://api.github.com/repos/octocat/hello-world/git/blobs/af5626b4a114abcb82d63db7c8082c3c4756e51b", "commit_sha": "f14d7debf9775f957cf4f1e8176da0786431f72b", "commit_url": "https://api.github.com/repos/octocat/hello-world/git/commits/f14d7debf9775f957cf4f1e8176da0786431f72b" } }, { "type": "wiki_commit", "details": { "path": "/example/Home.md", "start_line": 1, "end_line": 1, "start_column": 1, "end_column": 64, "blob_sha": "af5626b4a114abcb82d63db7c8082c3c4756e51b", "page_url": "https://github.com/octocat/Hello-World/wiki/Home/302c0b7e200761c9dd9b57e57db540ee0b4293a5", "commit_sha": "302c0b7e200761c9dd9b57e57db540ee0b4293a5", "commit_url": "https://github.com/octocat/Hello-World/wiki/_compare/302c0b7e200761c9dd9b57e57db540ee0b4293a5" } }, { "type": "issue_title", "details": { "issue_title_url": "https://api.github.com/repos/octocat/Hello-World/issues/1347" } }, { "type": "issue_body", "details": { "issue_body_url": "https://api.github.com/repos/octocat/Hello-World/issues/1347" } }, { "type": "issue_comment", "details": { "issue_comment_url": "https://api.github.com/repos/octocat/Hello-World/issues/comments/1081119451" } }, { "type": "discussion_title", "details": { "discussion_title_url": "https://github.com/community/community/discussions/39082" } }, { "type": "discussion_body", "details": { "discussion_body_url": "https://github.com/community/community/discussions/39082#discussion-4566270" } }, { "type": "discussion_comment", "details": { "discussion_comment_url": "https://github.com/community/community/discussions/39082#discussioncomment-4158232" } }, { "type": "pull_request_title", "details": { "pull_request_title_url": "https://api.github.com/repos/octocat/Hello-World/pull/2846" } }, { "type": "pull_request_body", "details": { "pull_request_body_url": "https://api.github.com/repos/octocat/Hello-World/pulls/2846" } }, { "type": "pull_request_comment", "details": { "pull_request_comment_url": "https://api.github.com/repos/octocat/Hello-World/issues/comments/1825855898" } }, { "type": "pull_request_review", "details": { "pull_request_review_url": "https://api.github.com/repos/octocat/Hello-World/pulls/2846/reviews/80" } }, { "type": "pull_request_review_comment", "details": { "pull_request_review_comment_url": "https://api.github.com/repos/octocat/Hello-World/pulls/comments/12" } } ]
创建推送保护绕过
为先前已进行推送保护的密钥创建绕过。
经过身份验证的用户必须是已提交密钥的原始作者。
OAuth 应用程序令牌和个人访问令牌(经典)需要 repo
范围才能使用此端点。
“创建推送保护绕过”的细粒度访问令牌
此端点适用于以下细粒度令牌类型:
细粒度令牌必须具有以下权限集
- “内容”仓库权限(写入)
“创建推送保护绕过”的参数
名称、类型、描述 |
---|
accept 字符串建议设置为 |
名称、类型、描述 |
---|
owner 字符串 必需仓库的账户所有者。名称不区分大小写。 |
repo 字符串 必需仓库的名称,不带 |
名称、类型、描述 |
---|
reason 字符串 必需绕过推送保护的原因。 可以是以下之一: |
placeholder_id 字符串 必填推送保护绕过占位符的 ID。此值将在任何推送保护路由上返回。 |
“创建推送保护绕过”的 HTTP 响应状态码
状态码 | 描述 |
---|---|
200 | OK |
403 | 用户没有足够的权限执行此操作。 |
404 | 占位符 ID 未找到,或此存储库上已禁用推送保护。 |
422 | 错误请求,输入数据丢失或不正确。 |
503 | 服务不可用 |
“创建推送保护绕过”的代码示例
请求示例
curl -L \ -X POST \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/secret-scanning/push-protection-bypasses \ -d '{"reason":"will_fix_later","placeholder_id":"2k4dM4tseyC5lPIsjl5emX9sPNk"}'
响应