question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add support for API keys

See original GitHub issue

A scary number of people embed their PyPI username and password in their Travis config (using Travis encrypted variables), to enable automatic releases for certain branches (Travis even has a guide for it).

In addition, the packaging docs example encourages users to save their password in plaintext on disk in their .pypirc (they can of course use twine’s password prompting, but I wonder how many read that far, rather than just copy the example verbatim?)

Whilst in an ideal world credentials of any form wouldn’t be saved unencrypted to disk (or given to a third-party such as Travis) and instead users prompted every time - I don’t think this is realistic in practice.

API keys would offer the following advantages:

  1. Higher-entropy credentials that are guaranteed to have not been reused on multiple sites.
  2. The ability to give the API key a smaller permissions scope than that of the owner’s username/password. For example an API key would not be permitted to change a user’s listed GPG key or in the future, their 2FA settings. Or an API key could be limited to a specific package.
  3. Since this would be separate from the existing username/password auth, a signing based approach (eg HMAC) could be used, without breaking older clients. This would ensure that if a connection was MiTMed (eg due to a protocol or client exploit), the API key itself would still remain secure.
  4. Eventually support could be dropped for the password field in .pypirc, leaving a much safer choice between password prompting every time, or creating an API key that could be saved to disk.
  5. If/when support is added for 2FA, users who need to automate PyPI uploads won’t have to forgo 2FA for their whole account. They could instead choose to just create a 2FA-circumventing API key for just the one package that needs uploads in automation.

Many thanks 😃

(I’ve filed this against warehouse since I’m presuming this is beyond the scope of maintenance-only changes being made to the old PyPI codebase)

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:35
  • Comments:70 (37 by maintainers)

github_iconTop GitHub Comments

4reactions
brainwanecommented, Mar 14, 2019

Good news - this work is now underway, and you can expect to see @woodruffw working on it. Thanks to Open Tech Fund for making this work possible!

4reactions
lukesneeringercommented, Mar 28, 2018

(Poking to say this is in progress; a PR will be coming soon-ish.)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Authenticate using API keys - Google Cloud
Open source tool to provision Google Cloud resources with declarative configuration files. ... Game server management service running on Google Kubernetes Engine.
Read more >
Use API Keys with Places API - Google Developers
Go to the Google Maps Platform > Credentials page. Go to the Credentials page · On the Credentials page, click Create credentials >...
Read more >
Set up API keys using the API Gateway console
Choose a REST API. · In the API Gateway main navigation pane, choose API Keys. · From the Actions drop-down menu, choose Create...
Read more >
API Keys - Swagger
Some APIs use API keys for authorization. An API key is a token that a client provides when making API calls. The key...
Read more >
API Keys: API Authentication Methods & Examples
It depends. Earlier, we suggested Basic Auth as an alternative to API keys. Basic Auth and API keys can also be used together....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found