Skip to content
Databases & keys · Secret guide

Leaked Upstash Redis REST Token: what to do in the first hour

High severityDetected onlyLast verified · 5 min read

An Upstash Redis REST token is the bearer credential that lets an application read and write a Redis database through Upstash’s HTTP interface. Redis often holds session data, cached user information, rate-limit counters and queues, so whoever holds the token can read that data and change it. Because the REST interface works over ordinary web requests, the token can be used from anywhere, without any special network access. Treat a leaked token as access to the whole database, and reset the credentials before you look at the data.

Check your GitHub account for leaked secrets — free

Provider
Upstash
Severity
High
Impact
Cloud infrastructure access
Checked live by LeakWatch
No

What an Upstash Redis REST token looks like

The REST token is a long string of letters and digits, usually between 32 and 48 characters, and in some databases it begins with a fixed label. It is shown in the database details page of the Upstash console, next to the REST URL. The URL is not secret, but the token is:

UPSTASH_REDIS_REST_TOKEN=<token, masked as XXXX…>
UPSTASH_REDIS_REST_URL=https://<database>.upstash.io   (not secret)

A database usually has two REST tokens: a standard token with read and write access, and a read-only token. Both are tied to the database password, so a password change affects both. The token is normally found in an environment file, a hosting provider’s settings or a script, next to the REST URL.

How Upstash REST tokens get leaked

  • Environment files. A .env file that holds the URL and token together, committed to a repository.
  • Front-end code. A token placed in a browser application or a mobile app, where anyone can read it. A REST token must be used only from a server.
  • Deployment settings copied between projects. A variable pasted from one hosting project into another, or into a shared document.
  • CI and build logs. A build that prints its environment, or a verbose client that logs the request headers.
  • Shared examples. A snippet posted in a tutorial, a forum or a support thread with the real token left in place of the placeholder.

What to do in the first hour

  1. Reset the database credentials. Open the database in the Upstash console and reset its password. A third-party guide says that a password reset revokes both the standard and the read-only REST token, although we could not confirm this in Upstash’s own documentation. Do this before you clean the repository. Confirm the behaviour in the console, because we could not verify it from Upstash’s own pages during this review.
  2. Update every client. Put the new token and the new password into your secret store, then redeploy each application that uses the database. Until they are updated, they will fail to connect, so plan the change window.
  3. Review the data. Look at the keys that changed recently, especially session keys, configuration keys and queues. Look for values you did not write, for keys that were deleted, and for new keys with unusual names.
  4. Check the usage. Review the request history for the database in the console, for the period since the token may have been exposed. Look for bursts of reads, for commands that change data and for requests from places you do not recognize.
  5. Check the other secrets in the same file. Caching and queue setups often sit alongside database connection strings and hosting tokens, so rotate those as well.
  6. Clean the repository after the rotation: remove the value from the files, add the file to .gitignore and decide whether to rewrite history. The order of steps is in I accidentally pushed an API key to GitHub.

Not sure what else leaked? Run a free scan.

Not sure what else leaked? Run a free scan.

Revoke it at Upstash

Open the account settings for your Upstash database, and use the password reset option in the database details. Resetting the password is the step that changes the credentials, and the REST token follows it. Upstash also documents an access-control approach for the Redis protocol, in which user-specific REST tokens can be created with the ACL commands. That approach suits a team that wants separate credentials for each service, and it is worth considering after the immediate rotation. We did not confirm the exact console labels during this review, so check them when you act.

How LeakWatch detects it

The rule is called Upstash Redis REST Token. It looks for the word upstash followed, within a short distance, by a label such as a variable name, a separator and a value of between 32 and 48 letters or digits. A value that begins with a fixed marker and is followed by a longer run of letters, digits and symbols is also matched. The REST URL on its own is not a secret and is not reported. The word upstash must sit close to the value, so a random string under another name is not matched. The severity is high, with the impact class for infrastructure and cloud services. This type is not checked live: LeakWatch does not try the token against Upstash.

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 REST URL a secret?

No. The URL identifies the database, and it is shown in the console without concealment. The token is the part that grants access, so protect it and leave the URL in configuration if you like.

Will resetting the password break my app?

Yes, until the app is updated. Every client that uses the old token or the old password will fail, so reset the credentials and update the clients in the same window.

Should I use the read-only token where possible?

Yes. A read-only token limits the damage a leak can do, so use it for services that only read. Keep the full-access token for the few services that write, and store it separately.

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

LeakWatch is not affiliated with Upstash.