chocolatey / chocolatey-licensed-issues

Issues for Licensed Editions of Chocolatey
19 stars 13 forks source link

Error messages displayed when a command is not permitted through Background Agent should be clearer #337

Open sync-by-unito[bot] opened 1 year ago

sync-by-unito[bot] commented 1 year ago

When using backgroundServiceAllowedCommands the error message displayed is technical in nature related to unable to access config settings etc. (Screenshot in linked ticket).

We should look to enhance the message to be simpler and clearer. Something like:

The running of command 'source' is blocked by your administrator.

Repro:

  1. Configure Chocolatey Agent for background mode:
      choco upgrade chocolatey-agent -y
      choco feature disable --name="'showNonElevatedWarnings'"
      choco feature enable --name="'useBackgroundService'"
      choco feature enable --name="'useBackgroundServiceWithNonAdministratorsOnly'"
      choco config set --name backgroundServiceAllowedCommands --value "install,upgrade,uninstall"
      choco feature enable --name="'allowBackgroundServiceUninstallsFromUserInstallsOnly'"
  2. Create a standard user account : New-LocalUser bob -Password ('P@ssw0rd!' | ConvertTo-SecureString -AsPlainText -Force) ; Add-LocalGroupMember -Group Users -Member bob
  3. Attempt as the non-admin user to run a command that's not in the allow list : choco source add -n Test -s C:\temp --allow-self-service

You should see the following error:

image

References

Zendesk

┆Issue is synchronized with this Gitlab issue by Unito