Skip to content
Detectors

Scanner deep dive

Overview

The GitLab detector looks for a single value in text that resembles a credential. It uses the word “gitlab” to narrow its search.

Provider and detector details

Summary

GitLabVersion ControlDraft: not yet checked by a person

GitLab is a platform for the whole software lifecycle, used by teams and AI agents. Personal access tokens can be created, rotated, and revoked from a user's profile.

Website Credential docs

Runs on any connection. Triggered by keywords in the content, after decoding.How TruffleHog works

GitLab is a web-based DevOps lifecycle tool that provides a Git repository manager providing wiki, issue-tracking, and CI/CD pipeline features. GitLab API tokens can be used to access and modify repository data and other resources. GitLab Personal Access Tokens (PATs) can be used to authenticate and access GitLab resources.
From the detector’s Description() in source
About GitLab

source code hosting and DevOps. Products: GitLab.com, GitLab self-managed, personal access tokens.

A verified token can call GitLab APIs on that host with whatever scopes the token has. Admin or owner access is unknown from the detector alone.

GET {host}/api/v4/user with Bearer. HTTP 200 and 403 are verified (403 can mean live token without read_user, or a blocked account). 401 is not. This registry does not treat 403 as a dead key.

Provider documentation

The detector changed on Oct 1, 2026, and this context has no recorded review. Check it still matches.

Draft provider notes, not yet checked by a person. Not read from source.

How detection works

The v1 detector checks decoded text containing “gitlab” for a possible credential.

Matching rules and source
Detector-wide rules and behavior

How it works

  1. Checks each key against a host: the provider’s cloud host or a configured endpoint. The host isn’t a second secret.
  2. Values are trimmed before use.
  3. Values below entropy 3.6 are skipped.
  4. Drops matches that look like known non-secrets (1 rule, in at least one variant).
  5. Reports each remaining match as a possible GitLab credential. It isn’t known to work until it’s verified.
Prefix regex
One valuekey and host
Guards against false matches
Shannon entropy ≥ 3.6
  • v1 skips matches that contain glpat-
  • rotation_guide
  • version
Pairing and normalization
  • key and host are combined; host may be cloud or a configured endpoint
  • values are trimmed before use

How it behaves

What this detector does at each step of the TruffleHog pipeline.

pkg/detectors/gitlab/v1 · Scanner

Keywords

Any one of these in the decoded text wakes the detector.

  • gitlab

gitlab.go line 58 (opens TruffleHog source on GitHub)

Behavior

Multi-part
No
Match window
512 bytes on each side of a keyword
ahocorasickcore.go line 159 (opens TruffleHog source on GitHub)
Custom endpoints
Yes, can verify against your own server
gitlab.go line 22 (opens TruffleHog source on GitHub)
Randomness check
Skips values with entropy below 3.6
gitlab.go line 83 (opens TruffleHog source on GitHub)
False-positive check
The shared word lists

Verification. When a scan allows it, TruffleHog tests a match by calling the provider. A scan can turn this off for every detector or for this one. Atlas only describes this; it never tests credentials. How the verify decision works

Analyzer.GitLab Analyzer

In short

  • v1: Wakes on “gitlab” and tests matches with the provider. A default scan runs it.
  • v2: Wakes on “glpat-” and tests matches with the provider. A default scan runs it.
  • v3: Wakes on “glpat-” and tests matches with the provider. A default scan runs it.

How verification works

Each variant checks a found key its own way. Compare their requests and how answers are judged below.

Open Source + Enterprise support detection and verification for this credential type. Edition source.

Does checking a key change anything at the provider?

Not expected to: it’s a GET request, which reads without changing anything, and the source declares no changes.

Source says: GET of the authenticated user; mutating side effects not declared

Files
v1/gitlab.go
Request
GEThttps://gitlab.com/api/v4/usergitlab.go:129 (opens TruffleHog source on GitHub)
How answers are judged
Troubleshoot this check

If a result looks wrong, work through these steps. They’re built from the request and status rules above. The Atlas doesn’t send anything.

1. Send the same request yourself

Each variant checks keys its own way. Use the one that matches your key’s format (see Detection above).

  • v1

    curl -i -H "Authorization: Bearer $API_KEY" "https://gitlab.com/api/v4/user"
    • $API_KEY: the key you're checking

    Rule: header. Key placement as recorded: Bearer token.

  • v2

    No check is tied to this variant’s files in what was read from source.

  • v3

    No check is tied to this variant’s files in what was read from source.

Only test keys you own or are allowed to check. Each command is one read-only GET request, the same one TruffleHog makes. Compare the status you get with “How responses are judged” above.

2. Likely causes

  • The scanner couldn't reach the provider. The scanner needs outbound HTTPS access to gitlab.com. A firewall, proxy or DNS problem is reported as an error, not a rejection, and the key can be checked again.
  • The provider rejected the key. TruffleHog counts these as not verified (v1: 401): usually a revoked, expired or mistyped key.
  • Rate limit or provider problem. TruffleHog counts these as an error, not a rejection (v1: 403 and any other status). A rate limit (429) or an outage lands here; the key can be checked again later.
  • The provider changed its API. If the provider answers differently from the table above, its API may have changed since this check was written. Compare against the provider's docs.

3. Check the provider’s docs

4. Still stuck

Report it to TruffleHog

Include the status code and response you got. Never include the key.

Errors, timeouts and rate limits
Not found in source
Not found in source
SetVerificationError; unexpected HTTP response status %d

other statuses: verification error or unknown

transport errors return a verification error

All URLs found in source

  • https://gitlab.com
  • https://howtorotate.com/docs/tutorials/gitlab/
  • https://gitlab.com/gitlab-org/gitlab/-/merge_requests/169322

Verified findings

Open Source · Standard output (stdout)

The CLI prints verified findings to stdout. Use --json for structured output.

Example scan output · credential redacted

✅ Found verified result 🐷🔑
Detector Type: Gitlab
Decoder Type: PLAIN
Raw result: [redacted]
Terminal printer source
CI formats

With --github-actions, GitHub Actions displays this workflow command as a warning on the indicated file and line.

::warning file=config/example.env,line=8,endLine=8::Found verified Gitlab result 🐷🔑
GitHub Actions printer source

Legacy compatibility. --json-legacy writes pre-v3 JSON for Git, GitLab, and GitHub sources only.

Enterprise alerts

When Enterprise verifies that a secret is live, a configured notifier can alert your team. The finding is also available through the Enterprise API.

A notifier that displays rotation guides can include this link with the alert.

Open rotation guide

Optional analysis

What the analyzer checks

In Open Source, run trufflehog analyze separately from the scan. Enterprise runs enabled self-discovery analyzers on first discovery of a supported live secret.

pkg/analyzer/cli.go registers this detector key to the analyzer package.

How it works

  1. Runs after the detector reports the match as verified.
  2. Evaluates what the credential may be able to access using the analyzer’s own checks or rules.
  3. Reports what it finds. Its source lists 14 permissions in 1 group and 2 resource types.

Rotation resources

Token types

TruffleHog’s source looks for 1 token type, by prefix. It doesn’t name them.

Token types: from TruffleHog’s source, and what the vendor says
PrefixVariant
glpat-v2
Pages TruffleHog’s source links to (1)

Written in the detector’s source by its authors. Shown as written: this doesn’t say what each page covers.

Coverage in other scanners

4 scanners have a confirmed match.

Changes

1 recorded change since Sep 18, 2026; 1 still needs review.

  1. What this change means

    How responses are judged changed. Changes how the detector verifies or what it treats as the credential.

    Field changes
    FieldBeforeAfter
    Expected statusesBefore: 200 (StatusOK) → verified; 403 (StatusForbidden) → verified; 401 (StatusUnauthorized) → not verified; other (default) → error or unknown
    After: 200 (StatusOK) → verified; 403 (StatusForbidden) → error or unknown; 401 (StatusUnauthorized) → not verified; other (default) → error or unk… show all
    200 (StatusOK) → verified; 403 (StatusForbidden) → error or unknown; 401 (StatusUnauthorized) → not verified; other (default) → error or unknown
    pkg/detectors/gitlab/v1/gitlab.go+29−9View file
    @@ -37,8 +37,16 @@ var (
    3737 keyPat = regexp.MustCompile(detectors.PrefixRegex([]string{"gitlab"}) + `\b([a-zA-Z0-9][a-zA-Z0-9\-=_]{19,21})\b`)
    3838
    3939 BlockedUserMessage = "403 Forbidden - Your account has been blocked"
    40added:
    41added: // GitLab's forbidden! helper formats every reasoned 403 as "403 Forbidden - <reason>".
    42added: forbiddenWithReasonPrefix = "403 Forbidden - "
    4043)
    4144
    45added: type gitlabErrorResponse struct {
    46added: Message string `json:"message"`
    47added: Error string `json:"error"`
    48added: }
    49added:
    4250func (s Scanner) getClient() *http.Client {
    4351 if s.client != nil {
    4452 return s.client
    @@ -140,22 +148,34 @@ func VerifyGitlab(ctx context.Context, client *http.Client, baseEndpoint, resMat
    140148 }
    141149
    142150 // 200 means good key and has `read_user` scope
    143removed: // 403 means good key but not the right scope
    151added: // 403 from GitLab means good key, but either the scope or the account state denies access
    144152 // 401 is bad key
    145153 switch res.StatusCode {
    146154 case http.StatusOK:
    147155 return json.Valid(bodyBytes), nil, nil
    148156 case http.StatusForbidden:
    149removed: // check if the user account is blocked or not
    150removed: stringBody := string(bodyBytes)
    151removed: if strings.Contains(stringBody, BlockedUserMessage) {
    152removed: return true, map[string]string{
    153removed: "blocked": "True",
    154removed: }, nil
    157added: var errResp gitlabErrorResponse
    158added: if err := json.Unmarshal(bodyBytes, &errResp); err != nil {
    159added: return false, nil, fmt.Errorf("unexpected 403 response, unable to verify token")
    160added: }
    161added:
    162added: switch {
    163added: // GitLab only rejects an account (blocked, deactivated, password expired, unconfirmed
    164added: // email, etc.) after the token has resolved to a user.
    165added: case strings.HasPrefix(errResp.Message, forbiddenWithReasonPrefix):
    166added: extraData := map[string]string{
    167added: "access_denied_reason": strings.TrimPrefix(errResp.Message, forbiddenWithReasonPrefix),
    168added: }
    169added: if strings.HasPrefix(errResp.Message, BlockedUserMessage) {
    170added: extraData["blocked"] = "True"
    171added: }
    172added: return true, extraData, nil
    173added: case errResp.Error == "insufficient_scope", errResp.Error == "insufficient_granular_scope":
    174added: // Good key but not the right scope
    175added: return true, nil, nil
    155176 }
    156177
    157removed: // Good key but not the right scope
    158removed: return true, nil, nil
    178added: return false, nil, fmt.Errorf("unexpected 403 response, unable to verify token")
    159179 case http.StatusUnauthorized:
    160180 // Nothing to do; zero values are the ones we want
    161181 return false, nil, nil
    pkg/detectors/gitlab/v2/gitlab_v2.go+4−0View file
    @@ -61,6 +61,10 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
    6161 for _, match := range matches {
    6262 resMatch := strings.TrimSpace(match[1])
    6363
    64added: if detectors.StringShannonEntropy(resMatch) < 3.6 {
    65added: continue
    66added: }
    67added:
    6468 for _, endpoint := range s.Endpoints() {
    6569 s1 := detectors.Result{
    6670 DetectorType: detector_typepb.DetectorType_Gitlab,
    pkg/detectors/gitlab/v3/gitlab_v3.go+4−0View file
    @@ -62,6 +62,10 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
    6262 for _, match := range matches {
    6363 resMatch := strings.TrimSpace(match[1])
    6464
    65added: if detectors.StringShannonEntropy(resMatch) < 3.6 {
    66added: continue
    67added: }
    68added:
    6569 for _, endpoint := range s.Endpoints() {
    6670 s1 := detectors.Result{
    6771 DetectorType: detector_typepb.DetectorType_Gitlab,

Source

Every fact on this page was parsed from trufflesecurity/trufflehog at 2325546, unless a row below says otherwise.

2325546
2921dcc
Parser
trufflehog-detectors-analyzers-v12
Extraction
intel-detector-v7

3 of 28 evidence rows need attention

Evidence rows that need attention
FieldStatusValueSource
lastSeenAt2026-11-25T16:33:44.855ZNo citation
timeoutNone extractedFile
rateLimitNone extractedFile
All 28 evidence rows
All evidence rows
FieldStatusValueSource
descriptionGitLab is a web-based DevOps lifecycle tool that provides a Git repository manager providing wiki, issue-tracking, and CI/CD pipeline features. GitLab API tokens can be used to access and modify repository data and other resources.File
keywordsgitlab, glpat-File
detectorTypesGitlabFile
filesv1/gitlab.go, v2/gitlab_v2.go, v3/gitlab_v3.goFile
patterns\b([a-zA-Z0-9][a-zA-Z0-9\-=_]{19,21})\b, \b(glpat-[a-zA-Z0-9\-=_]{20,22})\b, \b(glpat-[a-zA-Z0-9\-=_]{27,300}.[0-9a-z]{2}.[a-z0-9]{9})\bFile
patternTypeprefix_regexFile
statusactiveFile
lastSeenAt2026-11-25T16:33:44.855ZNo citation
rotationGuidehttps://howtorotate.com/docs/tutorials/gitlab/File
verify.hasVerifyYesFile
verify.httpMethodsGETFile
verify.statusCodesOK, Forbidden, UnauthorizedFile
entropyMinimum3.6File
allowlistRulesv1 skips matches that contain glpat-File
timeoutNone extractedFile
rateLimitNone extractedFile
errorHandlingSetVerificationError; unexpected HTTP response status %dFile
verify.urlshttps://gitlab.com, https://howtorotate.com/docs/tutorials/gitlab/, https://gitlab.com/gitlab-org/gitlab/-/merge_requests/169322File
detection.keywordsgitlabLines 57–57
detection.keywordsglpat-Lines 43–43
detection.keywordsglpat-Lines 44–44
verification.endpointhttps://gitlab.com/api/v4/userLines 129–129
verification.httpMethodGETLines 129–129
verification.authenticationMethodBearer tokenLines 134–134
verification.expectedStatuses.verified{"statuses":[200],"names":["StatusOK"],"outcome":"verified"}Lines 151–151
verification.expectedStatuses.error_or_unknown{"statuses":[403],"names":["StatusForbidden"],"outcome":"error_or_unknown"}Lines 153–153
verification.expectedStatuses.not_verified{"statuses":[401],"names":["StatusUnauthorized"],"outcome":"not_verified"}Lines 176–176
verification.expectedStatuses.error_or_unknown{"statuses":[],"names":["default"],"outcome":"error_or_unknown"}Lines 179–179
Parser completeness
  • Field status: Extracted
  • Field status: Extracted
  • Field status: Extracted
  • Field status: Extracted
  • Field status: Extracted
  • Field status: Extracted
  • Field status: Extracted
  • Field status: Extracted
  • Field status: Extracted
  • Field status: Extracted
  • Field status: Not scanned
Package files (3)
  • v1/gitlab.go
  • v2/gitlab_v2.go
  • v3/gitlab_v3.go