-
Notifications
You must be signed in to change notification settings - Fork 258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Forbidden status and prompted to enter credentials when attempt to push new package with same ID as an existing one #3391
Comments
@shishirx34 isn't the bug here that gallery returns a 403 forbidden? In this case the request from the client was not valid as the status code indicates, it is more of a 400 bad request, or 409 conflict. I would expect the gallery to return a non-credential related error code for a duplicate package upload. |
It is possible that it could be Gallery issue. I wasn't sure if the client masked the message hence wanted to check here first. I will open the other bug on gallery. |
@emgarten - I looked at this some more and it looks like Gallery is returning a
From the code it looks like the
Perhaps client should surface this error message(although in the case above it doesn't make it clear that there is ID collision)? |
The gallery may not even be getting to the id collision in that case. From the client side prompting for a 403 is by design for scenarios where the wrong use was specified. Printing out the message may be helpful to user here. |
I am sorry if I wasn't clear earlier. The API does detect the collision, it looks up the package registration by ID and if one is found, verifies if the package's owner is the current user trying to push(PUT request) the package. Which is when it detects that it is not, shown above, and returns a Forbidden result. https://github.com/NuGet/NuGetGallery/blob/master/src/NuGetGallery/Controllers/ApiController.cs#L293 From the code it looks like this behavior is by design. @maartenba or @xavierdecoster would be able to elaborate more on if it indeed is the desired behavior. |
The gallery checks whether the pushing user is actually an owner of the package registration. If it is not the case, then that operation is forbidden. It is not necessarily a conflict as it may concern a new version of the package being pushed. As there's a meaningful message returned in the response, it may be useful to show it in the client? |
The message is incorrect in this case, and the status code is also potentially incorrect. This is not a forbidden case, as different user credentials will not allow for the request to go through, 409 seems much more appropriate (and the error message should indicate that the id/version already exists) |
There was a server change. Please test the experience at that point and ensure the client is providing a good error experience. |
FYI, with the change to the server to return 409 following is the response when pushing duplicate ID package for a user whose ApiKey does not match, current client behavior:
|
The error message is wrong, can we please correct it? We should have the following errors for the following scenario
|
Talked offline with Yishai. The bug addresses the above point.
This has been working correctly. We do have the check for ID and Version after the user permission check which throws the message described here. |
The server side fix should be live in production: NuGet/NuGetGallery#3196 |
Issue reported on Gallery NuGet/NuGetGallery#3218 by @AnotherSadGit:
I investigated and I see that the command line nuget.exe(latest: 3.4.4) does indeed return forbidden for duplicate ID package push.
The text was updated successfully, but these errors were encountered: