Open gejohnston opened 1 year ago
Thank you for creating a bug report. We will investigate the bug and evaluate its impact on the product. If you haven't already, please ensure you have provided steps to reproduce the bug and as much context as possible.
A theory on the cause of this behavior is that when a user is prompted for credentials, those properties are added to the the IHandlerParameters.arguments that are passed to a command handler. For each normal zowe command, you start a new process and have a clean slate.
With the daemon, our process stays around. It is possible that the IHandlerParameters are not cleared out after a command is processed, so the next command already has the properties for user and password available. If so, it would explain why the daemon does not prompt again (it already has values for user and password). It also explains why no "bad cred mgr" errors are reported (since the command already has user and password, there is no reason to load the secure credential store).
None of this theory has been confirmed in the code. It simply explains the behavior that has been observed, so it is a good place to start troubleshooting the problem.
Describe the bug
When you have a bad credential manager, CLI commands are expected to fail. The CLI fails, but the daemon does not.
Expected and actual results
Establish a configuration like this:
The CLI displays a error upon startup. It prompts for credentials, but then fails when the operation is performed because we have an invalid credential manager. Note that the error message text below has been changed from our GA version, but the operational logic was not changed. All of the error information was also logged to the imperative log. Running the command multiple times gives the same result.
With daemon mode, the first command starts the daemon, encounters the BogusCredentialManager, logs a detailed error, displays a brief error, and does not perform the desired action. This is consistent with the plain CLI commands.
Additional daemon commands never prompt, log no errors, display no errors, and successfully run the command against the mainframe. It remembers the user and password, even though they were never stored in the Windows Credential Manager. This is inconsistent with the plain CLI.
After all of these commands, BogusCredentialManager remains in settings/imperative.json and no Zowe/secure_config_props entry exists in Windows Credential Manager.
Because the daemon hides the fact that you have a bad credential manager, it could lure a user into thinking that the credentials have been securely stored, even though they have not been stored. The next time the daemon is started this cycle repeats. The CLI will prompt for credentials the first time and fail, then not prompt on future commands, but run successfully.
This could be a source of confusion and lead the user to open misleading issues against Zowe CLI.
Describe your environment
O.S. PATH = C:\Program Files\PowerShell\7;C:\Program Files\ConEmu\ConEmu\Scripts;C:\Program Files\ConEmu;C:\Program Files\ConEmu\ConEmu;.\;c:\pkgs\cmds\winScr;c:\pkgs\cmds\workScr;c:\pkgs\cmds\bin;C:\ourstuff\records\Broadcom\zowe\cmds;C:\Program Files\PowerShell\7;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\pkgs\java\jdk\bin;C:\Program Files\JetBrains\IntelliJ IDEA 2019.2\bin;C:\Program Files\doxygen\bin;C:\pkgs\Ruby25-x64\bin;C:\ProgramData\chocolatey\bin;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Box\Box Edit\;C:\Program Files (x86)\Symantec\VIP Access Client\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\dotnet\;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Program Files (x86)\GitExtensions\;C:\Program Files\PowerShell\7\;C:\pkgs\cargo\bin;C:\Users\ej608771\AppData\Local\Microsoft\WindowsApps;C:\pkgs\nvm;C:\pkgs\nodejs
ZOWE_CLI_HOME = undefined Default = C:\Users\ej608771.zowe ZOWE_APP_LOG_LEVEL = undefined ZOWE_IMPERATIVE_LOGLEVEL = undefined No other 'ZOWE' variables have been set.
NPM information:
Zowe CLI configuration information:
Installed plugins:
Additional context