Warehouse: [Non-prefixed API tokens] may cause HTTP 500 Internal Server Error

Created on 2 Aug 2019  Â·  10Comments  Â·  Source: pypa/warehouse

Describe the bug

Following this Tweeter thread https://twitter.com/cedrickrier/status/1156922196213805056?s=19 it seems like using a @token username and a non-prefixed token as a password results in HTTP 500 response which probably means a traceback in the backend logs.
Needs to be verified tho.

Expected behavior

HTTP 403

To Reproduce

N/A

My Platform

N/A

Additional context

N/A

bug requires triaging

All 10 comments

cc @cedk who reported this.

Per our conversation in a planning meeting a few days ago, some of our upcoming fixes will probably address this -- I'll keep an eye on it.

I think the real issue here is that folks are interpreting the pypi: prefix as not part of the token. Changing the prefix may not resolve that issue.

Totally! I think that maybe some warning âš  there would be helpful.

But still the HTTP error code shouldn't be 500.

Agreed, @woodruffw can we do a better job of catching this issue?

Yep, we can. I'll take a look at it tomorrow!

Just tried reproducing this on master by dropping pypi- from the token, but didn't receive a 500 error (got the expected 403).

My steps:

  1. Create a new token with "user" scope
  2. Copy the token, minus pypi- prefix, to my .pypirc
  3. twine upload --repository localhost dist/*

@webknjaz Do you have any additional information that could help me repro here?

Sorry, I only know what's in that Twitter thread.

Fixed in #6384.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nlhkabu picture nlhkabu  Â·  4Comments

NathanBnm picture NathanBnm  Â·  3Comments

gautamkrishnar picture gautamkrishnar  Â·  4Comments

nlhkabu picture nlhkabu  Â·  4Comments

zt2 picture zt2  Â·  4Comments