dotnet / dotnet/msbuild

[Bug]: How msbuild tasks should handle CVE-2024-38095?

Open
#10,656 7 comments 0 reactions 1 assignee Claimed by @rainersigwald View on GitHub
bug triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 13h
Merged PRs (30d)
133

Description

### Issue Description

When building with NuGet audit enabled, MSBuild tasks targeting .NET Core will receive the following error:

> Package 'System.Formats.Asn1' 7.0.0 has a known high severity vulnerability, https://github.com/advisories/GHSA-447r-wph3-92pm

Looking at a `dotnet nuget why` of the package and will end up with the following:

```
Project 'SemanticSearch.BuildTask' has the following dependency graph(s) for 'System.Formats.Asn1':

[net8.0]

└─ Microsoft.Build.Tasks.Core (v17.7.2)
├─ System.Security.Cryptography.Pkcs (v7.0.2)
│ └─ System.Formats.Asn1 (v7.0.0)
└─ System.Security.Cryptography.Xml (v7.0.1)
└─ System.Security.Cryptography.Pkcs (v7.0.2)
└─ System.Formats.Asn1 (v7.0.0)

[net472]

└─ No dependency graph(s) found for this target framework.
```

From the perspective of a MSBuild task I'm not sure how we can address this. This package comes from the .NET runtime. There is no way for us to really fix this at the msbuild task level given that the MSBuild host controls this dependency. Not sure how we can proceed here as we can't suppress this warning over the long term.

### Steps to Reproduce

Create a new console project and add the following NuGet.config file

```xml








```

Then run the following:

```cmd
> dotnet new classlib
> cp ../NuGet.config .
> dotnet add package Microsoft.Build.Tasks.Core
> dotnet build
```

That will produce the following warning:

> Package 'System.Formats.Asn1' 7.0.0 has a known high severity vulnerability, https://github.com/advisories/GHSA-447r-wph3-92pm

### Expected Behavior

No warning or a method of correctly addressing the warning in the library

### Actual Behavior

That will produce the following warning:

> Package 'System.Formats.Asn1' 7.0.0 has a known high severity vulnerability, https://github.com/advisories/GHSA-447r-wph3-92pm

### Analysis

N/A

### Versions & Configurations

_No response_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.