ThisCalculator

Everyday

Revoke and Rotate GitHub Copilot and AI Coding Tokens

Updated · Standard formula, shown below

Revoke and Rotate GitHub Copilot and AI Coding Tokens

If a GitHub, Copilot, Cursor, or other coding-tool token may have been exposed, revoke it first, then create a replacement only where needed. This guide covers the usual places tokens live, how to replace them safely, and how to check that old credentials no longer work. Menu labels and token options can change, so use the provider’s current settings and documentation when they differ.

What You’ll Need

  • Access to the accounts that issued the credentials, such as GitHub or the AI coding service.
  • Access to the repositories, editor settings, CI workflows, deployment systems, and secret stores that use those credentials.
  • A secure place to store replacement secrets, such as your organization’s approved password manager or secrets manager.
  • If the token was exposed, a way to review relevant account activity and notify the appropriate administrator or security contact.

Step-by-Step

  1. Identify what may be exposed. Note the provider, token name or type, when and where it was used, and the systems that may depend on it. Do not paste a suspected secret into a ticket, chat, or online checker. Treat a token as compromised if it was committed to a repository, shared in a message, included in a log, or stored on a device or account you do not control. If you cannot identify the token, inventory relevant accounts and integrations.
  2. Contain immediate risk. For a publicly exposed or actively misused credential, revoke it promptly rather than waiting until you have mapped every dependency. Sign in through the provider’s official site, open account settings, and locate the section for access tokens, applications, or security. Revoke the specific credential. If you cannot tell which credential was exposed, revoke likely candidates and investigate integrations afterward. Do not assume deleting a local copy disables the credential.
  3. Revoke GitHub credentials at GitHub. In GitHub, open your profile menu and choose Settings. Review Developer settings for personal access tokens and authorized OAuth apps or GitHub Apps. Revoke the affected personal access token under the appropriate token section, or remove an authorization you no longer trust. Classic and fine-grained personal access tokens are managed separately; check both if the token type is unclear. For organization-owned credentials, ask an organization owner to review organization settings and audit activity. Revoking an app authorization can affect more than one integration, so check its name and access before removing it.
  4. Revoke credentials issued by other coding tools. In Cursor or another editor or AI coding service, open the service’s account or security settings and look for API keys, connected applications, sessions, or integrations. Revoke the relevant key or disconnect the integration. If the tool uses a key from an underlying model provider, revoke it at that provider too; removing a key from the editor alone may not invalidate it. If there is no self-service control, use the provider’s official support or administrator process.
  5. Check every place the old token was used. Search your approved secret stores, CI/CD settings, repository and organization secrets, deployment platforms, local environment files, editor settings, and scripts. Check shared or team-owned systems with their administrators. Remove the old value from active configuration and replace it in each dependent system. Search for the token carefully without copying it into unapproved tools. Deleting it from a file or commit does not erase copies in logs, forks, caches, or backups; revocation is the essential control.
  6. Create a replacement only if needed. Use the provider’s official settings to generate a new credential. Prefer a short expiration and the narrowest permissions that support the required task. Avoid broad account-wide scopes if a repository- or organization-limited option is available. Give it a clear purpose and owner, and do not reuse one token across unrelated tools or people. If the service supports short-lived or managed credentials, consider those instead of a long-lived personal token.
  7. Store and deploy the replacement securely. Put the new value directly into an approved secret manager or the relevant platform’s secret settings. Update each integration, then remove the value from temporary notes, shell history, downloads, and local configuration that should not contain secrets. Never put a token in source code, a URL, a screenshot, or a command that may be saved in shell history. Keep the new credential private even during testing.
  8. Verify access and monitor. Test the required workflow using the new credential, and confirm that unrelated access still works. Then verify through the provider’s available token or audit view that the old credential is revoked; do not test it by publishing or sharing it. Review recent sign-ins, token activity, repository changes, and automation runs for unexpected use. If you find suspicious activity, preserve relevant details and contact the provider or your organization’s security team.

Common Mistakes

  • Deleting a token locally instead of revoking it: A copied credential may remain usable until its issuer disables it.
  • Rotating without updating every dependency: Forgotten CI jobs, deployments, or editor integrations can fail later. Inventory consumers before and after replacement.
  • Assuming all credentials are GitHub tokens: A coding tool may store its own login, an OAuth authorization, or a key issued by a separate model provider. Revoke the credential at its issuer.
  • Creating a replacement with excessive access: Match permissions to the specific task and use an expiration where possible.
  • Leaving the exposed value in history: Removing a committed secret from the latest file does not remove old repository history or other copies. Revoke first, then follow your organization’s cleanup process.

Tips

  • Keep a simple inventory of each credential’s owner, purpose, issuer, expiry, and systems that consume it. Do not record the secret value in that inventory.
  • Use separate credentials for development, automation, and production where practical, so one rotation has a limited impact.
  • Set calendar reminders or use available expiration controls to review credentials before they become stale.
  • For team or company accounts, coordinate changes with the service owner. Tell affected users about planned replacement, but never send them the token itself.
  • After an accidental public disclosure, treat the credential as compromised even if it was visible briefly or the repository was later made private.

Troubleshooting

The token settings are missing: Confirm you are signed in to the account that issued the token. GitHub personal access tokens are under Developer settings, while organization or app credentials may be managed by an owner or app administrator. For another tool, check its official help pages or ask its administrator.

A workflow fails after rotation: Check that the new secret was saved under the exact name the workflow expects, that it is available in the correct repository or environment, and that its permissions cover the operation. Review the system’s logs without printing secret values. Update any other consumers that still reference the revoked token.

The old credential still appears in a file or log: Do not treat cleanup as a substitute for revocation. Confirm the issuer has disabled it, then remove or restrict the exposed copy using the repository, logging, or platform’s established process. Ask an administrator for help with shared logs, forks, or backups.

You cannot revoke it or suspect account access: Secure the issuing account using its official recovery and security controls, review active sessions and connected apps, and contact the provider or your organization’s security team. Do not create more credentials until you understand who can access the account.

Frequently Asked Questions

Does revoking a token sign me out of GitHub Copilot or Cursor?
It depends on how the tool authenticates. Revoking an API key can stop requests that use that key, while a separate account session or OAuth authorization may remain active. Revoke the relevant credential and session or authorization separately if needed.

Should I rotate a token if it was only shared privately?
If it was sent to the wrong person, posted in a channel with uncertain access, or stored somewhere unapproved, revoke it and issue a replacement. If it was shared through an approved secret-sharing process with the intended recipient, follow your organization’s policy.

Can I recover a revoked token?
Usually, a revoked credential cannot be re-enabled. Create a new one with the required permissions and update its consumers.

Will deleting a leaked commit make the token safe?
No. Copies may remain in history, forks, caches, or logs. Revoke the token first, then clean up exposed content as appropriate.

How often should I rotate coding-tool tokens?
Follow the provider and organization’s requirements. Use expiration and rotation policies where available, and rotate immediately after suspected exposure, unwanted access, or an ownership change.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.