Skip to content

[Bug] Interactivity switch incorrect for Linux #5246

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

Open
abbottdev opened this issue Apr 22, 2025 · 0 comments
Open

[Bug] Interactivity switch incorrect for Linux #5246

abbottdev opened this issue Apr 22, 2025 · 0 comments
Labels
needs attention Delete label after triage public-client untriaged Do not delete. Needed for Automation

Comments

@abbottdev
Copy link

abbottdev commented Apr 22, 2025

Library version used

MSAL 4.64.0

.NET version

.NET 9.0

Scenario

PublicClient - desktop app

Is this a new or an existing app?

The app is in production, I haven't upgraded MSAL, but started seeing this issue

Issue description and reproduction steps

I'm trying to use the Microsoft Artifact credential provider for nuget here: https://github.com/microsoft/artifacts-credprovider

The credential provider invokes MSAL under the hood. For vscode remote SSH sessions - vscode exposes the $BROWSER env var which is an .sh script which invokes the default browser on the default host.

If xdg-open is also installed, then the interactivity (open-able) browser state is true. Currently the check in MSAL for linux checks whether $DISPLAY is defined - which it is not for vscode SSH sessions, but $BROWSER is.

I believe the code lines here:

        private static bool IsInteractiveSessionLinux()
        {
            return !string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("DISPLAY"));
        }

https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/blob/c892032762192dcbd23f14936f7852ff6da26b21/src/client/Microsoft.Identity.Client/PlatformsCommon/Shared/DesktopOsHelper.cs#L201C13-L201C94

Should be changed to check whether $BROWSER is defined OR $DISPLAY is defined IMO.

I have validated this works by setting $DISPLAY to false and vscode's remote SSH session launches an interactive browser session on my host PC. This would be a really nice feature to get worked into both the vscode repo and the azure artifacts flow.

Relevant code snippets

https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/blob/c892032762192dcbd23f14936f7852ff6da26b21/src/client/Microsoft.Identity.Client/PlatformsCommon/Shared/DesktopOsHelper.cs#L201C13-L201C94

Expected behavior

Opens a browser natively on the user's machine when the Remote-SSH vscode host has $BROWSER is defined.

Identity provider

Microsoft Entra ID (Work and School accounts and Personal Microsoft accounts)

Regression

No response

Solution and workarounds

As above, set $DISPLAY to a non nullish value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs attention Delete label after triage public-client untriaged Do not delete. Needed for Automation
Projects
None yet
Development

No branches or pull requests

1 participant