Skip to content
Code & CI · Secret guide

Leaked Semaphore CI API Token: what to do in the first hour

High severityDetected onlyLast verified · 4 min read

A Semaphore CI API token lets a script act as a Semaphore user against the API of an organization. With it, someone can list projects and workflows, read job logs, trigger or stop pipelines and, depending on the rights of the user, work with secrets and project settings. The danger is a modified or triggered pipeline that runs on your infrastructure, where deployment credentials are available. Reset the token first, then check what it did.

Check your GitHub account for leaked secrets — free

Provider
Semaphore CI
Severity
High
Impact
Source code and build access
Checked live by LeakWatch
No

What a Semaphore CI API Token looks like

The tokens LeakWatch looks for are 32 characters of letters and digits, with no prefix, usually passed to the API or to the sem command line tool:

SEMAPHORE_API_TOKEN=XXXX…   (32 letters or digits, no prefix; shortened here)

They appear in an Authorization: Token … header, as SEMAPHORE_API_TOKEN or similar variables in a .env file, in the configuration of the sem tool after sem connect, or in scripts that start workflows. The API also is addressed on a per-organization host name, which is useful context: a leaked URL of the form <organization>.semaphoreci.com tells you which organization is exposed. Note that Semaphore also has other credentials, such as secrets stored in the organization and deployment keys for repositories: those are different, and they are not this token.

How Semaphore CI API Tokens get leaked

  • Automation scripts. A script that triggers workflows or promotions through the API, committed with its token.
  • CLI configuration. A sem configuration file or a setup script containing the token and organization host, copied into a repository.
  • Environment files. A .env file or a compose file with SEMAPHORE_API_TOKEN pushed by accident.
  • Pipeline files. A .semaphore/semaphore.yml that echoes the token or sets it in plain text instead of using a secret.
  • Pasted examples. A curl command with the header filled in, shared in an issue, a chat or a blog.

What to do in the first hour

  1. Reset the token. Sign in to Semaphore, open your account or profile settings where the API token is shown, and regenerate it (see the link below). Verify that the old value no longer works.
  2. Deploy the new token to the clients that need it, from a secret store.
  3. Review workflows. Check recent workflows and promotions in the projects the user can reach. Look for runs you did not start, changed pipeline files and deployments you do not recognize.
  4. Check secrets. Look at the secrets defined in the organization and projects. A user able to edit pipelines can print secrets, so rotate those the token could have used.
  5. Check people and access. Review members, service accounts and deploy keys for entries you do not know, and look at the activity or audit information your plan provides.
  6. Check the repositories for commits that changed pipeline definitions.
  7. Clean up the code and history. 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 Semaphore

The API token is shown in the profile or account settings of your Semaphore account, after you sign in. Look for the section where the API token is displayed, with an option to reset or regenerate it. Semaphore organizations have their own host names, so use the one for the organization where the token was used. A person has not confirmed the exact menu wording for this guide, and the interface can change, so follow Semaphore’s documentation. Regenerating replaces the value, so update every system that used the old one.

How LeakWatch detects it

The rule is called Semaphore CI Token. It looks for the word semaphore in any letter case, then within about 40 characters a standalone run of exactly 32 letters or digits, bounded by word boundaries. Without the word semaphore nearby, a 32-character string is not reported, and a run that is longer or shorter is refused. The prefilter keyword is semaphore. The severity is high. This type is not checked live: LeakWatch does not send any request to Semaphore with the token it found. A 32-character value near the word could be a hash that has nothing to do with Semaphore, so read the context before concluding.

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 token tied to one project?

It acts as the user who owns it, so it reaches what that user can reach in the organization.

Can it read my Semaphore secrets?

That depends on the rights of the user and on what the API exposes. Treat the secrets as exposed anyway, since an attacker who can edit a pipeline can print them.

What if the token was only in a private repository?

The risk is lower but real: anyone with read access, past or present, has seen it. Reset it if you cannot say it never left the team.

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

LeakWatch is not affiliated with Semaphore CI.