GitHub push protection – a security feature aimed at preventing secrets such as API keys or tokens getting accidentally leaked online – is being switched on by default for all public repositories.
“This means that when a supported secret is detected in any push to a public repository, you will have the option to remove the secret from your commits or, if you deem the secret safe, bypass the block,” the Microsoft subsidiary said.
Leaked secrets carry many risks
In 2022, coders leaked over 10,000,000 secrets in 1.027 billion commits.
Since the beginning of this year, GitHub has detected over 1 million leaked secrets on public repositories, the company also shared.
As leaked secrets may (and do) lead to compromises and data breaches, it’s crucial to minimize the occurrence.
About the security feature
GitHub has made push protection available to owners of all public repositories last year, but now it’s switching it on by default.
Push protection scans code commits before they get pushed and, if they contain a secret, developers get an alert in their integrated development environment (IDE) or command line interface (CLI).
They can then decide to override the block or to remove the secret and re-push their commit.
“Although we don’t recommend it, you can also disable push protection entirely in your user security settings. However, since you always retain the option to bypass the block, we recommend that you leave push protection enabled and make exceptions on an as-needed basis,” GitHub’s Eric Tooley and Courtney Claessens explained.
The feature detects over 200 token types and patterns from 180 service+ providers.
“Older versions of certain tokens may not be supported by push protection as these tokens may generate a higher number of false positives than their most recent version. Push protection may also not apply to legacy tokens. For tokens such as Azure Storage Keys, GitHub only supports recently created tokens, not tokens that match the legacy patterns,” the company notes.