Environment variables in setapikey #7145
Labels
Area:Settings
NuGet.Config and related issues
Priority:3
Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog.
Status:Excluded from icebox cleanup
Status:Inactive
Icebox issues not updated for a specific long time
Type:Feature
Milestone
Details about Problem
NuGet product used: NuGet.exe
NuGet version 4.6.2.5055
When using an environment variable with setapikey, it's not getting evaluated during set or during push.
Use case
Use case is kind of weird, but here it goes:
We have a custom Nuget Server implementation which emails the Kerberos authenticated user as the package pusher which works great when humans use it.
But when the CI server running as a service account is pushing then you can only see the CI server's account as the authenticated user and I got a request to try to include the git committer as well.
To workaround this, I've hijacked the API Key (as haven't seen any other ways to add a custom header to nuget push) to include the git author which is injected as an env var on my Jenkins instance.
So it looks something like this:
nuget push *.nupkg -source MyNugetServer -apiKey OnBehalfOf:%gitlabUserEmail%
And on the server side, I just check the X-NuGet-ApiKey if it has the on behalf of.
The actual auth(z) is done via Kerberos / AD group membership, so the API key is ignored otherwise.
Based on the docs here I wasn't sure if it's supported or not, but it seems like it's not working, so just wanted to clarify if this something which would make sense to support ?
Or if you guys have a better idea to pass some extra header with nuget.exe push ? ( which TBH would be a more elegant solution )
Detailed repro steps so we can see the same problem
Result: API key is passed in as "%NugetApiKey%" instead of 12345
Thanks for checking!
The text was updated successfully, but these errors were encountered: