Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dotnet list package --vulnerable, --deprecated, --outdated does not work for transitive-only positives #10767

Closed
watfordgnf opened this issue Apr 13, 2021 · 11 comments
Labels
Functionality:ListPackage dotnet.exe list package Priority:2 Issues for the current backlog. Product:dotnet.exe Type:Bug

Comments

@watfordgnf
Copy link

Details about Problem

It appears that vulnerable package listing does not work, even if it shows up on the NuGet website. I used the example found in https://devblogs.microsoft.com/nuget/how-to-scan-nuget-packages-for-security-vulnerabilities/ and could not recreate the experience.

NuGet product used (NuGet.exe | Visual Studio | MSBuild.exe | dotnet.exe): dotnet.exe

Product version:

PS E:\scratch\ConsoleApp1\> dotnet --info
.NET SDK (reflecting any global.json):
 Version:   5.0.202
 Commit:    db7cc87d51

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.18363
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\5.0.202\

Host (useful for support):
  Version: 5.0.5
  Commit:  2f740adc14
...

Worked before? If so, with which NuGet version: Not sure.

Repro steps and/or sample project

Add Microsoft.OData.Services.Client 5.2.0 (as seen in the Microsoft example), which has known vulnerabilities in a dependent package (Microsoft.Data.OData) listed on the NuGet.org homepage:

PS E:\scratch\ConsoleApp1> dotnet list package --include-transitive
Project 'ConsoleApp1' has the following package references
   [net472]:
   Top-level Package                     Requested   Resolved
   > Microsoft.Data.Services.Client      5.2.0       5.2.0

   Transitive Package          Resolved
   > Microsoft.Data.Edm        5.2.0
   > Microsoft.Data.OData      5.2.0
   > System.Spatial            5.2.0

PS E:\scratch\ConsoleApp1> dotnet list package --vulnerable

The following sources were used:
   https://api.nuget.org/v3/index.json
   C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\

The given project `ConsoleApp1` has no vulnerable packages given the current sources.
PS E:\scratch\ConsoleApp1> dotnet list package --vulnerable --include-transitive

The following sources were used:
   https://api.nuget.org/v3/index.json
   C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\

The given project `ConsoleApp1` has no vulnerable packages given the current sources.

image
image

@watfordgnf
Copy link
Author

Related: see dotnet/runtime#49377 and dotnet/runtime#50914

@JonDouglas
Copy link
Contributor

Microsoft.Data.OData is a transitive package in this scenario & currently will not be reported as vulnerable in the current v1 experience. This is something we are working on adding in a future iteration once we support transitive packages throughout more tools:

https://github.com/NuGet/Home/blob/dev/proposed/2020/Transitive-Dependencies.md

If it is promoted to a top-level package, it will be reported.

/cc @drewgillies

@watfordgnf
Copy link
Author

That's a bit confusing given the examples listed:
image

@JonDouglas
Copy link
Contributor

Sorry that is confusing. I'll defer to @drewgillies on the behavior of "transitive" packages that support old TFMs like net40 & sl4. Ideally it should work similar to the behavior as .NET Core packages (the screenshots shown w/ UmbracoForms).

@drewgillies
Copy link
Contributor

@watfordgnf I'm able to reproduce this bug. I'm investigating now to see whether there is a workaround (and what indeed is broken).

@drewgillies
Copy link
Contributor

drewgillies commented Apr 14, 2021

@watfordgnf @JonDouglas this is definitely a bug, a long standing one which has historically also affected the --deprecated and --outdated reports when only transitive dependencies are "positives". Thank you for making us aware of it, @watfordgnf, and you can track the fix by following the above PR. You'll note that there's also now test coverage for these cases. Regrettably there is no workaround.

@watfordgnf
Copy link
Author

Thank you for figuring this out!

@nkolev92 nkolev92 added Functionality:ListPackage dotnet.exe list package Priority:2 Issues for the current backlog. Product:dotnet.exe Type:Bug labels Apr 14, 2021
@nkolev92 nkolev92 added this to the Sprint 2021-04 milestone Apr 14, 2021
@drewgillies drewgillies changed the title dotnet list package --vulnerable does not work dotnet list package --vulnerable, --deprecated, --outdated does not work for transitive-only positives Apr 14, 2021
@drewgillies drewgillies removed their assignment Apr 16, 2021
@zkat zkat assigned dominoFire and unassigned aortiz-msft Apr 26, 2021
@aortiz-msft aortiz-msft reopened this Jun 16, 2021
@aortiz-msft
Copy link
Contributor

Hi @drewgillies - The issue still reproduces after the fix. Would you please take a look?

@aortiz-msft
Copy link
Contributor

Hi @drewgillies - We are trying to understand if there's any work left here.

@aortiz-msft aortiz-msft removed this from the Sprint 2021-11 milestone Nov 2, 2021
@nkolev92
Copy link
Member

nkolev92 commented Nov 4, 2021

@v-luzh

Can you please check if this issue reproes with the latest 6.0.1xx SDK?

We expect that it is fixed.

@v-luzh
Copy link

v-luzh commented Nov 8, 2021

@nkolev92 It is fixed on Main\31907.30 with the .NET SDK 6.0.100 for listing the transitive vulnerable package as below.
image
dotnet list package --deprecated --include-transitive and dotnet list package --outdated --include-transitive can show the deprecated/outdated transitive packages correctly, too.

@v-luzh v-luzh removed their assignment Nov 8, 2021
@nkolev92 nkolev92 closed this as completed Nov 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Functionality:ListPackage dotnet.exe list package Priority:2 Issues for the current backlog. Product:dotnet.exe Type:Bug
Projects
None yet
Development

No branches or pull requests

8 participants