Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test: GitHub token revocation #188544

Closed
3 tasks done
TylerLeonhardt opened this issue Jul 21, 2023 · 0 comments
Closed
3 tasks done

Test: GitHub token revocation #188544

TylerLeonhardt opened this issue Jul 21, 2023 · 0 comments

Comments

@TylerLeonhardt
Copy link
Member

TylerLeonhardt commented Jul 21, 2023

Refs: #152055

Complexity: 3

Create Issue


When the user signs out of their GitHub account in VS Code, the tokens tied to this account use to only be deleted from the keyring. They were, however, still valid tokens and thus could still be used to make requests.

This iteration we now call out to GitHub's API to delete these tokens on the server side so that they can no longer work.

To test this, do the following:

  1. Download my VS Code extension called Fugio that makes it easy to mint tokens
  2. Run: Fugio: Mint Token and choose github (or github-enterprise) and then put in user as the scope
  3. Copy the token and paste it into the following PowerShell script:
$myToken = "PASTE TOKEN HERE"
$githubBase = 'github.com'

try {
	Invoke-RestMethod -Uri "https://api.$githubBase/user" -Headers @{ "Authorization" = "Token $myToken" }
	Write-Output "Token is valid"
} catch {
	$_
	Write-Output "Token is invalid"
}

@alexr00 you will put your GHE base url instead of github.com

  1. Run the script an ensure it returns Token is valid
  2. Now sign out of this account in VS Code
  3. Run the script a 2nd time... this time it should return Token is invalid

Btw, this is a best effort operation because that is just the nature of the beast of this needing to run on the client's machine... but at least we are doing something now, rather than nothing at all.

@TylerLeonhardt TylerLeonhardt added this to the July 2023 milestone Jul 21, 2023
@alexr00 alexr00 removed their assignment Jul 25, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Sep 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants