An age secret key is the private half of a key pair used by age, the small file encryption tool. Whoever holds it can decrypt every file that was encrypted to the matching public key (the recipient), including files you stored months ago and files that were already copied elsewhere. Many projects use age through SOPS to keep encrypted secrets in a repository, which means the leak of one key can open all the configuration files of a project. There is no provider and no revoke button, because age has no server: the fix is to replace the key pair and re-encrypt. Replace first, then rotate what the old key could read.
Check your GitHub account for leaked secrets — free
- Provider
- Other
- Severity
- High
- Impact
- Source code and build access
- Checked live by LeakWatch
- No
What an age secret key looks like
An age secret key begins with the fixed text AGE-SECRET-KEY-1, followed by 58 characters from the Bech32 alphabet, written in uppercase:
AGE-SECRET-KEY-1XXXX…XXXX age secret key (masked, 58 Bech32 characters after the prefix)
The Bech32 alphabet has no 1, b, i or o, which is one way to recognise a real key from a made-up one. The key is usually kept in a text file, often called keys.txt, next to a comment line that shows the public key, and the age-keygen tool writes it that way. Do not confuse it with the public key, which starts with age1 in lowercase and is meant to be shared. A public key in a repository is normal; the line starting with AGE-SECRET-KEY- is not. The key can also be read from the SOPS_AGE_KEY or SOPS_AGE_KEY_FILE variables.
How age secret keys get leaked
- Key file committed.
keys.txtorage.keyadded to a repository withgit add ., often in a deployment or dotfiles repository. - SOPS projects. The key is placed next to the encrypted files so that the pipeline can decrypt them, then the whole directory is published.
- CI configuration.
SOPS_AGE_KEYpasted into a workflow file rather than stored in the CI platform’s secret settings. - Backups and dotfiles. A home directory or
~/.config/sops/agefolder pushed as a personal dotfiles repository. - Container images. A key copied into an image layer so that the application can decrypt its configuration at start, then the image is pushed to a public registry.
- Chat and tickets. A key pasted to share it with a colleague, which stays in history.
What to do in the first hour
- Generate a new key pair with
age-keygenon a trusted machine, and keep the new secret key in a proper secret store, not in the repository. - Re-encrypt your files to the new recipient. For plain age files, decrypt with the old key and encrypt again to the new public key. For SOPS, update the age recipient in your SOPS configuration and run its key rotation command on each encrypted file. Remove the old recipient from the configuration.
- Treat the contents as exposed. Every secret that was stored in a file the old key could decrypt must be rotated at its source: database passwords, API keys, tokens and certificates. Changing the age key does not protect values the attacker may already have read. Start with the ones that grant the most access.
- Look at the history. Encrypted files from older commits are still readable with the old key, even after you re-encrypt the current version. Rotating the underlying secrets is what matters.
- Deploy the new key to the pipeline or servers that decrypt the files, and delete the old one from them.
- Check for use of the old key. age leaves no log, so look instead at the services behind the secrets: access logs, sign-ins and API usage since the exposure.
- Clean up the code, add key files to
.gitignore, and look for other secrets in the same commit. See I accidentally pushed an API key to GitHub.
Not sure what else leaked from the same repository? Run a free scan.
Revoke it at age
There is nothing to revoke at a vendor. age is a local tool with no account, no server and no central list of keys, so a compromised key can only be abandoned: generate a new pair and re-encrypt, as in the steps above. The age documentation describes key generation and recipients, and the SOPS documentation describes rotating the keys of encrypted files. A person has not confirmed any menu wording for this guide, because there is no console. Do not publish an announcement that the old key is revoked: nothing enforces that, and the only real protection is that the files no longer depend on it.
How LeakWatch detects it
The rule is called Age Secret Key. It looks for the exact text AGE-SECRET-KEY-1 followed by exactly 58 characters from the Bech32 alphabet QPZRY9X8GF2TVDW0S3JN54KHCE6MUA7L, in uppercase. It does not need a variable name next to it. A key with a body that is too short, a key written in lowercase, or a public key starting with age1 is not reported. The severity is high. This type is not checked live: age has no server, so there is nothing to ask, and LeakWatch cannot tell whether any file still uses the key.
LeakWatch detects this format but does not check it live: it can tell you the key is exposed, not whether it still works. Assume it does until you have revoked it.
FAQ
Is the public key (age1…) also a secret?
No. The recipient is meant to be shared so that others can encrypt files for you. Only the line starting with AGE-SECRET-KEY- must stay private.
I removed the key file in a new commit. Is that enough?
No. The key stays in the git history and in any clone or fork. Generate a new pair and re-encrypt, and rotate the secrets the old key could open.
Can I find out whether someone used the key to decrypt files?
Not from age itself, which keeps no record. Look at the systems protected by the decrypted secrets instead, for unusual sign-ins or API calls since the key was exposed.