Skip to content
Databases & keys · Secret guide

Leaked Hygraph Permanent Auth Token: what to do in the first hour

Critical severityDetected onlyLast verified · 6 min read

A Hygraph permanent auth token, often called a PAT, is a long-lived credential for the Hygraph content API. Whoever holds it can read content from the project, and depending on the permissions granted to that token, can also create, change or publish entries. Unlike a short-lived session, it does not expire on its own, so a copy left in a repository or a build log stays useful to an attacker until someone deletes it. Revoke the token first, then work out what it was used for.

Check your GitHub account for leaked secrets — free

Provider
GraphCMS/Hygraph
Severity
Critical
Impact
SaaS account access and billing
Checked live by LeakWatch
No

What a Hygraph Permanent Auth Token looks like

Hygraph permanent auth tokens are JSON Web Tokens. They are made of three dot-separated parts, and each part is long, so a token is easy to spot in a file even when its text is not readable:

ey…XXXX.ey…XXXX.…XXXX   Hygraph permanent auth token (masked)

The first segment begins with ey, which is how every base64-encoded JSON header starts. That same pattern is shared by many JWTs from other services, so the shape alone does not prove the token belongs to Hygraph. What makes it a Hygraph credential is the place it was issued: the token sits in the project settings of one Hygraph project, and it is valid only for that project’s API endpoints.

A permanent auth token is not the same thing as a user login or a browser session. It is created on purpose for a machine, such as a deployment script, a static site build or an integration. Because it is meant to last, teams often store it in a .env file or a CI variable and forget about it. That long life is the main reason a leaked one is serious.

How Hygraph Permanent Auth Tokens get leaked

  • A committed environment file. A .env or config file that holds the token, pushed to a repository that was public at the time, or later shared with contractors who should not have it.
  • A frontend bundle. A token placed in client-side code, where anyone who loads the site can open the developer tools and copy it.
  • CI logs. A pipeline step that prints its environment, or a failed request that echoes its headers into the log.
  • Shared snippets. A sample query pasted into a forum post, a support thread or a gist, with the real token left in the authorization header.
  • Old branches and forks. The token was removed from the main branch, but it still lives in an older commit that is visible to everyone who can clone the repository.

What to do in the first hour

  1. Delete the token. Open the project settings, find the permanent auth token that leaked, and delete it. Deletion is final, so make sure you have identified the right token before you confirm. Remember that it can invalidate every JWT issued from it, so the systems that depend on it will stop working until they receive a new token.
  2. Create a replacement for the systems that still need access. Give each integration its own token, and scope it to the content and operations it actually uses rather than full access.
  3. Store the new value in your secret manager or CI variables. Do not put it back in a file in the repository, and do not place it in a variable that a front-end build will embed.
  4. Review what the token could do. Check the content changes and publishing history for the project in the period since the token may have been exposed. Look for entries you did not write, unexpected publishes, and deleted content.
  5. Check the other secrets that sat next to the token. A leaked .env often holds database credentials, a cloud key or a webhook secret. Rotate those too.
  6. Clean the code only after the rotation. Remove the value from the current files, and decide whether to rewrite history. A deleted commit still exists in every clone, so the revocation is the real fix. See I accidentally pushed an API key to GitHub.

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

Not sure what else leaked? Run a free scan.

Revoke it at Hygraph

Permanent auth tokens are managed in the project settings of your Hygraph project. Open the project settings, go to the access or API access area, and delete the token by name. Hygraph documents deletion as permanent and irreversible, so there is no undo: create the replacement first if a production system depends on the old token, and accept a short interruption if the leak is active. Also check that you are in the correct project, because each project has its own list of tokens. Hygraph’s API access documentation is a useful companion for the general access model. The exact menu labels in the current interface could not be confirmed for this guide, so follow what the settings page shows you.

How LeakWatch detects it

The rule is called “GraphCMS/Hygraph Permanent Auth Token”. It looks for a token of three long, dot-separated segments in which the first two segments begin with the characters ey and are very long, and the third segment is a long run of letters, digits, underscores and dashes. It has no keyword requirement of its own, so the shape of the value is what counts. A shorter JWT, or a token that does not match these lengths, is not reported by this rule. The severity is critical, with the impact class for SaaS data. This type is not checked live: LeakWatch does not send the token to Hygraph to see whether it still works.

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 a Hygraph token the same as a JWT from another service?

Not necessarily. The shape is a standard JWT, and many services use the same format. The token is a Hygraph credential only if it was issued from one of your Hygraph projects, so check the project settings to confirm before you decide which system to rotate.

Will deleting the token break my site?

Yes, for any system that still uses it. Deleting a permanent auth token also invalidates the JWTs issued from it. Create the replacement, deploy it, and confirm that a content read still works. If the leak is active, the short outage is worth it.

Should I rewrite the git history after rotating?

Only as an extra step. The old value stays valid until you delete it, and it stays in every existing clone after a rewrite. Rotate first, then decide whether a history cleanup is worth the cost for your team.

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

LeakWatch is not affiliated with GraphCMS/Hygraph.