Skip to content

Commit 8025d92

Browse files
mchammer01shati-patelGrey Bakerprashkanmyarb
authored
Secret scanning webhooks & APIs (#16608)
Co-authored-by: shati-patel <shati-patel@github.com> Co-authored-by: Grey Baker <greysteil@github.com> Co-authored-by: Prashanth Kannan <prashkan@github.com> Co-authored-by: Shati Patel <42641846+shati-patel@users.noreply.github.com> Co-authored-by: Melanie Yarbrough <11952755+myarb@users.noreply.github.com> Co-authored-by: Lucas Costi <lucascosti@users.noreply.github.com>
1 parent 0244ff4 commit 8025d92

20 files changed

Lines changed: 1625 additions & 22 deletions

content/developers/apps/creating-a-github-app-using-url-parameters.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ Permission | Description
7373
`plan` | Grants access to get information about a user's GitHub plan using the "[Get a user](/rest/reference/users#get-a-user)" endpoint. Can be one of: `none` or `read`.
7474
[`pull_requests`](/rest/reference/permissions-required-for-github-apps/#permission-on-pull-requests) | Grants access to various pull request endpoints. Can be one of: `none`, `read`, or `write`.
7575
[`repository_hooks`](/rest/reference/permissions-required-for-github-apps/#permission-on-repository-hooks) | Grants access to the [Repository Webhooks API](/rest/reference/repos#hooks). Can be one of: `none`, `read`, or `write`.
76-
[`repository_projects`](/rest/reference/permissions-required-for-github-apps/#permission-on-repository-projects) | Grants access to the [Projects API](/rest/reference/projects). Can be one of: `none`, `read`, `write`, or `admin`.
76+
[`repository_projects`](/rest/reference/permissions-required-for-github-apps/#permission-on-repository-projects) | Grants access to the [Projects API](/rest/reference/projects). Can be one of: `none`, `read`, `write`, or `admin`.{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@3.0" %}
77+
[`secret_scanning_alerts`](/rest/reference/permissions-required-for-github-apps/#permission-on-secret-scanning-alerts) | Grants access to the [Secret scanning API](/rest/reference/secret-scanning). Can be one of: `none`, `read`, or `write`.{% endif %}{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@2.21" %}
78+
[`security_events`](/rest/reference/permissions-required-for-github-apps/#permission-on-security-events) | Grants access to the [Code scanning API](/rest/reference/code-scanning/). Can be one of: `none`, `read`, or `write`.{% endif %}
7779
[`single_file`](/rest/reference/permissions-required-for-github-apps/#permission-on-single-file) | Grants access to the [Contents API](/rest/reference/repos#contents). Can be one of: `none`, `read`, or `write`.
7880
[`starring`](/rest/reference/permissions-required-for-github-apps/#permission-on-starring) | Grants access to the [Starring API](/rest/reference/activity#starring). Can be one of: `none`, `read`, or `write`.
7981
[`statuses`](/rest/reference/permissions-required-for-github-apps/#permission-on-statuses) | Grants access to the [Statuses API](/rest/reference/repos#statuses). Can be one of: `none`, `read`, or `write`.

content/developers/apps/scopes-for-oauth-apps.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ Name | Description
4545
&emsp;`repo:status`| Grants read/write access to public and private repository commit statuses. This scope is only necessary to grant other users or services access to private repository commit statuses *without* granting access to the code.
4646
&emsp;`repo_deployment`| Grants access to [deployment statuses](/rest/reference/repos#deployments) for public and private repositories. This scope is only necessary to grant other users or services access to deployment statuses, *without* granting access to the code.
4747
&emsp;`public_repo`| Limits access to public repositories. That includes read/write access to code, commit statuses, repository projects, collaborators, and deployment statuses for public repositories and organizations. Also required for starring public repositories.
48-
&emsp;`repo:invite` | Grants accept/decline abilities for invitations to collaborate on a repository. This scope is only necessary to grant other users or services access to invites *without* granting access to the code.{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@2.21" or currentVersion == "github-ae@latest"%}
48+
&emsp;`repo:invite` | Grants accept/decline abilities for invitations to collaborate on a repository. This scope is only necessary to grant other users or services access to invites *without* granting access to the code.{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@3.0" %}
49+
&emsp;`security_events` | Grants: <br/> read and write access to security events in the [{% data variables.product.prodname_code_scanning %} API](/rest/reference/code-scanning). <br/> read and write access to security events in the [{% data variables.product.prodname_secret_scanning %} API](/rest/reference/secret-scanning).{% endif %}{% if currentVersion ver_gt "enterprise-server@2.21" and currentVersion ver_lt "enterprise-server@3.1" %}
4950
&emsp;`security_events` | Grants read and write access to security events in the [{% data variables.product.prodname_code_scanning %} API](/rest/reference/code-scanning).{% endif %}
5051
**`admin:repo_hook`** | Grants read, write, ping, and delete access to repository hooks in public and private repositories. The `repo` and `public_repo` scopes grants full access to repositories, including repository hooks. Use the `admin:repo_hook` scope to limit access to only repository hooks.
5152
&emsp;`write:repo_hook` | Grants read, write, and ping access to hooks in public or private repositories.

content/developers/webhooks-and-events/webhook-events-and-payloads.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ Also, the `User-Agent` for the requests will have the prefix `GitHub-Hookshot/`.
145145
146146
{{ webhookPayloadsForCurrentVersion.check_suite.completed }}
147147
148-
{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@2.21" or currentVersion == "github-ae@latest" %}
148+
{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@2.21" %}
149149
### code_scanning_alert
150150
151151
{% data reusables.webhooks.code_scanning_alert_event_short_desc %}
@@ -1099,6 +1099,31 @@ Key | Type | Description
10991099
11001100
{% endif %}
11011101
1102+
{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@3.0" %}
1103+
1104+
### secret_scanning_alert
1105+
1106+
{% data reusables.webhooks.secret_scanning_alert_event_short_desc %}
1107+
1108+
#### Availability
1109+
1110+
- Repository webhooks
1111+
- Organization webhooks
1112+
- {% data variables.product.prodname_github_app %}s with the `secret_scanning_alerts:read` permission
1113+
1114+
#### Webhook payload object
1115+
1116+
{% data reusables.webhooks.secret_scanning_alert_event_properties %}
1117+
{% data reusables.webhooks.repo_desc %}
1118+
{% data reusables.webhooks.org_desc %}
1119+
{% data reusables.webhooks.app_desc %}
1120+
`sender` | `object` | If the `action` is `resolved` or `reopened`, the `sender` object will be the user that triggered the event. The `sender` object is empty for all other actions.
1121+
1122+
#### Webhook payload example
1123+
1124+
{{ webhookPayloadsForCurrentVersion.secret_scanning_alert.reopened }}
1125+
{% endif %}
1126+
11021127
### security_advisory
11031128
11041129
Activity related to a security advisory. A security advisory provides information about security-related vulnerabilities in software on GitHub. The security advisory dataset also powers the GitHub security alerts, see "[About security alerts for vulnerable dependencies](/articles/about-security-alerts-for-vulnerable-dependencies/)."

content/github/administering-a-repository/about-secret-scanning.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ When {% data variables.product.prodname_secret_scanning %} detects a secret in a
8080

8181
Repository administrators and organization owners can grant users and team access to {% data variables.product.prodname_secret_scanning %} alerts. For more information, see "[Managing security and analysis settings for your repository](/github/administering-a-repository/managing-security-and-analysis-settings-for-your-repository#granting-access-to-security-alerts)."
8282

83+
To monitor results from {% data variables.product.prodname_secret_scanning %} across your private repositories or your organization, you can use the {% data variables.product.prodname_secret_scanning %} API. For more information about API endpoints, see "[{% data variables.product.prodname_secret_scanning_caps %}](/rest/reference/secret-scanning)."
84+
8385
{% data variables.product.product_name %} currently scans private repositories for secrets issued by the following service providers.
8486

8587
- Adafruit

content/rest/reference/index.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ versions:
1515
{% link_in_list /apps %}
1616
{% link_in_list /billing %}
1717
{% link_in_list /checks %}
18-
<!-- uncomment code-scanning when it's been added to openAPI -->
19-
<!-- {% link_in_list /code-scanning %} -->
2018
{% link_in_list /codes-of-conduct %}
2119
{% link_in_list /code-scanning %}
2220
{% link_in_list /emojis %}
@@ -39,6 +37,7 @@ versions:
3937
{% link_in_list /repos %}
4038
{% link_in_list /scim %}
4139
{% link_in_list /search %}
40+
{% link_in_list /secret-scanning %}
4241
{% link_in_list /teams %}
4342
{% link_in_list /users %}
4443
{% link_in_list /permissions-required-for-github-apps %}

content/rest/reference/permissions-required-for-github-apps.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -819,10 +819,19 @@ _Teams_
819819
* [`PUT /orgs/:org/actions/secrets/:secret_name/repositories/:repository_id`](/rest/reference/actions#add-selected-repository-to-an-organization-secret) (:write)
820820
* [`DELETE /orgs/:org/actions/secrets/:secret_name/repositories/:repository_id`](/rest/reference/actions#remove-selected-repository-from-an-organization-secret) (:write)
821821
* [`DELETE /orgs/:org/actions/secrets/:secret_name`](/rest/reference/actions#delete-an-organization-secret) (:write)
822+
{% endif %}
823+
824+
{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@3.0" %}
825+
### Permission on "secret scanning alerts"
826+
827+
- [`GET /repos/:owner/:repo/secret-scanning/alerts`](/rest/reference/secret-scanning#list-secret-scanning-alerts-for-a-repository) (:read)
822828

829+
- [`GET /repos/:owner/:repo/secret-scanning/alerts/:alert_number`](/rest/reference/secret-scanning#get-a-secret-scanning-alert) (:read)
830+
831+
- [`PATCH /repos/:owner/:repo/secret-scanning/alerts/:alert_number`](/rest/reference/secret-scanning#update-a-secret-scanning-alert) (:write)
823832
{% endif %}
824833

825-
{% if currentVersion == "free-pro-team@latest" %}
834+
{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@2.21" %}
826835
### Permission on "security events"
827836

828837
- [`GET /repos/:owner/:repo/code-scanning/alerts`](/rest/reference/code-scanning#list-code-scanning-alerts-for-a-repository) (:read)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
title: Secret scanning
3+
versions:
4+
free-pro-team: '*'
5+
enterprise-server: '>=3.1'
6+
---
7+
8+
{% data reusables.secret-scanning.api-beta %}
9+
10+
The {% data variables.product.prodname_secret_scanning %} API lets you retrieve and update secret scanning alerts from a private repository. For more information on secret scanning for private repositories, see "[Securing your repository](/github/administering-a-repository/securing-your-repository)."
11+
12+
{% include rest_operations_at_current_path %}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{% note %}
2+
3+
**Note:** The {% data variables.product.prodname_secret_scanning %} API is currently in beta and subject to change.
4+
5+
{% endnote %}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Key | Type | Description
2+
----|------|-------------
3+
`action` |`string` | The action that was performed. This can be either `created`, `resolved`, or `reopened`.
4+
`alert` |`object` | The secret scanning alert involved in the event.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Activity related to secret scanning alerts in a repository. The type of activity is specified in the action property of the payload object. For more information, see “[About secret scanning](/github/administering-a-repository/about-secret-scanning).”

0 commit comments

Comments
 (0)