A Gitea access token is a personal credential for a Gitea server, the self-hosted Git service. It lets a script, a CI job or a tool act as the user who created it, through the API and, depending on the scopes chosen, over Git. Whoever holds it can read the repositories that user can see, push commits, change repository settings and, if the scopes allow, manage packages. Because Gitea is usually run by the team or the company itself, a leaked token can reach internal code that is not visible anywhere else. Delete it first, then check what it did.
Check your GitHub account for leaked secrets — free
- Provider
- Gitea
- Severity
- High
- Impact
- Source code and build access
- Checked live by LeakWatch
- No
What a Gitea Access Token looks like
Gitea access tokens are 40-character strings of hexadecimal digits. They have no vendor prefix, so a match depends on the name it is stored under, such as GITEA_TOKEN, gitea_key or a similar variable:
GITEA_TOKEN="…XXXX" Gitea access token in an environment file (masked)
Because the token has no prefix, the safest way to recognize one is by context. A forty-character hexadecimal string next to a Gitea name in a file that calls the Gitea API is a credential. The same kind of string next to a commit hash or a checksum is not. Gitea also lets a token be scoped to read or write access for repositories, packages, and other parts of the account, so the damage a leak can do depends on the scopes it was created with.
Do not confuse the access token with the password of the account. Changing the password does not, on its own, remove an existing token. Tokens have to be deleted one by one, which is also why they are easy to forget.
How Gitea Access Tokens get leaked
- CI and runner configuration. A pipeline file or runner configuration that contains the token in plain text, committed to the same repository the pipeline builds.
- Git remotes. A remote URL with the token embedded in it, such as a clone command copied into a document or a script.
- Shell history and dotfiles. A command typed with the token on the line, saved to a history file that is later backed up or shared.
- Build logs. A job that prints its environment or the full clone URL, so the token lands in a log that many people can read.
- Shared mirrors. A mirror or backup of the server that copies user settings, including tokens, to a location with broader access than the server itself.
What to do in the first hour
- Delete the token. Open the Applications settings in your Gitea user account, find the token that leaked and delete it. Deleting a token revokes its access at once for every script and app that used it.
- Review account activity. Check the commits, pushes, branch changes and repository settings in the period since the token may have been exposed. Look for pushes you did not make, new deploy keys or webhooks, and changes to protected branches.
- Check the other accounts. If the token belonged to a service or bot account, check what that account can reach, and whether any other tokens were created from it.
- Create a replacement with the smallest scopes the job needs, and store it in your CI secret store or your secret manager. Do not place it in a remote URL.
- Rotate the other secrets that the same pipeline used, such as deploy keys, registry passwords and cloud credentials.
- Clean the repository. Remove the value from the current files and from the pipeline definition, and check the history for older copies. 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 Gitea
Personal access tokens in Gitea are listed under your user settings, in the Applications page. Find the token by its name, use the delete button next to it and confirm. Gitea’s documentation for access tokens is at docs.gitea.com. For self-hosted servers, the administrator may also be able to review tokens and users from the administration panel, so ask them if you do not have that access. The exact labels depend on the Gitea version your server runs, and this guide could not confirm them for every version, so follow what your server’s Applications page shows.
How LeakWatch detects it
The rule is called “Gitea Access Token”. It looks for a name that contains gitea followed by the words token, key, secret or access, close to an assignment such as an equals sign or a colon, and then a value of exactly forty hexadecimal characters in quotes or on its own. The name must come before the value and be close to it. A forty-character hexadecimal string with no Gitea name nearby is not reported. The severity is high, with the impact class for identity and code access. This type is not checked live: LeakWatch does not send the token to a Gitea server to see whether it works.
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 my Gitea server safe if only the token leaked?
Not automatically. The token can read and write whatever the user could reach, so review the activity before you decide. The server itself is not compromised by a leaked token, but the repositories the token could reach may be.
Can I rely on changing my password instead?
No. Existing tokens keep working after a password change, so each token must be deleted separately.
What scopes should a replacement token have?
Only the scopes the job needs. A pipeline that reads one repository does not need write access to every repository or package. Smaller scopes make the next leak less damaging.