Credentials from configured source used for a non-configured source when the URL is similar #3566
Open
6 tasks done
Labels
Milestone
Checklist
What You Are Seeing?
When performing package operations against a source, Chocolatey CLI may choose to use credentials stored against a different source.
What is Expected?
If credentials are not provided, Chocolatey CLI should not use credentials stored against a different source.
How Did You Get This To Happen?
Set-ExecutionPolicy Unrestricted Process -Force; irm https://ch0.co/go | iex
choco install nexus-repository nexushell --confirm
a. Log in to Nexus
Connect-NexusServer -Hostname LocalHost -Credential ([PSCredential]::new('admin', (Get-Content C:\ProgramData\sonatype-work\nexus3\admin.password | ConvertTo-SecureString -Force -AsPlainText)))
b. Create ChocolateyInternal NuGet repository
New-NexusRepository -Name ChocolateyInternal -Format nuget -Type hosted -DeploymentPolicy Allow
c. Create AdminOnly NuGet repository
New-NexusRepository -Name AdminOnly -Format nuget -Type hosted -DeploymentPolicy Allow
d. Push a package to the AdminOnly repository
$ApiKey = (Get-NexusNuGetApiKey -Credential ([PSCredential]::new('admin', (Get-Content C:\ProgramData\sonatype-work\nexus3\admin.password | ConvertTo-SecureString -Force -AsPlainText)))).apiKey; choco push $env:ChocolateyInstall\lib\nexus-repository\nexus-repository.nupkg --source http://localhost:8081/repository/adminOnly/ --api-key="$ApiKey"
e. Turn off anonymous access (last, because otherwise you can't push the package)
Set-NexusAnonymousAuth -Disabled
choco source add -n=ChocoInternal --source=http://localhost:8081/repository/ChocolateyInternal/ -U=admin -P="$(Get-Content C:\ProgramData\sonatype-work\nexus3\admin.password)"
choco search --source $AdminOnlyFeedUrl
, where the AdminOnlyFeedUrl is the URL of the AdminOnly repository on Nexus, without specifying credentials.choco search --source http://localhost:8081/repository/adminOnly/
At the end of the configuration, the server should be configured as follows:
System Details
Installed Packages
Output Log
Additional Context
The text was updated successfully, but these errors were encountered: