GitHub anmounces the general availability of a new security feature called push protection, which aims to prevent developers from inadvertently leaking keys and other secrets in their code.
GitHub extends the push protection to all public repositories at no extra cost. This functionality works along with the secret scanning feature that scans repositories for known secret formats to prevent their fraudulent use and avert potentially serious consequences.
Push protection prevents secret leaks without compromising the developer experience by scanning for highly identifiable secrets before they are committed. Once the secret is detected in code, developers are prompted directly in their IDE or command line interface with remediation guidance to ensure that the secret is never exposed.
To enable the option, users can head to Settings > Select “Code security and analysis” > Enable “Secret scanning” and “Push protection.”
Github states – Push protection beta version, since April 2022, prevented 17,000 accidental secret leaks, saving more than 95,000 hours that would have otherwise been spent revoking, rotating, and remediating the compromised secrets.