You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I originally filed this issue against the dotnet SDK dotnet/sdk#43063, but the bot asked me to post this here. I'm not sure how much visibility NuGet has into what packages are hoisted by the shared runtime, but the issue is as follows:
Describe the bug
If you add a PackageReference to a project pointing to a vulnerable package version, dotnet commands like restore, build, run, and list package --vulnerable --include-transitive will report inaccurate vulnerability warnings for packages that are hoisted to a newer, non-vulnerable version by the shared runtime.
In the case of transitive dependencies, you cannot avoid the issue by simply removing the PackageReference. Instead, developers are forced to directly reference the packages that are falsely reported as vulnerable to get rid of warnings. This is demonstrated by dotnet/aspnetcore#57560 which tries to update the ASP.NET Core project templates so they do not produce NuGet vulnerability warnings. We would rather not be forced to reference packages that are part of the shared runtime.
PS C:\dev\temp\NuGetVulnerabilityFalsePositive\NuGetVulnerabilityFalsePositive> dotnet run
C:\dev\temp\NuGetVulnerabilityFalsePositive\NuGetVulnerabilityFalsePositive\NuGetVulnerabilityFalsePositive.csproj : wa
rning NU1903: Package 'System.Text.Json' 8.0.3 has a known high severity vulnerability, https://github.com/advisories/G
HSA-hh2w-p6rv-4g7w
C:\dev\temp\NuGetVulnerabilityFalsePositive\NuGetVulnerabilityFalsePositive\NuGetVulnerabilityFalsePositive.csproj : wa
rning NU1903: Package 'System.Text.Json' 8.0.3 has a known high severity vulnerability, https://github.com/advisories/G
HSA-hh2w-p6rv-4g7w
{"systemTextJsonPath":"C:\\Program Files\\dotnet\\shared\\Microsoft.NETCore.App\\8.0.8\\System.Text.Json.dll"}
@Tragetaschen commented on the original issue pointing out the following.
I can see a myriad of warnings in our codebase, but not with 8.0.401, only with the preview bits. Basically everywhere
…csproj : warning NU1903: Package 'System.Formats.Asn1' 8.0.0 has a known high severity vulnerability, https://github.com/advisories/GHSA-447r-wph3-92pm
…csproj : warning NU1903: Package 'System.Text.Json' 8.0.0 has a known high severity vulnerability, https://github.com/advisories/GHSA-hh2w-p6rv-4g7w
Those packages are not referenced explicitly and we are building for 8.0.8.
Neither 8.0.401 nor 9.0.100-… show a vulnerability when running dotnet list package --include-transitive --vulnerable
As you can see from my repro above, this bug does present itself even with 8.0.401 SDK specified in the global.json. The host version is 9.0.100-preview.7.24407.12, so that might have something to do with it.
I almost pointed to dotnet/runtime#106172 being related, because that is proximate cause for the System.Text.Json warning to show up in the RC1 ASP.NET Core project templates but not the preview7 one, but RC1 hasn't been released yet unless you're using https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet9/nuget/v3/index.json as a package feed. So, I think this regression probably does have something to do with the host version.
The text was updated successfully, but these errors were encountered:
After finding some better search terms (basically looking for anything referencing "dotnet list package --vulnerable"), I found the following related issues:
I originally filed this issue against the dotnet SDK dotnet/sdk#43063, but the bot asked me to post this here. I'm not sure how much visibility NuGet has into what packages are hoisted by the shared runtime, but the issue is as follows:
Describe the bug
If you add a PackageReference to a project pointing to a vulnerable package version,
dotnet
commands likerestore
,build
,run
, andlist package --vulnerable --include-transitive
will report inaccurate vulnerability warnings for packages that are hoisted to a newer, non-vulnerable version by the shared runtime.In my repro project at https://github.com/halter73/NuGetVulnerabilityFalsePositive, I demonstrate this with a direct PackageReference to System.Text.Json 8.0.3, but the problem persists for transitive references which is harder to work around.
In the case of transitive dependencies, you cannot avoid the issue by simply removing the PackageReference. Instead, developers are forced to directly reference the packages that are falsely reported as vulnerable to get rid of warnings. This is demonstrated by dotnet/aspnetcore#57560 which tries to update the ASP.NET Core project templates so they do not produce NuGet vulnerability warnings. We would rather not be forced to reference packages that are part of the shared runtime.
To Reproduce
dotnet build
Exceptions (if any)
Further technical details
dotnet --info (expand for details)
VS Version: 17.12.0 Preview 2.0 [35227.331.main]
@Tragetaschen commented on the original issue pointing out the following.
As you can see from my repro above, this bug does present itself even with 8.0.401 SDK specified in the global.json. The host version is 9.0.100-preview.7.24407.12, so that might have something to do with it.
I almost pointed to dotnet/runtime#106172 being related, because that is proximate cause for the System.Text.Json warning to show up in the RC1 ASP.NET Core project templates but not the preview7 one, but RC1 hasn't been released yet unless you're using https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet9/nuget/v3/index.json as a package feed. So, I think this regression probably does have something to do with the host version.
The text was updated successfully, but these errors were encountered: