-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[GitLab] Token provided by GCM for gitlab.com does not work for Source Link request. #669
Comments
I was able to confirm that adding |
Mentioning @hickford for comment. |
Do Source Link users know they're using Git indirectly? As a Git user, a request from GCM for ever-so-slightly broader than necessary permissions wouldn't bother me. Source Link users however might be confused to read "an application called Git Credential Manager is requesting access to your account" when using Source Link. @chuckries Can you work around the issue by creating a 'Source Link' application with broader scope at https://gitlab.com/-/profile/applications and configuring GCM following https://github.com/GitCredentialManager/git-credential-manager/blob/main/docs/gitlab.md ? It might also be necessary to expand GitLabOAuthScopes according to a new config variable. https://docs.gitlab.com/ee/integration/oauth_provider.html#authorized-applications
|
According to my researches regarding using sourcelink to gitlab from VS debugger following issues persist:
At this point of my research I think what needs to be done to allow sourcelink working with gitlab would be to allow OAuth application an access right to Best way to get sourcelink debugging nowadays seems to be the workarounds with
|
We're going to plan to add the |
@ldennington thanks for the info. from what I recall from looking at this, the issue for source link is that the The read access to the Repository Files API is what would be needed for Source Link. If you are saying that this line will be amended to include both scopes in tokens obtained through GCM, then I believe this should work for source link. |
@ldennington @chuckries
I admit, the blackbox for me is sourcelink itself. I do not now, what excactly it does.
it will work. Otherwise support has to come from gitlab offering access to the raw file url via What I can say for sure is, it did not work in my tests, when I granted myself also the Sample Repository Files API result: {
"file_name": "Dummy.cs",
"file_path": "src/Project//Dummy.cs",
"size": 1234,
"encoding": "base64",
"content": "IyA9PSBTY2hlbWEgSW5mb3...",
"content_sha256": "4c294617b60715c1d218e61164a3abd4808a4284cbc30e6728a01ad9aada4481",
"ref": "main",
"blob_id": "79f7bbd25901e8334750839545a9bd021f0e4c83",
"commit_id": "d5a3ff139356ce33e37e73add446f16869741b50",
"last_commit_id": "e4dd6ade0d14b620d8e30eff993909049ad8bfae",
"execute_filemode": false
} Source Link Prefix Mapping in PDB: {
"documents":
{
"D:\\Project\\SymbolPackage\\*":"http://gitlab/ABC/SymbolPackage/-/raw/e4dd6ade0d14b620d8e30eff993909049ad8bfae/*"
}
} |
@Bene81 you are correct that adjusting the scope is not the only fix required for Source Link to work with private gitlab.com repos, but it is a necessary piece. It is also the piece that I can't change; I can make the necessary changes in VS Source Link.
Once the correct authentication is available, I intend to:
|
@chuckries |
@chuckries I'm unable to mention you in the PR for some reason, but wanted to give you a heads up that it is open! |
GCM for GitLab uses the
repository_write
scope for its tokens. This provides read/write access for Git over HTTP operations but does not provide repository read operations via the GitLab API. This means that GCM does not provide tokens that can be used to authenticate Source Link requests.This isn't a bug, per se, as GCM is using the correct scope for pure git.exe operations. This is its intended purpose. It is, however, a missed opportunity. Visual Studio leverages GCM to authenticate Source Link requests, and expanding the scope used could allow Visual Studio to use Source Link for private gitlab.com repos, which has been a gap for several releases.
A more in depth write up can be found here: dotnet/sourcelink#281 (comment)
I am hoping somebody from GCM or GitLab can speak to this. My testing of GCM token's against GitLab API requests makes me believe that the scope is the issue, but I'm not 100% sure.
Thanks!
The text was updated successfully, but these errors were encountered: