Skip to content
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

Improve "invalid macaroon signature" error #9018

Closed
di opened this issue Jan 24, 2021 · 7 comments · Fixed by #11885
Closed

Improve "invalid macaroon signature" error #9018

di opened this issue Jan 24, 2021 · 7 comments · Fixed by #11885
Assignees
Labels

Comments

@di
Copy link
Member

di commented Jan 24, 2021

Right now, an API token can fail for a number of reasons, most of which produce an "invalid macaroon signature" exception.

https://github.com/pypa/warehouse/blob/aafc5185e57e67d43487ce4faa95913dd4573e14/warehouse/macaroons/caveats.py#L93

Common issues that could use more detailed error messages:

  • the API token is scoped for a different project than it's being used for
  • the API token is malformed and cannot be deserialized
  • the API token doesn't begin with pypi-
  • (probably more)
@ewjoachim
Copy link
Contributor

If we're touching this part, do you think we could try and merge #8598 first ?

@di
Copy link
Member Author

di commented Jan 25, 2021

Yes, agreed, just wanted to capture the issue.

@achimnol
Copy link

achimnol commented Mar 29, 2021

This also may happen when the target repository does not exist yet when using an "all projects" API token. In such cases I had to first create the project by uploading using the human account credential.

But still, I'm currently debugging one of my repo facing this error, with correctly configured org-level secrets and environment variables on GitHub workflows, while many other repositories with the same token work well with the same token, and where that particular project is created using the human credential after failing with the org-configured "all projects" token and the repository name was renamed.

I tried upgrading twine from 1.x to 3.4 but had no luck yet. I'd like to see more detailed information related to this error.

@ewjoachim
Copy link
Contributor

#9264 will bring much more detailed error messages.

Nevertheless, what you experience with the first upload is not the expected behavior, but it belongs to another issue. Can you open a new issue ? (Feel free to ping me)

@woodruffw
Copy link
Member

#11122 will refactor some of the code responsible for the error handling here, hopefully making it easier to resolve this.

@woodruffw
Copy link
Member

Another update: I figured out a relatively straightforward way to propagate the error messages we added with #11122, so I'll have a PR that resolves this soon.

@woodruffw
Copy link
Member

Fixed by #11885.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants