github / github/gh-gei

Validate scopes on target GitHub personal access tokens (PATs)

Open
#1,001 0 comments 1 reaction 0 assignees View on GitHub
task
Dominant language
C#
Stars
478
Forks
146
Avg merge
7d 21h
Merged PRs (30d)
2

Description

Before we start a migration, we should validate that the target personal access token (PAT) has the required scope(s) for the command being executed.

This can be checked by comparing the `X-OAuth-Scopes` header returned by the API against a known required list of scopes.

One good way to get the `X-OAuth-Scopes` header is to call the `GET /rate_limit` endpoint, because it doesn't use up any rate limit points 😉

There is documentation [here](https://docs.github.com/en/migrations/using-github-enterprise-importer/preparing-to-migrate-with-github-enterprise-importer/managing-access-for-github-enterprise-importer#required-scopes-for-personal-access-tokens) on what scopes you need for doing different things.

When implementing this, we should be aware that different commands in the CLI will require different scopes. We may wish to tackle the most important command(s) first - probably `migrate-repo`, and then tackle other commands in follow up issues.

Note that scopes are not _all_ that matters - you also need to have the relevant permissions on the organization, but that can be tackled separately.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.