Skip to content
Changes

Reference

saucelabs · Nov 21, 2026

What this change means

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

Field changes
FieldBeforeAfter
Regex patterns
Before: \b([a-zA-Z0-9_\.-]{2,70}), \b([a-z0-9]{8}\-[a-z0-9]{4}\-[a-z0-9]{4}\-[a-z0-9]{4}\-[a-z0-9]{12})\b, \b(api\.(?:us|eu)-(?:west|east|central)-[… show all
\b([a-zA-Z0-9_\.-]{2,70}), \b([a-z0-9]{8}\-[a-z0-9]{4}\-[a-z0-9]{4}\-[a-z0-9]{4}\-[a-z0-9]{12})\b, \b(api\.(?:us|eu)-(?:west|east|central)-[0-9].saucelabs\.com)\b
After: \b([a-zA-Z0-9_\.-]{2,70}), \b([a-z0-9]{8}\-[a-z0-9]{4}\-[a-z0-9]{4}\-[a-z0-9]{4}\-[a-z0-9]{12})\b, \b(api\.(?:us|eu)-(?:west|east|central)-[… show all
\b([a-zA-Z0-9_\.-]{2,70}), \b([a-z0-9]{8}\-[a-z0-9]{4}\-[a-z0-9]{4}\-[a-z0-9]{4}\-[a-z0-9]{12})\b, \b(api\.(?:us|eu)-(?:west|east|central)-[0-9]\.saucelabs\.com)\b
Verification endpointBefore: https://%s/team-management/v1/teamsAfter: https://%s/auth/v1/identity
Expected statusesBefore: 200/403 (StatusOK, StatusForbidden) → verified; 401 (StatusUnauthorized) → not verified; other (default) → error or unknownAfter: 200 (StatusOK) → verified; 401 (StatusUnauthorized) → not verified; other (default) → error or unknown
pkg/detectors/saucelabs/saucelabs.go+28−6View file
@@ -2,6 +2,7 @@ package saucelabs
22
33import (
44 "context"
5added: "encoding/json"
56 "fmt"
67 "io"
78 "net/http"
@@ -14,6 +15,7 @@ import (
1415)
1516
1617type Scanner struct {
18added: client *http.Client
1719 detectors.DefaultMultiPartCredentialProvider
1820}
@@ -21,17 +23,28 @@ type Scanner struct {
2123var _ detectors.Detector = (*Scanner)(nil)
2224
2325var (
24removed: client = common.SaneHttpClient()
26added: defaultClient = common.SaneHttpClient()
2527
2628 // Make sure that your group is surrounded in boundary characters such as below to reduce false positives.
2729 // as per signup page username can be between 2 to 70 characters and must only contain letters, numbers, or characters (_-.)
2830 usernamePat = regexp.MustCompile(detectors.PrefixRegex([]string{"saucelabs", "username"}) + `\b([a-zA-Z0-9_\.-]{2,70})`)
2931 keyPat = regexp.MustCompile(detectors.PrefixRegex([]string{"saucelabs"}) + `\b([a-z0-9]{8}\-[a-z0-9]{4}\-[a-z0-9]{4}\-[a-z0-9]{4}\-[a-z0-9]{12})\b`)
30removed: baseUrlPat = regexp.MustCompile(`\b(api\.(?:us|eu)-(?:west|east|central)-[0-9].saucelabs\.com)\b`)
32added: baseUrlPat = regexp.MustCompile(`\b(api\.(?:us|eu)-(?:west|east|central)-[0-9]\.saucelabs\.com)\b`)
3133
3234 fixedBaseURL = "api.us-west-1.saucelabs.com"
3335)
3436
37added: type identityResponse struct {
38added: Sub string `json:"sub"`
39added: }
40added:
41added: func (s Scanner) getClient() *http.Client {
42added: if s.client != nil {
43added: return s.client
44added: }
45added: return defaultClient
46added: }
47added:
3548// Keywords are used for efficiently pre-filtering chunks.
3649// Use identifiers in the secret preferably, or the provider name.
3750func (s Scanner) Keywords() []string {
@@ -79,7 +92,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
7992 }
8093
8194 if verify {
82removed: isVerified, verificationErr := verifySauceLabKey(ctx, client, userName, key, baseURL)
95added: isVerified, verificationErr := verifySauceLabKey(ctx, s.getClient(), userName, key, baseURL)
8396 s1.Verified = isVerified
8497 s1.SetVerificationError(verificationErr, key)
8598 }
@@ -100,10 +113,12 @@ func (s Scanner) Description() string {
100113 return "A service for cross browser testing, API keys can create and access tests from potentially sensitive internal websites"
101114}
102115
116added: // verifySauceLabKey calls the identity endpoint, which accepts any valid credential regardless of role
117added: // and is documented to return only 200 or 401. Any other response (e.g. a 403 from a proxy) is indeterminate.
103118func verifySauceLabKey(ctx context.Context, client *http.Client, userName, key, baseURL string) (bool, error) {
104removed: apiURL := fmt.Sprintf("https://%s/team-management/v1/teams", baseURL)
119added: apiURL := fmt.Sprintf("https://%s/auth/v1/identity", baseURL)
105120
106removed: req, err := http.NewRequestWithContext(ctx, http.MethodGet, apiURL, nil)
121added: req, err := http.NewRequestWithContext(ctx, http.MethodGet, apiURL, http.NoBody)
107122 if err != nil {
108123 return false, err
109124 }
@@ -120,7 +135,14 @@ func verifySauceLabKey(ctx context.Context, client *http.Client, userName, key,
120135 }()
121136
122137 switch resp.StatusCode {
123removed: case http.StatusOK, http.StatusForbidden:
138added: case http.StatusOK:
139added: var identity identityResponse
140added: if err := json.NewDecoder(resp.Body).Decode(&identity); err != nil {
141added: return false, fmt.Errorf("unexpected response body: %w", err)
142added: }
143added: if identity.Sub == "" {
144added: return false, fmt.Errorf("unexpected response body: missing account id")
145added: }
124146 return true, nil
125147 case http.StatusUnauthorized:
126148 return false, nil