Check access when adding a new source with credentials #12963
Labels
Area:Authentication
Area:Settings
NuGet.Config and related issues
Priority:3
Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog.
Product:dotnet.exe
Product:NuGet.exe
NuGet.exe
Type:Feature
NuGet Product(s) Involved
NuGet.exe, dotnet.exe
The Elevator Pitch
If you add a new package source with 'nuget sources Add' or also with 'dotnet nuget add source', you have to specify credentials if the source is a private one.
Currently, it seems, that NuGet does not check those credentials and says 'successfully added' after adding the source to NuGet.Config. But you will notice errors, when trying to access the source repo.
So my request is, to check these credentials prior to adding the source to NuGet.Config.
As @zivkan mentioned in the discussion, this may break CI scripts.
But perhaps this feature can be optional and activated via a parameter or so?
Edit:
Would be also cool to have a command to check the current used credentials.
Let's say there are some credentials stored in my NuGet.Config. And maybe on adding the source everything was fine, but password now is not valid anymore. So it would be good to have kind of a validate-sources command or something like that to see which sources credentials might have become invalid.
Additional Context and Details
I think this feature would be helpful in preventing errors on getting packages from private sources.
Especially if you use encrypted passwords (e.g. on Windows) and you can not easily check a misstyped password.
In my case, i use adding sources dynamically in Gitlabs CI/CD pipeline. In the log, i can not see the used password and since it is running in an ephemeral container, i can also not see it in NuGet.Config file. So hunting for errors is hard and could be easier if NuGet would tell about wrong credentials.
The text was updated successfully, but these errors were encountered: