-
Notifications
You must be signed in to change notification settings - Fork 645
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Vulnerabilities]Adding new Job for updating v3 Vulnerabilities files. #9740
Conversation
Quick clarification question before diving into: Should this new job be called NuGet.Jobs? What is the criteria for determining where a new job should go? |
Great questions! The general split for jobs being here vs NuGet.Jobs is a little bit arbitrary. Jobs that have harder gallery integration/depend on NuGetGallery.Core or Entities TEND TO lean towards being in NuGetGallery. This job is here becuase it relies on NuGet.Services.GitHub, which one COULD argue should actually be moved to another repo, but as it was extracted from GitHubVulnerabilities2Db (which is in here because of dependence on gallery DB interaction mechanics), it has not been moved as it would likely involve some additional changes to the build. The checked in binary asset is a copy of the one at https://github.com/NuGet/NuGetGallery/blob/main/src/GitHubVulnerabilities2Db/Scripts/nssm.exe |
It doesn't look signed binary, and it's 3rd party. I prefer not to add 3rd party binary directly into code. At least could we add as nupkg dependency? |
src/GitHubVulnerabilities2v3/Configuration/GitHubVulnerabilities2v3Configuration.cs
Outdated
Show resolved
Hide resolved
src/GitHubVulnerabilities2v3/Extensions/BlobStorageVulnerabilityWriter.cs
Outdated
Show resolved
Hide resolved
src/GitHubVulnerabilities2v3/Extensions/BlobStorageVulnerabilityWriter.cs
Outdated
Show resolved
Hide resolved
src/GitHubVulnerabilities2v3/Extensions/BlobStorageVulnerabilityWriter.cs
Outdated
Show resolved
Hide resolved
src/GitHubVulnerabilities2v3/Extensions/BlobStorageVulnerabilityWriter.cs
Outdated
Show resolved
Hide resolved
src/GitHubVulnerabilities2v3/Extensions/BlobStorageVulnerabilityWriter.cs
Outdated
Show resolved
Hide resolved
src/GitHubVulnerabilities2v3/Extensions/BlobStorageVulnerabilityWriter.cs
Outdated
Show resolved
Hide resolved
src/GitHubVulnerabilities2v3/Extensions/BlobStorageVulnerabilityWriter.cs
Outdated
Show resolved
Hide resolved
src/GitHubVulnerabilities2v3/Extensions/BlobStorageVulnerabilityWriter.cs
Outdated
Show resolved
Hide resolved
src/GitHubVulnerabilities2v3/Extensions/BlobStorageVulnerabilityWriter.cs
Outdated
Show resolved
Hide resolved
src/GitHubVulnerabilities2v3/Extensions/BlobStorageVulnerabilityWriter.cs
Outdated
Show resolved
Hide resolved
src/GitHubVulnerabilities2v3/Extensions/BlobStorageVulnerabilityWriter.cs
Show resolved
Hide resolved
src/GitHubVulnerabilities2v3/Extensions/BlobStorageVulnerabilityWriter.cs
Outdated
Show resolved
Hide resolved
src/GitHubVulnerabilities2v3/Extensions/BlobStorageVulnerabilityWriter.cs
Outdated
Show resolved
Hide resolved
src/GitHubVulnerabilities2v3/Extensions/BlobStorageVulnerabilityWriter.cs
Outdated
Show resolved
Hide resolved
src/GitHubVulnerabilities2v3/Extensions/BlobStorageVulnerabilityWriter.cs
Outdated
Show resolved
Hide resolved
src/GitHubVulnerabilities2v3/Extensions/BlobStorageVulnerabilityWriter.cs
Outdated
Show resolved
Hide resolved
src/GitHubVulnerabilities2v3/Extensions/BlobStorageVulnerabilityWriter.cs
Outdated
Show resolved
Hide resolved
src/GitHubVulnerabilities2v3/Extensions/BlobStorageVulnerabilityWriter.cs
Outdated
Show resolved
Hide resolved
src/GitHubVulnerabilities2v3/Extensions/BlobStorageVulnerabilityWriter.cs
Outdated
Show resolved
Hide resolved
src/GitHubVulnerabilities2v3/Extensions/BlobStorageVulnerabilityWriter.cs
Show resolved
Hide resolved
src/GitHubVulnerabilities2v3/Extensions/BlobStorageVulnerabilityWriter.cs
Show resolved
Hide resolved
src/GitHubVulnerabilities2v3/Extensions/BlobStorageVulnerabilityWriter.cs
Show resolved
Hide resolved
src/GitHubVulnerabilities2v3/Extensions/BlobStorageVulnerabilityWriter.cs
Outdated
Show resolved
Hide resolved
return vulnerabilities.Count(); | ||
} | ||
|
||
public async Task WriteVulnerabilityAsync(PackageVulnerability packageVulnerability, bool wasWithdrawn) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. That's a great question. I've added a section that removes vulnerabilities if they are withdrawn, but that won't solve the case of it existing in base and being removed down the line. I also don't think client would know how to handle that case (advisory present in base, removed in an update) @zivkan
Worst case, it will be fixed on regeneration 30 days later, and today, is effectively in the same state since we only update manually. @zhhyu
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also don't think client would know how to handle that case (advisory present in base, removed in an update)
That's correct. Client simply concatenates all advisories across all files (and across all sources), deduplicates (both advisory URL + version range must match), and uses the resulting list. There's no syntax in the file format to "remove advisory previously declared"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the base document get regenerated if one advisory is withdrawn? I don't know how 2DB handles this case, but there is a need to keep the consistency between the two endpoints as much as possible, and also as a customer, I'd like not to see a withdrawn warning and spend time looking into how to resolve the dependency graph when unnecessary.
src/GitHubVulnerabilities2v3/Extensions/BlobStorageVulnerabilityWriter.cs
Show resolved
Hide resolved
src/GitHubVulnerabilities2v3/Extensions/BlobStorageVulnerabilityWriter.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for late review. My comments are not blocking.
src/GitHubVulnerabilities2v3/Extensions/BlobStorageVulnerabilityWriter.cs
Outdated
Show resolved
Hide resolved
src/GitHubVulnerabilities2v3/Extensions/BlobStorageVulnerabilityWriter.cs
Outdated
Show resolved
Hide resolved
src/GitHubVulnerabilities2v3/Extensions/BlobStorageVulnerabilityWriter.cs
Show resolved
Hide resolved
src/GitHubVulnerabilities2v3/Extensions/BlobStorageVulnerabilityWriter.cs
Show resolved
Hide resolved
src/GitHubVulnerabilities2v3/Extensions/BlobStorageVulnerabilityWriter.cs
Show resolved
Hide resolved
All comments addressed. Requested review.
Last questions before approving the PR:
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚢
Thank you for your patience.
Great catch by @erdembayar . Gzipping was apparently not enabled. Pushed some new changes that should enable compression of the stream. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the first proposal for a new job to automatically update the v3 Vulnerability files.
This should implement the design indicated at https://github.com/NuGet/Engineering/pull/4940
Much of the mechanics of pulling from GitHub are tested in the GitHubVulnerabilities2Db.Facts project.
The primary work is done in the FlushAsync method starting at line 53 of src/GitHubVulnerabilities2v3/Extensions/BlobStorageVulnerabilityWriter.cs
Summary of intended flow: