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

Replace classic PATs with fine-grained PATs #4315

Open
iaindillingham opened this issue Apr 30, 2024 · 0 comments
Open

Replace classic PATs with fine-grained PATs #4315

iaindillingham opened this issue Apr 30, 2024 · 0 comments

Comments

@iaindillingham
Copy link
Member

Classic PATs should be replaced with fine-grained PATs in both development and production environments. PATs provide the values of:

  • GITHUB_TOKEN (used by OpenSAFELY Jobs)
  • GITHUB_WRITEABLE_TOKEN (used by OpenSAFELY Interactive)

In both cases, replacing classic PATs means agreeing and documenting a name, expiration period, repository access, and permissions. (The permissions documentation suggests that fine-grained PATs can be used to access REST API endpoints; I believe they are used by ebmdatalab/metrics to access GraphQL endpoints, too.) There are two relevant sections in DEVELOPERS.md:

  • "Rotating the read only GitHub token"
  • "Rotating the OSI GitHub token"

In a change to the existing development setup, each developer should create their own fine-grained PAT. A fine-grained PAT should also be created by the opensafely-readonly user (credentials in Bitwarden), for use in production. PATs should no longer be stored in Bitwarden.

Although orthogonal to this issue, credentials for the development OAuth application should continue to be stored in Bitwarden. The purpose of this application should be documented in DEVELOPERS.md: it provides the values of SOCIAL_AUTH_GITHUB_KEY and SOCIAL_AUTH_GITHUB_SECRET.

Changing PATs and documenting the development OAuth application means that scripts/dev-env.sh can be removed.

GITHUB_TOKEN_TESTING

The value of GITHUB_TOKEN_TESTING, which is a classic PAT, should also be replaced with a fine-grained PAT. The value of this PAT is used by CI. See "Verified Fakes" in TESTING.md for more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant