Harden persisted NuGet source handling
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 991
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 196
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Is your feature request related to a problem? Please describe the problem.
Follow-up to #19340 and #19392.
The initial `nugetSource` implementation deliberately reuses the existing `--source` behavior so the core configuration change stays reviewable. Persisting a package source creates a broader trust and compatibility boundary that should be designed separately rather than added incrementally to that PR.
Important cases include authenticated enterprise proxies, relative and local feeds, remote filesystem paths, malformed URI-shaped values, and links or junctions that redirect local paths.
### Describe the solution you'd like
Define and implement the supported contract for persisted NuGet sources:
- Resolve relative local paths from the configuration file that declares them.
- Clearly classify HTTP(S) sources, `file:` URIs, local paths, UNC paths, and Windows device paths before filesystem access.
- Prevent credentials, query strings, or fragments from being accidentally persisted or exposed in diagnostics.
- Support authenticated private feeds through NuGet credential providers and determine how existing `packageSourceCredentials` entries should be preserved.
- Decide whether remote shares and paths containing symlinks or junctions are supported, with consistent behavior across Windows, macOS, and Linux.
- Keep template discovery, integration discovery, version lookup, package installation, and restore behavior consistent for flat and hierarchical local feeds.
- Add focused migration coverage for `nugetSource` in legacy `.aspire/settings.json`.
- Add cross-platform tests for the supported and rejected source shapes.
This work should not automatically copy an inherited source into generated project configuration unless that persistence behavior is designed separately. Copying an absolute local path can make generated configuration machine-specific and can prevent later proxy rotation.
### Additional context
Related issues:
- #19207
- #19338
- #16946
- #16804
- #19192
Contributor guide
Research direction
Start by tracing the existing nugetSource and --source handling, then inspect legacy .aspire/settings.json migration and generated project configuration behavior. Define the supported source shapes, credential-preservation rules, and cross-platform behavior before adding focused tests; done means supported and rejected cases behave consistently without leaking credentials or copying inherited sources unexpectedly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100