Grok’s Key Leak Proves It: Static Secrets Don’t Belong in Code

Marcel Levy

By now you have probably heard about the private key leaked on GitHub by an xAI employee. But don’t be so quick to blame the developer. Our industry makes it difficult to keep keys secret, and then acts shocked when they leak. The fix isn’t better hygiene. It’s replacing secrets with identity.

Here’s what happened: An API key that provided access to state-of-the-art, unreleased Grok models was publicly exposed in a code repository. According to GitGuardian, the key was left there for two months after it was first brought to the company’s attention, only being removed after repeated notifications.  Brian Krebs wrote an excellent article if you want more detail.

Clearly there are conclusions to draw about the incident response, but that’s not the most important point. Code repositories have become a magnet for secrets like these because we have made them no different than anything else in the directory. An API key is no different than a password, and it’s common for developers to store it as text in a file – just like code, configuration, or even a README. There are ways to use it locally and keep it out of the code repository, but this is not true by default and requires extra work.

It’s important to emphasize this so we draw the right lesson. This is not simply a mistake made by a single developer. It’s not even the fault of a single organization. This happened in a well-resourced, high-profile company competing in AI – one of the most important projects of our time. This is happening elsewhere at plenty of other organizations, big and small. It is a cultural problem, in that we consider it acceptable to hand the customer a long-lived secret and leave it a problem for them to solve.

This is the fundamental mistake: We must make it easy to do the right thing, and hard to do the wrong thing. That’s not the situation we’ve created at the moment. The number of secrets leaked in public GitHub repositories keeps growing. GitGuardian found 23.8 million new credentials, which is a 25% year-over-year increase.

An even more telling number is that 70% of secrets leaked in 2022 remain active, according to GitGuardian’s “The State of Secrets Sprawl Report.” This statistic makes the xAI response seem speedy by comparison.


We can’t fix this with more policies or better training. We need a new baseline—one where machines authenticate the same way people do: with real identities, not hardcoded keys. Non-Human Identity systems replace static secrets with verifiable credentials. They not only make you more secure, but also give you new insights and control across your environment. The future is already here, and SPIRL is helping organizations make the leap—securely, scalably, and fast. We’ve designed a system that removes the need for long-lived secrets like the one that tripped up xAI, and most importantly, one that can be rolled out across your organization quickly and safely. It’s time to rethink the defaults—and swap your secrets for identity.