Keeper-Security / Commander

Keeper Commander is a python-based CLI and SDK interface to the Keeper Security platform. Provides administrative controls, reporting, import/export and vault management.
https://www.keepersecurity.com/commander.html
MIT License
182 stars 74 forks source link

webbrowser.get() can hang and should be timeouted #1259

Open dg-nvm opened 1 week ago

dg-nvm commented 1 week ago

https://github.com/Keeper-Security/Commander/blob/fe9c026e600f6d60cc636e30ae1546436df18d03/keepercommander/auth/console_ui.py#L264C18-L264C28

webbrowser.get() under some circumstances (my case is WSL2 and wslu from Flox) can hang indefinetelly on xdg-settings:

xdg-settings get default-web-browser will just not return anything

This will render UI blank until interrupted with "ctrl+c", then normal keeper UI proceeds

There are multiple issues (e.g https://github.com/microsoft/WSL/issues/8892) touching the subject on the topic but I believe timeouting it will be easiest as there is an Exception catcher there anyway.

aaunario-keeper commented 23 hours ago

Thanks for shedding light on this issue. Upgrading to Commander v16.11.3 or higher should fix it.

dg-nvm commented 14 hours ago

I don't think this will fix it as https://github.com/Keeper-Security/Commander/commit/6d15bdbf3e44460c78f4da36faddaae0be27be8a as you will never go out from line 264

aaunario-keeper commented 4 hours ago

From my own testing, webbrowser.get() does not hang when xdg-open is not configured properly (i.e., is using the default WSL xdg settings), but does hang when wb.open_new_tab(url) is called. This change is intended to prevent the latter from happening if a mis-configuration is detected. If you have stack-trace evidence contrary to that, I'd be more than happy to see it.