DependencyTrack / DependencyTrack/dependency-track

NuGet stable vs preview version vulnerabilities

Open
#1,711 4 comments 5 reactions 0 assignees View on GitHub
enhancement
Dominant language
Java
Stars
4.2k
Forks
811
Avg merge
8h 39m
Merged PRs (30d)
237

Description

### Current Behavior:

It reports vulnerabilities for not being in the latest preview version.

### Proposed Behavior:

It should not suggest preview versions, it should only compare against stable versions.

Or if you don't want to change the behavior at least the possibility that it can be configured.

Relevant code:

https://github.com/DependencyTrack/dependency-track/blob/master/src/main/java/org/dependencytrack/tasks/repositories/NugetMetaAnalyzer.java#L108

Edit:

It seems that there is no way to filter the prerelease attribute on the endpoint being used.

Docs:

https://docs.microsoft.com/en-us/nuget/api/package-base-address-resource

Example:

https://api.nuget.org/v3-flatcontainer/system.text.json/index.json

BUT:

I see that it is possible with another logic and another type of requests.

1. Making a request to:

https://api.nuget.org/v3/registration5-gz-semver2/system.text.json/index.json

Searching for "catalogEntry > id"

![image](https://user-images.githubusercontent.com/950602/173607878-f28bebc0-4f83-40f4-a79b-7c13450fb092.png)

Resulting url:

https://api.nuget.org/v3/catalog0/data/2022.06.14.13.40.27/system.text.json.7.0.0-preview.5.22301.12.json

![image](https://user-images.githubusercontent.com/950602/173609535-90206f46-8c42-4279-a002-760486e83e1a.png)

This one does have the "isPrerelease" attribute.

### **If there is no better way, refactoring would be:**

1. Call to: https://api.nuget.org/v3/registration5-gz-semver2/{package-id/index.json

2. Make a request to the url of each item from newest to oldest until it finds the first one with "isPrerelease: false".

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.