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

for wslview: Browser authentication disabled if DISPLAY variable is not set #878

Closed
2 of 9 tasks
jolting opened this issue Sep 26, 2022 · 1 comment · Fixed by #1148
Closed
2 of 9 tasks

for wslview: Browser authentication disabled if DISPLAY variable is not set #878

jolting opened this issue Sep 26, 2022 · 1 comment · Fixed by #1148
Assignees
Labels
auth-issue An issue authenticating to a host gui Specific to graphical user interface controls platform:wsl Specific to Windows Subsystem for Linux

Comments

@jolting
Copy link

jolting commented Sep 26, 2022

wslview is supported
see here:
https://github.com/GitCredentialManager/git-credential-manager/blob/7c4381cb754538367a7d0b33ecf3550ca6b5fa79/src/shared/Core/BrowserUtils.cs#L43

wslview does not require a DISPLAY variable.

However, the posix session manager checks for the DISPLAY variable.
https://github.com/GitCredentialManager/git-credential-manager/blob/7c4381cb754538367a7d0b33ecf3550ca6b5fa79/src/shared/Core/Interop/Posix/PosixSessionManager.cs#L13

Therefore, the browser is disabled.
https://github.com/GitCredentialManager/git-credential-manager/blob/dea7cb1afdab43f3852dd897c58b52ae3b6722a3/src/shared/GitHub/GitHubAuthentication.cs#L70

Possibly broken in this commit.
28f487a

Suggestion:
Bypass the check if wslview is present.

workaround:
Set the display variable.

Which version of GCM are you using?

From a terminal, run git credential-manager-core --version and paste the output.
2.0.785.29792

Which Git host provider are you trying to connect to?

  • Azure DevOps
  • Azure DevOps Server (TFS/on-prem)
  • GitHub
  • GitHub Enterprise
  • Bitbucket
  • Other - please describe

Can you access the remote repository directly in the browser using the remote URL?

  • Yes
  • No, I get a permission error
  • No, for a different reason - please describe

Any private repo will work.


Expected behavior

Browser pops up when authenticating.

Actual behavior

Only show oauth device code login.

Logs

N/A

@jolting jolting added the auth-issue An issue authenticating to a host label Sep 26, 2022
@mjcheetham mjcheetham added platform:wsl Specific to Windows Subsystem for Linux gui Specific to graphical user interface controls labels Sep 26, 2022
mjcheetham added a commit that referenced this issue Mar 15, 2023
Today we're gating browser-based authentication mechanisms behind a
GUI-possible session, which isn't 100% correct. When inside of a WSL
session, without WSLg enabled, it is still possible to launch a web
browser in the hosting Windows session.

Split the determination between "GUI session" and "browser possible",
and add the special case for WSL inside an interactive Windows session.

Things are complicated here because it is possible to SSH in to the WSL
instance from outside of the Windows host, meaning the Windows session
also doesn't have UI. This case we still need to prevent browser-based
options.

In order to detect these cases we need to 'punch out' to the Windows
host and run a script/cmdlet to determine the session type.

Fixes #878
@mjcheetham
Copy link
Collaborator

With the merging of #1148 we now differentiate between GUI sessions inside/outside of WSL, and know if we can launch a browser via wslview etc more accurately.

The feature will be available in the next GCM release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auth-issue An issue authenticating to a host gui Specific to graphical user interface controls platform:wsl Specific to Windows Subsystem for Linux
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants