C#: Support replaces-base via the DependabotProxy. - #22494
Conversation
e4e0207 to
9d030bd
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Feed-check opt-out behavior is regressed, and one fallback path can still retain nuget.org.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Balanced
Findings: 1
New issues introduced by this change (1)
| Severity | Finding |
|---|---|
csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/FeedManager.cs — This now probes the default feeds even when `CODEQL_EXTRACTOR_CSHARP_BUILDLESS_NUGET_FEEDS_CHECK=fal… |
What changed in this PR
Adds replaces-base support for private NuGet registries used during buildless C# dependency restoration.
Changes:
- Parses and exposes replacement-base registry URLs.
- Uses replacement registries for default and fallback feeds.
- Adds unit coverage and a change note.
| File | Description |
|---|---|
csharp/ql/lib/change-notes/2026-09-03-replaces-base.md |
Documents the new behavior. |
csharp/extractor/Semmle.Extraction.Tests/FeedManager.cs |
Tests default and fallback feed selection. |
csharp/extractor/Semmle.Extraction.Tests/DependabotProxy.cs |
Tests replaces-base parsing. |
csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/PackagesConfigRestorer.cs |
Uses reachable default feeds during restoration. |
csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/IDependabotProxy.cs |
Exposes replacement-base registry URLs. |
csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/FeedManager.cs |
Selects replacement registries as default feeds. |
csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/DependabotProxy.cs |
Parses and stores registry replacement metadata. |
Suppressed comments (1)
csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/FeedManager.cs:315
- The replacement is only applied through
GetReachableFallbackNugetFeeds, butNugetPackageRestorer.DownloadMissingPackagescalls that path only when feed responsiveness checks are enabled; its disabled branch usesAllFeeds, which can still contain inheritednuget.org. Thusreplaces-base: truedoes not actually replace the public base feed in fallback downloads when the supported responsiveness opt-out is used. Please separate construction of the configured fallback set from reachability filtering and use that set in both branches.
fallbackFeeds.UnionWith(defaultFeeds);
logger.LogInfo($"No fallback NuGet feeds specified. Adding default feeds: {string.Join(", ", defaultFeeds.OrderBy(f => f))}");
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| var reachableFallbackFeeds = GetReachableFallbackNugetFeeds(); | ||
| return reachableFallbackFeeds.ToImmutableHashSet(); | ||
| }); | ||
| lazyReachableDefaultFeeds = new Lazy<ImmutableHashSet<string>>(() => CheckSpecifiedFeeds(defaultFeeds)); |
…Ls to replace the default NuGet feed.
…s replaces-base is set, otherwise use nuget.org.
9d030bd to
4e3476f
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The responsiveness-check opt-out path can still use public NuGet.org despite a configured replacement registry.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Balanced
Findings: 2
New issues introduced by this change (1)
| Severity | Finding |
|---|---|
csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/FeedManager.cs — DefaultFeeds is substituted only on the responsiveness-checking path. When… |
Pre-existing issues (1)
| Severity | Finding |
|---|---|
csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/FeedManager.cs — This now probes the default feeds even when `CODEQL_EXTRACTOR_CSHARP_BUILDLESS_NUGET_FEEDS_CHECK=fal… View comment |
| fallbackFeeds.UnionWith(DefaultFeeds); | ||
| logger.LogInfo($"No fallback NuGet feeds specified. Adding default feeds: {string.Join(", ", DefaultFeeds.OrderBy(f => f))}"); |

In this PR we add support using the
replace-baseflag for private registries. If any private registries are configured to replace base, then we use these registries as NuGet feed sources instead of the default publicnuget.orgin fallback scenarios.DCA looks good.