Inedo / pgscan

Dependency scanner for ProGet.
MIT License
11 stars 5 forks source link

Improved support for package-lock.json (npm) #39

Closed szimmer-dap closed 1 year ago

szimmer-dap commented 1 year ago

This PR adds recursive calls to ReadDependencies() in NpmDependencyScanner to add sub-dependencies to the sbom file (file format version 1 and 2). Those had been missing so far when they were required in a different version.

It also checks for the name property when reading files of format version 2 or 3. If present, this property seems to contain a name alias (basically what the 'npm:' prefix did in the versionproperty in the old format).

This PR also adds a Distinct() to the project dependencies in ProGetClient before calling the BomWriter. This eliminates redundant entries in the sbom file (mainly for NuGet when a product consists of several csproj-files) and can significantly reduce its file size. In my test case an 8 MB file was reduced to approx. 70 KB!