Skip to content
Code & CI · Secret guide

Leaked Sauce Labs Access Key: what to do in the first hour

High severityDetected onlyLast verified · 5 min read

A Sauce Labs access key is the secret that, together with your username, authenticates test runs on Sauce Labs’ cloud of browsers, emulators and real devices, and calls to its REST APIs. Whoever holds the pair can start jobs on your plan and use your concurrency, list and read your past jobs and their logs, and act on the account within the rights of that user. The key does not reach your own servers, but test logs and URLs often reveal staging addresses and test accounts. Regenerate the key first, then check what it was used for.

Check your GitHub account for leaked secrets — free

Provider
Sauce Labs
Severity
High
Impact
SaaS account access and billing
Checked live by LeakWatch
No

What a Sauce Labs access key looks like

A current access key is a UUID: 36 characters in groups of 8, 4, 4, 4 and 12 separated by dashes. Older credentials and some tokens have a different look, starting with oauth-:

XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX   access key (masked UUID)
oauth-XXXX…-XXXXX                        older style value (masked)

A UUID is common and means nothing alone, so context identifies it: the variable SAUCE_ACCESS_KEY next to SAUCE_USERNAME, the sauce:options block of test capabilities, a saucectl configuration, or credentials in a URL such as https://USER:[email protected]. Mobile App Distribution, formerly TestFairy, is a separate product with its own API key and its own settings page. If both appear in the file, handle both.

How Sauce Labs access keys get leaked

  • Capabilities committed with the test code. A sauce:options object, a wdio.conf.js or a .sauce/config.yml with the username and key typed in.
  • Environment files. SAUCE_ACCESS_KEY in a .env or compose file that is not ignored.
  • Remote URLs with credentials. The on-demand URL, with the username and key before the @, pasted into code, a README or an issue.
  • Continuous integration. A workflow printing the environment, or an open-source project whose public pipeline holds the key in clear.
  • Shared examples. A reproduction case posted with a vendor or in a forum, complete with the real key.

What to do in the first hour

  1. Regenerate the access key. Sign in to Sauce Labs, open your user settings and use the option that regenerates the key (see the link below). The documentation says old commands containing the previous key will fail.
  2. Deploy the new key to your secret store, to the variables of every CI project and to developer machines, then run one test to confirm it works.
  3. Check the jobs. Review the list of recent jobs and builds for the period since the exposure. Look for runs you did not start, unknown names, unusual hours, or an unexplained rise in concurrency.
  4. Read what the jobs touched. Logs and videos can show which URLs and test accounts the attacker used. Note any internal host that appeared.
  5. Review the organization. If you are an administrator, check the list of users for ones you do not know. An administrator can regenerate another user’s key, so do it for service users that shared the file.
  6. Rotate neighbours. Test projects often hold credentials for staging and other services. Rotate whatever sat in the same file.
  7. Clean up the code and move the key to a secret store. See I accidentally pushed an API key to GitHub.

Not sure what else leaked from the same repository? Run a free scan.

Not sure what else leaked? Run a free scan.

Revoke it at Sauce Labs

Sauce Labs documents regenerating the access key from the user settings of your Sauce Labs account: choose the account menu, then the user settings, and use the button that regenerates the key. Administrators can also regenerate the key of another user from the organization management area, in the user’s details. Regenerating replaces the key, so each system using it must be updated. 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 the access key is displayed, and follow the Sauce Labs documentation.

How LeakWatch detects it

Two rules cover this type. The first is called Sauce Labs API Key. It recognizes oauth- followed by at least 8 lowercase letters or digits, a dash, and exactly 5 more, with word boundaries around the whole value, and it does not need a variable name. Uppercase characters or other lengths are not reported. The second is called Sauce Labs API Key (2). It looks for the word saucelabs, in any letter case, followed within about 40 characters by a UUID-shaped value, so a bare UUID without the word nearby is not reported, and the variable name SAUCE_ACCESS_KEY alone does not contain that word. Both are rated high severity. This type is not checked live: LeakWatch does not send any request to Sauce Labs with the value it found.

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 the access key enough without my username?

Authentication needs both, but the username is easy to learn, since it appears in build names and public configuration. Treat the key alone as leaked.

Does regenerating my key also change the keys of my teammates?

No. Each user has their own key, so regenerate the one that leaked and, as an administrator, those of any user whose key was in the same file.

Can I find who used the key?

Use the job and build history of the account and its logs. They show what ran and when, though not always where the request came from.

Get alerted next time a secret leaks — create a free account

LeakWatch is not affiliated with Sauce Labs.