About secret scanning - GitHub Docs (original) (raw)

GitHub scans repositories for known types of secrets, to prevent fraudulent use of secrets that were committed accidentally.

Who can use this feature?

Secret scanning is available for the following repository types:

About secret scanning

Secret scanning is a security feature that helps detect and prevent the accidental inclusion of sensitive information such as API keys, passwords, tokens, and other secrets in your repository. When enabled, secret scanning scans commits in repositories for known types of secrets and alerts repository administrators upon detection.

Secret scanning scans your entire Git history on all branches present in your GitHub repository for secrets, even if the repository is archived. GitHub will also periodically run a full Git history scan for new secret types in existing content in public repositories where secret scanning is enabled when new supported secret types are added.

Additionally, secret scanning scans:

This additional scanning is free for public repositories.

Tip

Regardless of the enablement status of Advanced Security features, organizations on GitHub Team and GitHub Enterprise can run a free report to scan the code in the organization for leaked secrets, see About the secret risk assessment.

When a supported secret is leaked, GitHub generates a secret scanning alert. Alerts are reported on the Security tab of repositories on GitHub, where you can view, evaluate, and resolve them. For more information, see Managing alerts from secret scanning.

Service providers can partner with GitHub to provide their secret formats for scanning. We automatically run secret scanning for partner patterns on all public repositories and public npm packages. To find out about our partner program, see Secret scanning partner program.

Any strings that match patterns that were provided by secret scanning partners are reported directly to the relevant partner, and aren't displayed on GitHub. For more information about partner patterns, see About secret scanning alerts.

For information about the secrets and service providers supported by secret scanning, see Supported secret scanning patterns.

You can use the REST API to monitor results from secret scanning across your repositories or organization. For more information about API endpoints, see REST API endpoints for secret scanning.

You can also use security overview to see an organization-level view of which repositories have enabled secret scanning and the alerts found. For more information, see About security overview.

You can audit the actions taken in response to secret scanning alerts using GitHub tools. For more information, see Auditing security alerts.

How secret scanning works

Below is a typical workflow that explains how secret scanning works:

About the benefits of secret scanning

Customizing secret scanning

Once secret scanning is enabled, you can customize it further:

Detection of non-provider patterns

Scan for and detect secrets that are not specific to a service provider, such as private keys and generic API keys. For more information, see Enabling secret scanning for non-provider patterns.

Performing validity checks

Validity checks help you prioritize alerts by telling you which secrets are active or inactive. For more information, see Enabling validity checks for your repository and Evaluating alerts from secret scanning.

Defining custom patterns

Define your own patterns for secrets used by your organization that secret scanning can scan for and detect. For more information, see Defining custom patterns for secret scanning.

Copilot secret scanning

Further reading