-
Notifications
You must be signed in to change notification settings - Fork 1.9k
C#: Make sure allFeeds contains at least explicitFeeds
#21236
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
base: main
Are you sure you want to change the base?
Conversation
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.
Pull request overview
This pull request fixes a bug in the computation of allFeeds in the NuGet package restoration logic. The PR ensures that allFeeds always includes explicitFeeds, which is normally the case except when configuration files with non-standard casing (like Nuget.Config instead of nuget.config) are encountered on case-sensitive file systems.
Changes:
- Added logic to explicitly union
explicitFeedsintoallFeedsto handle the edge case where case-sensitive filesystems causedotnet nuget list sourceto miss configuration files that are otherwise valid - Added comprehensive comments explaining the rationale and the specific edge case being addressed
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
michaelnebel
left a comment
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.
That is some excellent 🕵️ work!!!
csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/NugetPackageRestorer.cs
Outdated
Show resolved
Hide resolved
|
We should also run DCA. |
8857553 to
1aba0b2
Compare
csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/NugetPackageRestorer.cs
Outdated
Show resolved
Hide resolved
michaelnebel
left a comment
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.
Fantastic!
Thank you!
This (sort of) fixes a (sort of) bug in the computation of
allFeeds. We assume thatallFeedsincludesexplicitFeedsand that is generally true, except for one case. On systems with case-sensitive file systems, we may discover a configuration file such asNuget.Config, which is not recognised bydotnet nuget list source(which e.g. only recognisesNuGet.configandnuget.config). In that case, our call toGetNugetFeedswill retrieve the feeds from that file (because it is accepted when provided explicitly as--configfileargument), but the call toGetNugetFeedsFromFolderwill not.Arguably, another option here would be to make our configuration file discovery more strict and only recognise the same case-sensitive filenames as
dotnet nuget list source. However, that may catch out customers by surprise who normally work on case-insensitive systems, but who use Default Setup.Note that this doesn't address scenarios where
GetNugetFeedsFromFoldermisses feeds from parent directories because they have names thatdotnet nuget list sourcedoesn't recognise.