Skip to content
Detectors

Scanner deep dive

Overview

SonarQube Server is a code quality and security analysis platform. Its user, global analysis and project analysis tokens authenticate people and CI pipelines to the SonarQube API.
From the detector’s Description() in source

Needs a person to check

Provider and detector details

Summary

ProviderNo provider details added yet.

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

How detection works

One matching rule looks for 40-character strings of lowercase hex characters after a prefix such as “sqa_”, “sqp_” or “squ_”.

Runs by default

Matching rules and source
Keywords
  • squ_
  • sqa_
  • sqp_

Regexes

  • Regex 1keyPatsonarqube.go:40 (opens TruffleHog source on GitHub)Only code file

    \b(sq[apu]_[0-9a-f]{40})\b

    Matches 40-character strings of lowercase hex characters after a prefix such as “sqa_”, “sqp_” or “squ_”.

    Show as a diagram
  • Regex 2hostURLPatsonarqube.go:44 (opens TruffleHog source on GitHub)Only code file

    (?i)\bsonar[._](?:host[._]url|host|url)\b["'\s:=,>]*((?:https?://)?[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?(?::\d{1,5})?)

How it works

  1. Skips any text that doesn’t contain “squ_”, “sqa_” or “sqp_”. This keeps scanning fast.
  2. Looks for 40-character strings of lowercase hex characters after a prefix such as “sqa_”, “sqp_” or “squ_”. 1 more pattern in the technical detail.
  3. Reports each remaining match as a possible Sonar Qube credential. It isn’t known to work until it’s verified.
MustCompile
One value
Guards against false matches
Not found in source
Not found in source
  • endpoint
  • login

How it behaves

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

pkg/detectors/sonarqube · Scanner

Keywords

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

  • squ_
  • sqa_
  • sqp_

sonarqube.go line 49 (opens TruffleHog source on GitHub)

Behavior

Multi-part
Yes, pairs two parts such as an ID and a secret
sonarqube.go line 26 (opens TruffleHog source on GitHub)
Custom endpoints
Yes, can verify against your own server
sonarqube.go line 27 (opens TruffleHog source on GitHub)
Randomness check
None in this detector's own code
False-positive check
The shared word lists
Enabled by default
Yes in the open-source CLI, which turns on its feature flag
defaults.go line 1678 (opens TruffleHog source on GitHub)

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.None in the open-source code.

In short

Wakes on “squ_”, “sqa_” or “sqp_”, reads 1024 bytes around each hit to pair two parts and tests matches with the provider. The open-source CLI runs it by turning on its feature flag.

How verification works

What it means

Sends GET to a templated URL; 200 means verified, 401 means not verified, any other status is an error (unverified, not rejected).

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

Verification host is a template. The endpoint host is filled in at runtime (%s), so the exact host is not known from 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 as declared in source; mutating side effects not declared

Verification walkthrough

How it works

  1. Sends a GET to %s/api/users/current.
  2. Puts the found credential in the request: token is used as the username and "" is used as the password.
  3. If the answer is 200, TruffleHog reports the match as verified under this detector’s rules.
  4. If the answer is 401, it was rejected: reported as not verified.
  5. Any other answer sets a verification error: reported as unverified with an error, not as rejected.
  6. If the request can’t reach the provider, the result is an error, not a rejection.

Evidence from source

Endpoint

%s/api/users/current

Part of this address is filled in when the check runs, so the exact host isn’t known from source.

sonarqube.go:145 (opens TruffleHog source on GitHub)

Key is sent as

HTTP Basic Authentication

sonarqube.go:149 (opens TruffleHog source on GitHub)

How responses are judged

How each response status is judged
StatusOutcomeSource
Verifiedsonarqube.go:162 (opens TruffleHog source on GitHub)
401Not verifiedsonarqube.go:171 (opens TruffleHog source on GitHub)
OtherdefaultParser mapped default to not verified; source sends it to SetVerificationError.sonarqube.go:174 (opens TruffleHog source on GitHub)
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

curl -i -u "$USERNAME:$PASSWORD" "{BASE_URL}/api/users/current"
  • {BASE_URL}: your instance's address, such as https://your-company.example.com
  • $USERNAME: the username or key ID
  • $PASSWORD: the password or secret

Rule: basic. Key placement as recorded: HTTP Basic Authentication.

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 check used the wrong address. Part of this check's address depends on your account or server. If the key belongs to a self-hosted, regional or custom-domain instance, make sure that's the address being called.
  • The scanner couldn't reach the provider. The scanner needs outbound HTTPS access to the provider. 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 401 as not verified: usually a revoked, expired or mistyped key.
  • Rate limit or provider problem. TruffleHog counts any other status as an error, not a rejection. 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

No provider doc recorded for this check yet.

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://sonar.example.com
  • http://host:9000
  • %s/api/users/current

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: SonarQube
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 SonarQube 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.

Optional analysis

No analyzer is recorded for this detector.

A missing analyzer is not evidence the credential has no further access.

Rotation resources

Use the provider’s instructions for this credential.

Revocation instructions

SonarQube Server lets the owner revoke an individual user or analysis token in the account’s Security settings.

Provider documentation checked by Atlas on .

See it in the rotation directory

Token types

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

Token types: from TruffleHog’s source, and what the vendor says
Prefix
sqa_
sqp_
squ_

The detector’s source links no vendor pages.

Coverage in other scanners

3 scanners have a confirmed match.

Changes

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

  1. What this change means

    Atlas added sonarqube to its detector catalog in this update.

    pkg/detectors/sonarqube/sonarqube.go+185−0View file
    @@ -0,0 +1,185 @@
    1added: package sonarqube
    2added:
    3added: import (
    4added: "context"
    5added: "encoding/json"
    6added: "errors"
    7added: "fmt"
    8added: "io"
    9added: "net/http"
    10added: "slices"
    11added: "strings"
    12added:
    13added: regexp "github.com/wasilibs/go-re2"
    14added:
    15added: "github.com/trufflesecurity/trufflehog/v3/pkg/common"
    16added: "github.com/trufflesecurity/trufflehog/v3/pkg/detectors"
    17added: "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"
    18added: "github.com/trufflesecurity/trufflehog/v3/pkg/ssrf"
    19added: )
    20added:
    21added: // Scanner finds SonarQube Server tokens: user (squ_), global analysis (sqa_)
    22added: // and project analysis (sqp_). A token has no host in it, so it is verified
    23added: // against endpoints the user configured and hosts found in the scanned data
    24added: // (see findEndpoints).
    25added: type Scanner struct {
    26added: detectors.DefaultMultiPartCredentialProvider
    27added: detectors.EndpointSetter
    28added: client *http.Client
    29added: }
    30added:
    31added: // Ensure the Scanner satisfies the interface at compile time.
    32added: var _ detectors.Detector = (*Scanner)(nil)
    33added: var _ detectors.EndpointCustomizer = (*Scanner)(nil)
    34added:
    35added: // There is no public SonarQube Server, so there is no cloud endpoint.
    36added: func (Scanner) CloudEndpoint() string { return "" }
    37added:
    38added: var (
    39added: defaultClient = common.SaneHttpClient()
    40added: keyPat = regexp.MustCompile(`\b(sq[apu]_[0-9a-f]{40})\b`)
    41added:
    42added: // Host after a sonar config key, any port, for example
    43added: // sonar.host.url=https://sonar.example.com or SONAR_HOST_URL: sonar.example.com:8080
    44added: hostURLPat = regexp.MustCompile(`(?i)\bsonar[._](?:host[._]url|host|url)\b["'\s:=,>]*((?:https?://)?[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?(?::\d{1,5})?)`)
    45added: )
    46added:
    47added: // Keywords are used for efficiently pre-filtering chunks.
    48added: func (s Scanner) Keywords() []string {
    49added: return []string{"squ_", "sqa_", "sqp_"}
    50added: }
    51added:
    52added: // findEndpoints returns the hosts in the data named by a sonar config key,
    53added: // each one once.
    54added: func findEndpoints(data string) []string {
    55added: var endpoints []string
    56added: seen := make(map[string]struct{})
    57added: for _, match := range hostURLPat.FindAllStringSubmatch(data, -1) {
    58added: if _, ok := seen[match[1]]; !ok {
    59added: seen[match[1]] = struct{}{}
    60added: endpoints = append(endpoints, match[1])
    61added: }
    62added: }
    63added: return endpoints
    64added: }
    65added:
    66added: // FromData will find and optionally verify SonarQube secrets in a given set of bytes.
    67added: func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (results []detectors.Result, err error) {
    68added: uniqueMatches := make(map[string]struct{})
    69added: for _, match := range keyPat.FindAllStringSubmatch(string(data), -1) {
    70added: uniqueMatches[match[1]] = struct{}{}
    71added: }
    72added:
    73added: configured := s.Endpoints()
    74added: endpoints := s.Endpoints(findEndpoints(string(data))...)
    75added:
    76added: for match := range uniqueMatches {
    77added: result := detectors.Result{
    78added: DetectorType: detector_typepb.DetectorType_SonarQube,
    79added: Raw: []byte(match),
    80added: SecretParts: map[string]string{"key": match},
    81added: }
    82added:
    83added: // nowhere to verify, tell the user how to fix that
    84added: if len(endpoints) == 0 {
    85added: result.ExtraData = map[string]string{
    86added: "message": "No SonarQube Server URL was found or configured. To verify this token, set the server URL as a custom endpoint, e.g. --verifier SonarQube=https://sonar.example.com",
    87added: }
    88added: }
    89added:
    90added: if verify {
    91added: // try each endpoint, stop at the first one that accepts the token
    92added: var verifyErr error
    93added: for _, endpoint := range endpoints {
    94added: // Hosts found in scanned data are not trusted, so they get a client
    95added: // that refuses local and private addresses.
    96added: client := s.client
    97added: if client == nil {
    98added: client = s.VerificationClient(defaultClient)
    99added: if !slices.Contains(configured, endpoint) {
    100added: client = detectors.DetectorHttpClientWithNoLocalAddresses
    101added: }
    102added: }
    103added:
    104added: isVerified, extraData, err := verifyMatch(ctx, client, endpoint, match)
    105added: // a found host like localhost is the developer's machine, not ours, skip it
    106added: if errors.Is(err, ssrf.ErrEgressBlocked) {
    107added: continue
    108added: }
    109added: if err != nil {
    110added: verifyErr = err
    111added: continue
    112added: }
    113added: if isVerified {
    114added: result.Verified = true
    115added: result.ExtraData = extraData
    116added: verifyErr = nil
    117added: break
    118added: }
    119added: }
    120added: result.SetVerificationError(verifyErr, match)
    121added: }
    122added:
    123added: results = append(results, result)
    124added: }
    125added:
    126added: return
    127added: }
    128added:
    129added: type currentUserResponse struct {
    130added: IsLoggedIn bool `json:"isLoggedIn"`
    131added: Login string `json:"login"`
    132added: }
    133added:
    134added: // verifyMatch asks the server who the token belongs to.
    135added: // The token goes in the basic auth username with an empty password.
    136added: // A wrong token gets a 401. We check isLoggedIn too, because a server
    137added: // that allows anonymous access answers 200 for any request.
    138added: func verifyMatch(ctx context.Context, client *http.Client, endpoint, token string) (bool, map[string]string, error) {
    139added: // users pass "host:9000" or "http://host:9000", default to https
    140added: if !strings.Contains(endpoint, "://") {
    141added: endpoint = "https://" + endpoint
    142added: }
    143added: url := strings.TrimRight(endpoint, "/") + "/api/users/current"
    144added:
    145added: req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)
    146added: if err != nil {
    147added: return false, nil, err
    148added: }
    149added: req.SetBasicAuth(token, "")
    150added: req.Header.Set("Accept", "application/json")
    151added:
    152added: res, err := client.Do(req)
    153added: if err != nil {
    154added: return false, nil, err
    155added: }
    156added: defer func() {
    157added: _, _ = io.Copy(io.Discard, res.Body)
    158added: _ = res.Body.Close()
    159added: }()
    160added:
    161added: switch res.StatusCode {
    162added: case http.StatusOK:
    163added: var user currentUserResponse
    164added: if err := json.NewDecoder(res.Body).Decode(&user); err != nil {
    165added: return false, nil, fmt.Errorf("failed to decode response: %w", err)
    166added: }
    167added: if !user.IsLoggedIn {
    168added: return false, nil, nil
    169added: }
    170added: return true, map[string]string{"endpoint": endpoint, "login": user.Login}, nil
    171added: case http.StatusUnauthorized:
    172added: // the token is definitely not valid on this server
    173added: return false, nil, nil
    174added: default:
    175added: return false, nil, fmt.Errorf("unexpected HTTP response status %d", res.StatusCode)
    176added: }
    177added: }
    178added:
    179added: func (s Scanner) Type() detector_typepb.DetectorType {
    180added: return detector_typepb.DetectorType_SonarQube
    181added: }
    182added:
    183added: func (s Scanner) Description() string {
    184added: return "SonarQube Server is a code quality and security analysis platform. Its user, global analysis and project analysis tokens authenticate people and CI pipelines to the SonarQube API."
    185added: }

Source

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

2325546
feea7f9
Parser
trufflehog-detectors-analyzers-v12
Extraction
intel-detector-v7

5 of 24 evidence rows need attention

Evidence rows that need attention
FieldStatusValueSource
lastSeenAt2026-11-25T16:33:44.855ZNo citation
rotationGuideNone extractedFile
timeoutNone extractedFile
rateLimitNone extractedFile
verify.urls%s/api/users/currentParser confidence: lowFile
All 24 evidence rows
All evidence rows
FieldStatusValueSource
descriptionSonarQube Server is a code quality and security analysis platform. Its user, global analysis and project analysis tokens authenticate people and CI pipelines to the SonarQube API.File
keywordssqu_, sqa_, sqp_File
detectorTypesSonarQubeFile
filessonarqube.goFile
patterns\b(sq[apu]_[0-9a-f]{40})\b, (?i)\bsonar[._](?:host[._]url|host|url)\b["'\s:=,>]*((?:https?://)?[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?(?::\d{1,5})?)File
patternTypemust_compileFile
statusactiveFile
lastSeenAt2026-11-25T16:33:44.855ZNo citation
rotationGuideNone extractedFile
verify.hasVerifyYesFile
verify.httpMethodsGETFile
verify.statusCodesOK, UnauthorizedFile
timeoutNone extractedFile
rateLimitNone extractedFile
errorHandlingSetVerificationError; unexpected HTTP response status %dFile
verify.urlshttps://sonar.example.com, http://host:9000File
verify.urls%s/api/users/currentParser confidence: lowFile
detection.keywordssqu_, sqa_, sqp_Lines 48–48
verification.endpoint%s/api/users/currentLines 145–145
verification.httpMethodGETLines 145–145
verification.authenticationMethodHTTP Basic AuthenticationLines 149–149
verification.expectedStatuses.verified{"statuses":[200],"names":["StatusOK"],"outcome":"verified"}Lines 162–162
verification.expectedStatuses.not_verified{"statuses":[401],"names":["StatusUnauthorized"],"outcome":"not_verified"}Lines 171–171
verification.expectedStatuses.error_or_unknown{"statuses":[],"names":["default"],"outcome":"error_or_unknown"}Lines 174–174
Parser completeness
  • Field status: Extracted
  • Field status: Extracted
  • Field status: Extracted
  • Field status: Extracted
  • Field status: Unknown
  • Field status: Unknown
  • Field status: Extracted
  • Field status: Extracted
  • Field status: Extracted
  • Field status: Extracted
  • Field status: Not scanned
Package files (1)
  • sonarqube.go