question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] Browser pop up failed but no exception throws when Browser is no permission to run

See original GitHub issue

Logs and network traces Without logs or traces, it is unlikely that the team can investigate your issue. Capturing logs and network traces is described in Logging wiki.

Which version of MSAL.NET are you using?

MSAL 4.30.1

Platform

.NET Core

What authentication flow has the issue?

  • Desktop / Mobile
    • Interactive
    • Integrated Windows Authentication
    • Username Password
    • Device code flow (browserless)
  • Web app
    • Authorization code
    • On-Behalf-Of
  • Daemon app
    • Service to Service calls

Other?

  • Installed Firefox 91.0.1 (64-bit) on Ubuntu 20.04.2 LTS machine as default browser
  • Installed PowerShell 7.1.4 and Latest Az on PowerShell

Is this a new or existing app?

existing app

Repro

sudo pwsh
PowerShell 7.1.4
Copyright (c) Microsoft Corporation.

https://aka.ms/powershell
Type 'help' to get help.

PS /home/user> Connect-AzAccount          
DEBUG: Sought all Az modules and got latest version 6.3.0
DEBUG: 2:53:28 PM - ConnectAzureRmAccountCommand begin processing with ParameterSet 'UserWithSubscriptionId'.
DEBUG: 2:53:28 PM - Autosave setting from startup session: 'CurrentUser'
DEBUG: 2:53:28 PM - No autosave setting detected in environment variable 'AzContextAutoSave'. 
DEBUG: 2:53:28 PM - Using Autosave scope 'CurrentUser'

Then the whole process is blocked.

Expected behavior Pop up a website to login account or tell the reason why can’t pop up.

Actual behavior The whole process is blocked. PowerShell hangs with high CPU load. No popup is shown.

Possible solution

User installed browser as nonroot app. So when user used an elevated pwsh to call browser, this behavior is not allowed in this case. But MSAL didn’t catch this case. A pre-detection should be done or the error should be thrown out.

Additional context / logs / screenshots Add any other context about the problem here, such as logs and screenshots. Run another pop-up command provided this error: Running Firefox as root in a regular user’s session is not supported.

$ sudo pwsh
[sudo] password for user: 
PowerShell 7.1.4
Copyright (c) Microsoft Corporation.

https://aka.ms/powershell
Type 'help' to get help.

PS /home/user> Import-Module Az           
PS /home/user> Send-Feedback

Want to provide feedback about Azure PowerShell? Take a quick survey and let us know how we are doing: https://aka.ms/azpssurvey?Q_CHL=FEEDBACK. Do you want to open the link? (Y/N)

y

Running Firefox as root in a regular user's session is not supported.  ($XAUTHORITY is /run/user/1000/gdm/Xauthority which is owned by user.)
Running Firefox as root in a regular user's session is not supported.  ($XAUTHORITY is /run/user/1000/gdm/Xauthority which is owned by user.)
Running Firefox as root in a regular user's session is not supported.  ($XAUTHORITY is /run/user/1000/gdm/Xauthority which is owned by user.)
/usr/bin/xdg-open: 869: iceweasel: not found
/usr/bin/xdg-open: 869: seamonkey: not found
/usr/bin/xdg-open: 869: mozilla: not found
/usr/bin/xdg-open: 869: epiphany: not found
/usr/bin/xdg-open: 869: konqueror: not found
/usr/bin/xdg-open: 869: chromium: not found
/usr/bin/xdg-open: 869: chromium-browser: not found
/usr/bin/xdg-open: 869: google-chrome: not found
/usr/bin/xdg-open: 869: www-browser: not found
/usr/bin/xdg-open: 869: links2: not found
/usr/bin/xdg-open: 869: elinks: not found
/usr/bin/xdg-open: 869: links: not found
/usr/bin/xdg-open: 869: lynx: not found
/usr/bin/xdg-open: 869: w3m: not found
xdg-open: no method available for opening 'https://aka.ms/azpssurvey?Q_CHL=FEEDBACK'
PS /home/user>

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
SameerK-MSFTcommented, Oct 26, 2021

I tried on Ubuntu and could repro it after “sudo pwsh”.

1reaction
SameerK-MSFTcommented, Nov 4, 2021

Here is the possible solution discussed today: Prior to execution check the conditions and then conditionally launch the dialog. Instead of waiting for the response using polling mechanisms that consumes CPU, launch a socket and wait for the response. There should also be a timeout in this.

The priority is to reduce the CPU usage and allow timeouts.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix a 403 Forbidden Error on Your Site
The 403 Forbidden error means that your server is working, but you no longer have permission to view all or some of your...
Read more >
Handle pop-ups, permissions, and notifications
Learn how to manage pop-ups, permissions, and notifications in different browsers when running your Selenium tests on BrowserStack Automate.
Read more >
How can I detect if a browser is blocking a popup?
Occasionally, I've come across a webpage that tries to pop open a new window (for user input, or something important), but the popup...
Read more >
Troubleshoot permission and security issues - ASP.NET
This article describes how to troubleshoot common permissions and security-related issues in ASP.NET.
Read more >
Error 404: 4 Ways to Fix It
Error 404 is a response code, meaning the server could not locate the requested content. Check this article to learn 4 steps to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found