Sentry issues several kinds of auth tokens, and two have an easily recognized prefix: organization auth tokens, which start with sntrys_, and personal user auth tokens, which start with sntryu_. An organization token is tied to the organization rather than to a person, and is designed for build tooling: uploading source maps, creating releases and, depending on scopes, reading project data. A user token acts as the person who created it, with the scopes chosen at creation. Either can expose error events, which often carry request data, user identifiers and variable values. Revoke the token first, then look at what it could do.
Check your GitHub account for leaked secrets — free
- Provider
- Sentry
- Severity
- High
- Impact
- SaaS account access and billing
- Checked live by LeakWatch
- Yes
What a Sentry organization token looks like
An organization token starts with sntrys_ followed by a long Base64-looking body, which encodes a small JSON object with the issue time and the region URL, then an underscore and a final block of 43 characters. A user token starts with sntryu_ followed by 64 lowercase hexadecimal characters:
sntrys_eyJ…XXXX…_XXXX…XXXX organization token (masked, long Base64 body)
sntryu_XXXX…XXXX user token (masked, 64 lowercase hex characters)
The two prefixes differ by one letter, s for the organization and u for the user, so read it carefully. Older tokens without a prefix, internal integration tokens and DSNs are different things. A DSN, the https://[email protected]/ID address used to send events, is meant to be embedded in applications and only lets someone send events. These tokens usually live in SENTRY_AUTH_TOKEN, in .sentryclirc files, or in build plugin configuration.
How Sentry organization tokens get leaked
- Build configuration. The Sentry plugin of a bundler or
sentry-cliconfigured with the token typed into a config file instead of an environment variable. - A
.sentryclircfile. Committed to a repository, with the token in its auth section. - Environment files.
SENTRY_AUTH_TOKENin a.envor compose file that is not ignored. - Continuous integration. A workflow that prints its environment or a token pasted directly into a public pipeline.
- Docker layers and logs. A token passed as a build argument and kept in an image layer or a build log.
What to do in the first hour
- Revoke the token. In Sentry, open the page for organization auth tokens or, for a user token, your personal auth tokens page (see the link below), find the exposed token and revoke it. Organization tokens can only be revoked by owners and managers.
- Create a new token with the narrowest scope. Tooling that uploads source maps and creates releases needs far fewer rights than a token that reads everything.
- Deploy the new token to the secret store and CI variables, then run one build that uploads source maps to confirm it works.
- Check what the old token did. Look at the audit log of the organization for the period since the exposure. Review the releases, the uploaded source maps and artifacts, and any change to projects, members or integrations.
- Assess the data. If the token could read events, assume the issues, stack traces, breadcrumbs and user data of the projects it reached were exposed, and decide whether you have a notification duty.
- Check integrations and members. Look for new integrations, webhooks or invited members you do not recognize.
- Clean up the code and look for neighbouring secrets in the same file. See I accidentally pushed an API key to GitHub.
Not sure what else leaked from the same repository? Run a free scan.
Revoke it at Sentry
According to the Sentry documentation at https://docs.sentry.io/account/auth-tokens/, organization tokens are managed from the developer settings of the organization, under organization tokens, and only owners and managers can revoke them. Personal tokens are listed in the auth tokens page of your own account, where each token has a revoke action. Sign in to Sentry with the right account. A revoked token stops working, so every tool using it needs a new one. 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 tokens are listed, and follow the Sentry documentation.
How LeakWatch detects it
Two rules cover this type. The first is called Sentry Org Token. It recognizes the sntrys_eyJpYXQiO start, which is the Base64 form of the beginning of the encoded object, then a body, a marker for the region URL field, a second body, optional padding, an underscore and a final block of exactly 43 Base64 characters, and it must be followed by a character that is not part of the token. A token lacking that structure, cut short, or without the marker is not reported. The second is called Sentry User Token. It recognizes sntryu_ followed by exactly 64 lowercase hexadecimal characters, which must be followed by a quote, a backtick, whitespace, a semicolon, an escaped newline or the end of the text. Uppercase hex or another length is not reported. Both are rated high severity.
LeakWatch can check whether a detected key is still active with a read-only request to Sentry. It never reads your data or spends your credits.
This type is checked live. Only sntryu_ user tokens are checked live: LeakWatch lists the organizations the token can see on sentry.io and keeps their slugs. sntrys_ organization tokens are not checked, because they are limited to one organization and to CI tasks, so that listing would say nothing reliable about them. Treat a detected organization token as live until you have revoked it.
FAQ
Is my Sentry DSN a secret?
No, not in the same sense. A DSN lets someone send events to a project and is embedded in front-end code by design. A leaked auth token is another matter and must be revoked.
Which is worse, an organization token or a user token?
It depends on the scopes. A user token carries the rights of one person, and an organization token those chosen for the organization. Read the scopes of the exposed one before judging.
Do I need to rotate source map uploads?
Rotate the token, then check that the uploaded source maps and releases are the ones you built. A stolen token could have replaced them.