|
1 | 1 | --- |
2 | 2 | title: Secret scanning |
3 | 3 | intro: 'As a service provider, you can partner with {% data variables.product.prodname_dotcom %} to have your secret token formats secured through secret scanning, which searches for accidental commits of your secret format and can be sent to a service provider''s verify endpoint.' |
| 4 | +miniTocMaxHeadingLevel: 4 |
4 | 5 | redirect_from: |
5 | 6 | - /partnerships/token-scanning/ |
6 | 7 | - /partnerships/secret-scanning |
7 | 8 | versions: |
8 | 9 | free-pro-team: '*' |
9 | 10 | --- |
10 | 11 |
|
11 | | - |
12 | | -{% data variables.product.prodname_dotcom %} scans repositories for known secret formats to prevent fraudulent use of credentials that were committed accidentally. Secret scanning happens by default on public repositories, and can be enabled on private repositories by repository administrators or organization owners. As a service provider, you can partner with {% data variables.product.prodname_dotcom %} so that your secret formats are included in our secret scanning. |
| 12 | +{% data variables.product.prodname_dotcom %} scans repositories for known secret formats to prevent fraudulent use of credentials that were committed accidentally. {% data variables.product.prodname_secret_scanning_caps %} happens by default on public repositories, and can be enabled on private repositories by repository administrators or organization owners. As a service provider, you can partner with {% data variables.product.prodname_dotcom %} so that your secret formats are included in our {% data variables.product.prodname_secret_scanning %}. |
13 | 13 |
|
14 | 14 | When a match of your secret format is found in a public repository, a payload is sent to an HTTP endpoint of your choice. |
15 | 15 |
|
16 | | -When a match of your secret format is found in a private repository configured for secret scanning, then repository admins are alerted and can view and manage the secret scanning results on {% data variables.product.prodname_dotcom %}. For more information, see "[Managing alerts from secret scanning](/github/administering-a-repository/managing-alerts-from-secret-scanning)". |
| 16 | +When a match of your secret format is found in a private repository configured for {% data variables.product.prodname_secret_scanning %}, then repository admins are alerted and can view and manage the {% data variables.product.prodname_secret_scanning %} results on {% data variables.product.prodname_dotcom %}. For more information, see "[Managing alerts from {% data variables.product.prodname_secret_scanning %}](/github/administering-a-repository/managing-alerts-from-secret-scanning)." |
17 | 17 |
|
18 | 18 | {% note %} |
19 | 19 |
|
20 | | -**Note:** Secret scanning for private repositories is currently in beta. |
| 20 | +**Note:** {% data variables.product.prodname_secret_scanning_caps %} for private repositories is currently in beta. |
21 | 21 |
|
22 | 22 | {% endnote %} |
23 | 23 |
|
24 | | -This article describes how you can partner with {% data variables.product.prodname_dotcom %} as a service provider and join the secret scanning program. |
| 24 | +This article describes how you can partner with {% data variables.product.prodname_dotcom %} as a service provider and join the {% data variables.product.prodname_secret_scanning %} program. |
25 | 25 |
|
26 | | -### The secret scanning process |
| 26 | +### The {% data variables.product.prodname_secret_scanning %} process |
27 | 27 |
|
28 | | -##### How secret scanning works in a public repository |
| 28 | +##### How {% data variables.product.prodname_secret_scanning %} works in a public repository |
29 | 29 |
|
30 | | -The following diagram summarizes the secret scanning process for public repositories, with any matches sent to a service provider's verify endpoint. |
| 30 | +The following diagram summarizes the {% data variables.product.prodname_secret_scanning %} process for public repositories, with any matches sent to a service provider's verify endpoint. |
31 | 31 |
|
32 | | - |
| 32 | + |
33 | 33 |
|
34 | | -### Joining the secret scanning program on {% data variables.product.prodname_dotcom %} |
| 34 | +### Joining the {% data variables.product.prodname_secret_scanning %} program on {% data variables.product.prodname_dotcom %} |
35 | 35 |
|
36 | 36 | 1. Contact {% data variables.product.prodname_dotcom %} to get the process started. |
37 | 37 | 1. Identify the relevant secrets you want to scan for and create regular expressions to capture them. |
38 | | -1. For secret matches found in public repositories, create a secret alert service which accepts webhooks from {% data variables.product.prodname_dotcom %} that contain the secret scanning message payload. |
| 38 | +1. For secret matches found in public repositories, create a secret alert service which accepts webhooks from {% data variables.product.prodname_dotcom %} that contain the {% data variables.product.prodname_secret_scanning %} message payload. |
39 | 39 | 1. Implement signature verification in your secret alert service. |
40 | 40 | 1. Implement secret revocation and user notification in your secret alert service. |
| 41 | +1. Provide feedback for false positives (optional). |
41 | 42 |
|
42 | 43 | #### Contact {% data variables.product.prodname_dotcom %} to get the process started |
43 | 44 |
|
44 | | -To get the enrollment process started, email secret-scanning@github.com. |
| 45 | +To get the enrollment process started, email <a href="mailto:secret-scanning@github.com">secret-scanning@github.com</a>. |
45 | 46 |
|
46 | | -You will receive details on the secret scanning program, and you will need to agree to {% data variables.product.prodname_dotcom %}'s terms of participation before proceeding. |
| 47 | +You will receive details on the {% data variables.product.prodname_secret_scanning %} program, and you will need to agree to {% data variables.product.prodname_dotcom %}'s terms of participation before proceeding. |
47 | 48 |
|
48 | 49 | #### Identify your secrets and create regular expressions |
49 | 50 |
|
50 | | -To scan for your secrets, {% data variables.product.prodname_dotcom %} needs the following pieces of information for each secret that you want included in the secret scanning program: |
| 51 | +To scan for your secrets, {% data variables.product.prodname_dotcom %} needs the following pieces of information for each secret that you want included in the {% data variables.product.prodname_secret_scanning %} program: |
51 | 52 |
|
52 | 53 | * A unique, human readable name for the secret type. We'll use this to generate the `Type` value in the message payload later. |
53 | 54 | * A regular expression which finds the secret type. Be as precise as possible, because this will reduce the number of false positives. |
54 | 55 | * The URL of the endpoint that receives messages from {% data variables.product.prodname_dotcom %}. This does not have to be unique for each secret type. |
55 | 56 |
|
56 | | -Send this information to secret-scanning@github.com. |
| 57 | +Send this information to <a href="mailto:secret-scanning@github.com">secret-scanning@github.com</a>. |
57 | 58 |
|
58 | 59 | #### Create a secret alert service |
59 | 60 |
|
@@ -279,4 +280,44 @@ puts openssl_key.verify(OpenSSL::Digest::SHA256.new, Base64.decode64(signature), |
279 | 280 |
|
280 | 281 | #### Implement secret revocation and user notification in your secret alert service |
281 | 282 |
|
282 | | -For secret scanning in public repositories, you can enhance your secret alert service to revoke the exposed secrets and notify the affected users. How you implement this in your secret alert service is up to you, but we recommend considering any secrets that {% data variables.product.prodname_dotcom %} sends you messages about as public and compromised. |
| 283 | +For {% data variables.product.prodname_secret_scanning %} in public repositories, you can enhance your secret alert service to revoke the exposed secrets and notify the affected users. How you implement this in your secret alert service is up to you, but we recommend considering any secrets that {% data variables.product.prodname_dotcom %} sends you messages about as public and compromised. |
| 284 | + |
| 285 | +#### Provide feedback for false positives |
| 286 | + |
| 287 | +We collect feedback on the validity of the detected individual secrets in partner responses. If you wish to take part, email us at <a href="mailto:secret-scanning@github.com">secret-scanning@github.com</a>. |
| 288 | + |
| 289 | +When we report secrets to you, we send a JSON array with each element containing the token, type identifier, and commit URL. When you send us feedback, you send us information about whether the detected token was a real or false credential. We accept feedback in the following formats. |
| 290 | + |
| 291 | +You can send us the raw token: |
| 292 | + |
| 293 | +``` |
| 294 | +[ |
| 295 | + { |
| 296 | + "token_raw": "The raw token", |
| 297 | + "token_type": "ACompany_API_token", |
| 298 | + "label": "true_positive" |
| 299 | + } |
| 300 | +] |
| 301 | +``` |
| 302 | +You may also provide the token in hashed form after performing a one way cryptographic hash of the raw token using SHA-256: |
| 303 | + |
| 304 | +``` |
| 305 | +[ |
| 306 | + { |
| 307 | + "token_hash": "The SHA-256 hashed form of the raw token", |
| 308 | + "token_type": "ACompany_API_token", |
| 309 | + "label": "false_positive" |
| 310 | + } |
| 311 | +] |
| 312 | +``` |
| 313 | +A few important points: |
| 314 | +- You should only send us either the raw form of the token ("token_raw"), or the hashed form ("token_hash"), but not both. |
| 315 | +- For the hashed form of the raw token, you can only use SHA-256 to hash the token, not any other hashing algorithm. |
| 316 | +- The label indicates whether the token is a true ("true_positive") or a false positive ("false_positive"). Only these two lowercased literal strings are allowed. |
| 317 | + |
| 318 | +{% note %} |
| 319 | + |
| 320 | +**Note:** Our request timeout is set to be higher (that is, 30 seconds) for partners who provide data about false positives. If you require a timeout higher than 30 seconds, email us at <a href="mailto:secret-scanning@github.com">secret-scanning@github.com</a>. |
| 321 | + |
| 322 | +{% endnote %} |
| 323 | + |
0 commit comments