A GitLab deploy token gives read or write access to a project or group without being tied to a person. Depending on the scopes chosen at creation, it can clone the repository, pull container images from the registry, and read or publish packages. Unlike a personal access token, it cannot call most of the GitLab API, but it can still expose private source code and let someone publish a malicious package or image. Revoke it first, then investigate.
Check your GitHub account for leaked secrets — free
- Provider
- GitLab
- Severity
- Critical
- Impact
- Source code and build access
- Checked live by LeakWatch
- No
What a GitLab deploy token looks like
A deploy token begins with the gldt- prefix, followed by 20 characters made of letters, digits, dashes and underscores:
gldt-XXXX…XXXX GitLab deploy token (masked, 20 characters after the prefix)
A deploy token comes as a pair: a username, often generated as gitlab+deploy-token- followed by a number, and the token itself used as the password. Both appear in a Git URL, in a docker login command, or in a package manager configuration. Variable names such as CI_DEPLOY_PASSWORD or DEPLOY_TOKEN are common. Do not confuse it with glpat- (personal access token), glrt- (runner token) or glptt- (pipeline trigger token). The prefix tells you which kind of access you have to cut off. Deploy tokens can have an expiry date, but many are created without one.
How GitLab deploy tokens get leaked
- Clone URLs. A
https://username:[email protected]/...address committed in a script, a Dockerfile or a submodule setting. - Container and package configuration. A
docker loginline, a.npmrc, apip.confor a Mavensettings.xmlwith the token inside. - CI variables printed in logs. A job that echoes its environment and a public pipeline log or artifact.
- Environment files.
DEPLOY_TOKENin a.envor compose file pushed to a public repository. - Documentation and tutorials. Setup instructions pasted into a wiki, issue or support thread with real values.
What to do in the first hour
- Open the project or group that created the token, and go to its deploy tokens list (see the link below). Match the exposed token by its username and name.
- Revoke the token. Do this before cleaning anything else. A new token can be created afterward with only the scopes that the consumer needs.
- Create a replacement with the narrowest scopes and a short expiry date, and deploy it to the servers or CI that need it.
- Check the repository. If the token had the repository scope, someone may have cloned private code. Review what the repository contains that would be sensitive, and rotate any secret committed in it.
- Check the registries. If it had registry or package scopes, review images and packages pushed since the exposure, and look for tags or versions you did not publish.
- Review audit events. On paid plans, the audit events page of the project or group records token creation and use. Otherwise, review pipelines, package and registry history.
- Clean up the code and look for other secrets next to the token. 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 GitLab
Deploy tokens are managed from the settings of the project or group that owns them, in the repository section, under deploy tokens, in your GitLab account after you sign in with a role allowed to manage them. Each token in the list has a revoke action, and revoking is immediate: the token stops working. A person has not confirmed the exact menu wording for this guide, and the interface can change, so if the page differs from this description, look for the section where deploy tokens are listed, and follow GitLab’s documentation. A self-managed GitLab uses its own address.
How LeakWatch detects it
The rule is called GitLab Deploy Token. It matches gldt- followed by exactly 20 characters from letters, digits, underscore and dash. It does not need a variable name next to the token, because the prefix is distinctive. A body shorter than 20 characters, or a different prefix, is not reported. Because the pattern has no closing boundary, a longer string that begins with a valid 20-character body is still matched on its first 20 characters. The severity is critical. This type is not checked live: LeakWatch does not send any request to GitLab with the token it found, so it cannot tell a live token from a revoked one.
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
Can a deploy token push code?
Only if it was given a write scope. A repository scope allows reading, and write scopes exist for the container and package registries. Check which scopes the token had when you revoke it.
Is a deploy token tied to my account?
No. It belongs to a project or group and keeps working if the person who created it leaves, so it must be revoked explicitly.
Do I need to rewrite the Git history?
Revoking the token is what protects you. Cleaning history helps avoid repeated alerts, but the value must be considered public once pushed.