PSResourceGet icon indicating copy to clipboard operation
PSResourceGet copied to clipboard

Untrusted prompt at search time and not install time

Open SteveL-MSFT opened this issue 3 years ago • 0 comments

Prerequisites

  • [X] Write a descriptive title.
  • [X] Make sure you are able to repro it on the latest released version
  • [X] Search the existing issues.

Steps to reproduce

PS> Get-PSResourceRepository

Name               Uri                                                                        Trusted Priority
----               ---                                                                        ------- --------
NuGet              https://api.nuget.org/v3/index.json                                        False   15
PSGallery          https://www.powershellgallery.com/api/v2                                   False   50
PSTestGallery      https://www.poshtestgallery.com/api/v2                                     False   50

> Update-PSResource az.tools.predictor

In this case, it prompts before searching NuGet.org which should not happen. The cmdlet should find the module and at that time prompt (if needed based on trust) right before install. There should be no prompt for a repo that doesn't have the module and there should only be one prompt (unless the user chooses No)

Expected behavior

PS> update-psresource az.tools.predictor

Untrusted repository
You are installing the modules from an untrusted repository. If you trust this repository, change its Trusted value by running
the Set-PSResourceRepository cmdlet. Are you sure you want to install the PSresource from 'PSGallery' ?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): y

Actual behavior

PS> update-psresource az.tools.predictor

Untrusted repository
You are installing the modules from an untrusted repository. If you trust this repository, change its Trusted value by running
the Set-PSResourceRepository cmdlet. Are you sure you want to install the PSresource from 'NuGet' ?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): y

Untrusted repository
You are installing the modules from an untrusted repository. If you trust this repository, change its Trusted value by running
the Set-PSResourceRepository cmdlet. Are you sure you want to install the PSresource from 'PSGallery' ?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): y

Error details

No response

Environment data

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Binary     3.0.17     beta17     PowerShellGet                       {Find-PSResource, Get-PSResource, Get-PSResourceRepositor…


Name                           Value
----                           -----
PSVersion                      7.3.0-preview.7
PSEdition                      Core
GitCommitId                    7.3.0-preview.7
OS                             Darwin 21.6.0 Darwin Kernel Version 21.6.0: Wed Aug 10 14:28:35 PDT 2022; root:xnu-8020.141.5~2…
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visuals

No response

SteveL-MSFT avatar Sep 13 '22 14:09 SteveL-MSFT