GitHub has recently expanded its secrets scanning capabilities to repositories containing PyPI and RubyGems registry secrets.
The move helps protect millions of applications built by Ruby and Python developers who may inadvertently be committing secrets and credentials to their public GitHub repos.
GitHub will now scan for PyPI, RubyGems secrets
Yesterday, GitHub announced that it will now automatically scan repositories exposing PyPI and RubyGems secrets, such as credentials and API tokens.
To avail this feature, developers need to ensure that GitHub Advanced Security is enabled for their repository, which seems to be the default case for public repos:
“For public repositories on GitHub.com, these features are permanently on and can only be disabled if you change the visibility of the project so that the code is no longer public,” states GitHub.
Similar to a username and password, secrets or tokens are strings that one can use to authenticate themselves while using a service.
Applications relying on third-party APIs frequently use secrets (private API keys) in their code to gain access to the API services.
As such, one must be cautious that secrets are not compromised, as that can lead to much greater attacks affecting the wider software supply chain.
Prior to this, GitHub would scan for accidentally-committed npm, NuGet, and Clojars secrets among others.
As seen by BleepingComputer, there’s an extensive list of over 70 different types of secrets currently supported by GitHub Advanced Security.
These include secrets for both open-source registries (like npm, PyPI, RubyGems, Nuget, Clojars, etc.), and non-package-management-services like Adobe and OpenAI:
What happens when a secret is identified?
When GitHub spots a password, an API token, private SSH keys, or another supported secret exposed in a public repository, it notifies the registry maintainer.
The registry maintainers, for example, recently added PyPI and RubyGems, would then revoke the exposed credential, and email the developer explaining why:
“In each case, we automatically scan every commit to a public repository or gist for potentially leaked credentials.”
“If we find one, we notify the registry, and they automatically revoke any compromised secrets and notify their owner,” explains GitHub software engineer Annie Gesellchen in yesterday’s blog post.
The advantage here of GitHub’s partnership with RubyGems and PyPI remains that the exposed secrets are revoked within seconds in an automated fashion, rather than waiting on the developer to take manual action.
As reported by BleepingComputer time and time again [1, 2, 3], exposed secrets and credentials have translated into successful breaches.
As such, automated secrets scanning takes us one step closer to safeguarding the developer infrastructure from accidental leaks, and stepping up supply-chain security.