Home: CLI installs should not install unlisted packages

Created on 2 Nov 2018  ·  17Comments  ·  Source: NuGet/Home

NuGet should not install unlisted packages unless the version number is specified. So the following commands should not add an unlisted nuget package:

dotnet add package <packageID>

nuget install <packageID>

Customer Sprint Quality Week Install Backlog 2 NuGet.exe dotnet.exe Bug

Most helpful comment

The dotnet.exe side will be fixed https://github.com/NuGet/NuGet.Client/pull/3480.

All 17 comments

Do either of these actually end up installing unlisted packages?

Didn’t check recently but I guess this issue was filed because back then these did :) do you see a different behavior now?

I was looking into related code and noticed a "possible" issue with this.

Looking at the code today, I'd expect them to have a different behavior, but I could be wrong.

Either way, this needs analyzed and fixed.

Confirming this behavior for 5.3.0.

@matkoch can you help us understand your scenario and how this bug is causing an issue? I am asking so that I can help identify a workaround while we schedule a fix.

Here's a helpful resource about what having an unlisted package currently means.

https://docs.microsoft.com/en-us/nuget/nuget-org/policies/deleting-packages

Focus on the following paragraphs from the linked page.

Unlisted packages don't appear on nuget.org or in the Visual Studio UI, and do not appear in search results. Unlisted packages, however, can still be downloaded and installed by using an exact version number, which supports package restore. In addition, unlisted packages may still be discovered in the following specific scenarios:

  • Package restore using floating versions (for example, 1.0.0-), if the latest available package matching the version or dependency constraints is an unlisted package.*
  • Replication of packages through the catalog (as the catalog also contains unlisted packages).
> /usr/local/bin/mono /Users/matt/.nuget/packages/nuget.commandline/5.3.0/tools/NuGet.exe install Nuke.Docker -OutputDirectory /Users/matt/code/nuke/repositories/nuke-build/web/.tmp/packages -ExcludeVersion -DependencyVersion Ignore -Verbosity detailed
NuGet Version: 5.3.0.6251
Feeds used:
  https://www.myget.org/F/nukebuild/api/v3/index.json
  https://www.myget.org/F/nukebuild/api/v3/index.json
  https://api.nuget.org/v3/index.json
  /Users/matt/.nuget/packages

Installing package 'Nuke.Docker' to '/Users/matt/code/nuke/repositories/nuke-build/web/.tmp/packages'.
  GET https://api.nuget.org/v3/registration3-gz-semver2/nuke.docker/index.json
  OK https://api.nuget.org/v3/registration3-gz-semver2/nuke.docker/index.json 765ms
  GET https://www.myget.org/F/nukebuild/api/v3/registration1/nuke.docker/index.json
  NotFound https://www.myget.org/F/nukebuild/api/v3/registration1/nuke.docker/index.json 274ms
  GET https://www.myget.org/F/nukebuild/api/v3/registration1/nuke.docker/index.json
  NotFound https://www.myget.org/F/nukebuild/api/v3/registration1/nuke.docker/index.json 212ms
  GET https://www.myget.org/F/nukebuild/api/v3/registration1/nuke.docker/index.json
  CACHE https://api.nuget.org/v3/registration3-gz-semver2/nuke.docker/index.json
  NotFound https://www.myget.org/F/nukebuild/api/v3/registration1/nuke.docker/index.json 55ms
  GET https://www.myget.org/F/nukebuild/api/v3/registration1/nuke.docker/index.json
  NotFound https://www.myget.org/F/nukebuild/api/v3/registration1/nuke.docker/index.json 51ms
Resolved actions to install package 'Nuke.Docker.1.0.0'
Retrieving package 'Nuke.Docker 1.0.0' from 'nuget.org'.
Adding package 'Nuke.Docker.1.0.0' to folder '/Users/matt/code/nuke/repositories/nuke-build/web/.tmp/packages'
Added package 'Nuke.Docker.1.0.0' to folder '/Users/matt/code/nuke/repositories/nuke-build/web/.tmp/packages'
Added package 'Nuke.Docker.1.0.0' to folder '/Users/matt/code/nuke/repositories/nuke-build/web/.tmp/packages' from source 'https://api.nuget.org/v3/index.json'
Successfully installed 'Nuke.Docker 1.0.0' to /Users/matt/code/nuke/repositories/nuke-build/web/.tmp/packages
Executing nuget actions took 177.25 ms

1.0.0 is unlisted. The latest listed package is 0.4.0.

So?

Is anyone checking this out? I’m sorry to say, but how is this still not fixed after being reported a year ago?

It was reported way longer ago in other issues. Even by jon skeet....

Matthias Koch notifications@github.com schrieb am So., 17. Nov. 2019,
18:48:

Is anyone checking this out? I’m sorry to say, but how is this still not
fixed after being reported a year ago?


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/NuGet/Home/issues/7466?email_source=notifications&email_token=AAAOANDZUYP3JBWTNEJAB6LQUF7WRA5CNFSM4GBQDFF2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEIRWXI#issuecomment-554769245,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAAOANBRPLXYK5XJTPQHN6LQUF7WRANCNFSM4GBQDFFQ
.

@karann-msft @nkolev92 did you have a chance to look into that?

@karann-msft @nkolev92 any news?

This is definitely still a problem when using dotnet add package. Any word on getting this fixed? One reason a package owner may unlist a package is due to security issues. Fixing this seems important from a security perspective.

The dotnet.exe side will be fixed https://github.com/NuGet/NuGet.Client/pull/3480.

👏🏽👏🏽👏🏽

@nkolev92 I was just testing nuget.exe and already found this to be the case.
Considering you closed a PR for dotnet.exe, can this Issue be closed?

Was this page helpful?
0 / 5 - 0 ratings