-
Notifications
You must be signed in to change notification settings - Fork 548
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
Better error messages for unauthorized PATs to private packages #2930
Comments
Hi, can I take this issue? |
Hi @fool1280, are you working on it? If you are busy then I can pick this up! |
Assuming that @fool1280 is inactive, I am starting to work on it. @haydentherapper @znewman01 Is there a specific reason why we are passing a hardcoded string here? The error string should be more descriptive cosign/pkg/oci/remote/remote.go Lines 52 to 56 in 8df14d8
ErrEntityNotFound = errors.New("entity not found in registry")
I think this should return a 403. But the if statement finds a 404 in the tree and returns it. The error string in the issue is: Which means cosign/cmd/cosign/cli/sign/sign.go Lines 182 to 185 in 8df14d8
(we are only returning accessing image: in line 185 so that must be how)
But we are also checking in the if statement if the error is not of type @anderssonw Are you using the latest version? |
I haven't used the cosign CLI since posting this issue, so not sure what the message is now, sorry! |
My hunch is that this is by design. It's pretty common for APIs to return 404s instead of 403s for private entities, in order to prevent unauthorized users for learning whether an entity exists. If that's the case, I don't know how much we can do about it client-side.
We'd be okay with a more descriptive error if you have a specific proposal. |
@znewman01 Sorry for the delay, I was busy with academic stuff. That exact error cannot happen anymore as that behavior was changed in Sending a PR. |
Description
disclaimer: im not sure if this is possible / makes sense considering how PATs work
Trying to sign an image using a PAT gave me this error:
I was sort of stumped as to why it happened, but it simply turned out I had not allowed the PAT access to my organization via the SAML login.
On a public package, this error was handled quite well, telling me that the PAT was not "logged in" using SAML. However, only a 404-esque response was given for private packages.
The text was updated successfully, but these errors were encountered: