1

Closed

NullReferenceException if requireApiKey = true, but the header X-NUGET-APIKEY isn't present

description

To reproduce:
  • Set requireApiKey = true
  • Set apiKey = changeme
  • nuget push myPackage.nupkg -Source http://localhost:51607/
Current behaviour:
  • HTTP 500 Internal Server Error with the stack trace
[NullReferenceException: Object reference not set to an instance of an object.]
NuGet.Server.Infrastructure.PackageAuthenticationService.IsAuthenticatedInternal(String apiKey, NameValueCollection appSettings) +124
NuGet.Server.Infrastructure.PackageAuthenticationService.IsAuthenticated(IPrincipal user, String apiKey, String packageId) +18
NuGet.Server.PackageService.Authenticate(HttpContextBase context, String apiKey, String packageId) +35
NuGet.Server.PackageService.CreatePackage(HttpContextBase context) +165
NuGet.Server.NuGetRoutes.<MapRoutes>b__1(RequestContext context) +36
RouteMagic.HttpHandlers.DelegateHttpHandler.ProcessRequest(HttpContext context) +74
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +341
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69

Expected behaviour:
  • The same behaviour if the X-NUGET-APIKEY header was specified but was the incorrect value
Closed Jul 26, 2013 at 11:33 PM by danliu
verified using latest 2.7 nuget.server package and nuget.exe command. works now.

comments

dotnetjunky wrote Jul 23, 2013 at 6:20 PM

Fixed by pull request from David.