Add read_repository
GitLab OAuth Scope
#719
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
Add
read_repository
to supported OAuth Scopes for GitLab. Becauseread_repository
grants permissions to read files on private projects using the Repository Files API, it will enable Visual Studio to use Source Link to download files from private GitLab repositories 🎉. The Git Credential Manager GitLab OAuth Application has also been updated with theread_repository
scope to work with this change.🚨 Important Notes 🚨
In order to use the new
read_repository
scope, users will need to do the following with existing OAuth apps for their instances:read_repository
scope.Additionally, although
read_repository
works for the API required by source link, our testing did uncover that there are certain APIs (listing a repository tree, for example) that require additional scopes (in this case,read_api
). These scopes may also need to be added in the future.Testing
I did the following to test these changes:
write_repository
andread_repository
scopes.GitLabDevClientId
andGitLabDevClientSecret
in my global Git config with the test Application ID and Secret.read_repository
locally and build and install GCM with this new scope.curl "https://gitlab.com/api/v4/projects/36617582/repository/files/README.md/raw?access_token=<COPIED TOKEN>"
README.md
were printed to my terminal.Fixes #669