Text of docs.github.com › en › code-security › tutorials › secret-scanning-partner-program as Styx crawled it on Nov 21, 2026. The page may have changed since. Only its words are kept, without pictures or layout, and only the first part of a long page.

Open the live page

Secret scanning partner program - GitHub Docs

Skip to main content Skip to content Collapse sidebar Expand sidebar Secret scanning partner program As a service provider, you can partner with GitHub 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. Who can use this feature? Secret scanning alerts for partners runs by default on the following repositories: Public repositories and public npm packages on GitHub In this article GitHub 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 public npm packages. Repository administrators and organization owners can also enable secret scanning on private repositories. As a service provider, you can partner with GitHub so that your secret formats are included in our secret scanning. When a match of your secret format is found in a public source, a payload is sent to an HTTP endpoint of your choice.

When a match of your secret format is found in a private repository configured for secret scanning, then repository admins and the committer are alerted and can view and manage the secret scanning result on GitHub. For more information, see Manage secret scanning alerts . This article describes how you can partner with GitHub as a service provider and join the secret scanning partner program. The secret scanning process The following diagram summarizes the secret scanning process for public repositories, with any matches sent to a service provider's verify endpoint.

A similar process sends service providers tokens exposed in public packages on the npm registry. Joining the secret scanning program on GitHub Contact GitHub to get the process started. Identify the relevant secrets you want to scan for and create regular expressions to capture them. For more detailed information and recommendations, see Identify your secrets and create regular expressions below. For secret matches found publicly, create a secret alert service which accepts webhooks from GitHub that contain the secret scanning message payload.

Implement signature verification in your secret alert service. Implement secret revocation and user notification in your secret alert service. Provide feedback for false positives (optional). Contact GitHub to get the process started To get the enrollment process started, email secret-scanning@github.com . You will receive details on the secret scanning program, and you will need to agree to GitHub's terms of participation before proceeding.

Identify your secrets and create regular expressions To scan for your secrets, GitHub needs the following pieces of information for each secret that you want included in the secret scanning program: A unique, human-readable name for the secret type. We'll use this to generate the Type value in the message payload later. A regular expression which finds the secret type. We recommend you are as precise as possible, because this will help reduce the number of false positives.

Some best practices for high quality, identifiable secrets are: A uniquely defined prefix High entropy random strings A 32-bit checksum A test account for your service. This will allow us to generate and analyze examples of the secrets, further reducing false positives. The URL of the endpoint that receives messages from GitHub. The URL doesn't have to be unique for each secret type. Send this information to secret-scanning@github.com .

Create a secret alert service Create a public, internet accessible HTTP endpoint at the URL you provided to us. When a match of your regular expression is found publicly, GitHub will send an HTTP POST message to your endpoint. Example request body [ { "token" : "NMIfyYncKcRALEXAMPLE" , "type" : "mycompany_api_token" , "url" : "https://github.com/octocat/Hello-World/blob/12345600b9cbe38a219f39a9941c9319b600c002/foo/bar.txt" , "source" : "content" } ] The message body is a JSON array that contains one or more objects, with each object representing a single secret match.

Your endpoint should be able to handle requests with a large number of matches without timing out. The keys for each secret match are: token: The value of the secret match. type: The unique name you provided to identify your regular expression. url: The public URL where the match was found (may be empty) source: Where the token was found on GitHub. The list of valid values for source are: content commit pull_request_title pull_request_description pull_request_comment issue_title issue_description issue_comment discussion_title discussion_body discussion_comment commit_comment gist_content gist_comment wiki_content wiki_commit npm manual_submission action_logs unknown A source of action_logs means the match was found in the logs of a GitHub Actions workflow run in a public repository.

Implement signature verification in your secret alert service The HTTP request to your service will also contain headers that we strongly recommend using to validate the messages you receive are genuinely from GitHub, and are not malicious. The two HTTP headers to look for are: Github-Public-Key-Identifier : Which key_identifier to use from our API Github-Public-Key-Signature : Signature of the payload You can retrieve the GitHub secret scanning public key from https://api.github.com/meta/public_keys/secret_scanning and validate the message using the ECDSA-NIST-P256V1-SHA256 algorithm.

The endpoint will provide several key_identifier and public keys. You can determine which public key to use based on the value of Github-Public-Key-Identifier . Note When you send a request to the public key endpoint above, you may hit rate limits. To avoid hitting rate limits, you can use a personal access token (classic) (no scopes required) or a fine-grained personal access token (only the automatic public repositories read access required) as suggested in the samples below, or use a conditional request.

For more information, see Best practices for using the REST API . Note The signature was generated using the raw message body. So it's important you also use the raw message body for signature validation, instead of parsing and stringifying the JSON, to avoid rearranging the message or changing spacing. Sample HTTP POST sent to verify endpoint POST / HTTP/2 Host : HOST Accept : */* Content-Length : 104 Content-Type : application/json Github-Public-Key-Identifier : bcb53661c06b4728e59d897fb6165d5c9cda0fd9cdf9d09ead458168deb7518c Github-Public-Key-Signature : MEQCIQDaMKqrGnE27S0kgMrEK0eYBmyG0LeZismAEz/BgZyt7AIfXt9fErtRS4XaeSt/AO1RtBY66YcAdjxji410VQV4xg== [{ "source" : "commit" , "token" : "some_token" , "type" : "some_type" , "url" : "https://example.com/base-repo-url/" }] The following code snippets demonstrate how you could perform signature validation.

The code examples assume you've set an environment variable called GITHUB_PRODUCTION_TOKEN with a generated personal access token to avoid hitting rate limits. The personal access token does not need any scopes/permissions. Validation sample in Go package main import ( "crypto/ecdsa" "crypto/sha256" "crypto/x509" "encoding/asn1" "encoding/base64" "encoding/json" "encoding/pem" "errors" "fmt" "math/big" "net/http" "os" ) func main () { payload := `[{"source":"commit","token":"some_token","type":"some_type","url":"https://example.com/base-repo-url/"}]` kID := "bcb53661c06b4728e59d897fb6165d5c9cda0fd9cdf9d09ead458168deb7518c" kSig := "MEQCIQDaMKqrGnE27S0kgMrEK0eYBmyG0LeZismAEz/BgZyt7AIfXt9fErtRS4XaeSt/AO1RtBY66YcAdjxji410VQV4xg==" // Fetch the list of GitHub Public Keys req, err := http.NewRequest( "GET" , "https://api.github.com/meta/public_keys/secret_scanning" , nil ) if err != nil { fmt.Printf( "Error preparing request: %s\n" , err) os.Exit( 1 ) } if len (os.Getenv( "GITHUB_PRODUCTION_TOKEN" )) == 0 { fmt.Println( "Need to define environment variable GITHUB_PRODUCTION_TOKEN" ) os.Exit( 1

The rest of this page is on the live site.