NuGet / Home

Repo for NuGet Client issues
Other
1.5k stars 252 forks source link

Add a pre-compress target/hook #13690

Open gustavoaca1997 opened 3 months ago

gustavoaca1997 commented 3 months ago

NuGet Product(s) Involved

dotnet.exe

The Elevator Pitch

As part of the efforts of including Software Bill of Materials (SBOM) generation into .NET, we need a target or hook that occurs right before the compression of the Nuget package's content, so that we can:

By integrating SBOM generation into NuGet packages, we can provide developers with a transparent and comprehensive view of the components within their applications. This addition not only enhances security but also streamlines compliance and fosters trust within the developer community.

Additional Context and Details

Right now, the only way we have for adding a SBOM manifest into the Nuget package is by doing the following:

Ideally we could skip the unzip-zip part, and use a target that will let us scan the whole content of the package right before it's compressed. We would need a property with the path to the content. Something like this:

  <Target Name="GenerateSbomTarget" AfterTargets="PreCompress" Condition=" '$(GenerateSBOM)' ==  'true'" >

    <!-- Call the SBOM Task to generate a SBOM. -->
    <GenerateSbom
        BuildDropPath="$(PackageContentPath)"
        ...
    </GenerateSbom>
  </Target>
Nigusu-Allehu commented 3 months ago

There is an Epic tracking introduction of SBOMs to NuGet https://github.com/NuGet/Home/issues/12497