-
Notifications
You must be signed in to change notification settings - Fork 995
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
Add support for API keys #4599
Closed
Closed
Add support for API keys #4599
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pypi#994 This lets users provision an API key, and then use that API key with forklift.legacy.file_upload. It uses macaroons so advanced users can further restrict usage of their API key.
- fix comment - flake8 compliance - satisfy DEPCHECKER - add alembic migration
Also fix missed lint.
I just want to let you know, I plan on looking at this later this week. |
Thanks! I finally figured out how to run the linter locally. I'll look at the coverage issues in the meantime. |
* Update certifi from 2018.8.13 to 2018.8.24 * Update certifi from 2018.8.13 to 2018.8.24 * Update certifi from 2018.8.13 to 2018.8.24
* Update sphinx from 1.7.7 to 1.7.8 * Update sphinx from 1.7.7 to 1.7.8
* Update attrs from 18.1.0 to 18.2.0 * Update attrs from 18.1.0 to 18.2.0 * Update attrs from 18.1.0 to 18.2.0 * Update tests.txt
* Update flake8 from 3.5.0 to 3.6.0 * Update pyflakes from 1.6.0 to 2.0.0 * Update pycodestyle from 2.3.1 to 2.4.0 * Add setuptools==40.4.3 to requirements/lint.txt * Fix linting errors
* Update pytz from 2018.5 to 2018.6 * Update pytz from 2018.5 to 2018.6
* Update urllib3 from 1.23 to 1.24 * Update urllib3 from 1.23 to 1.24 * Update urllib3 from 1.23 to 1.24
* Update responses from 0.9.0 to 0.10.1 * Add biscuits==0.1.1
Bumps [gunicorn](https://github.com/benoitc/gunicorn) from 19.7.1 to 19.9.0. - [Release notes](https://github.com/benoitc/gunicorn/releases) - [Commits](benoitc/gunicorn@19.7.1...19.9.0) Signed-off-by: dependabot[bot] <support@dependabot.com>
Bumps [black](https://github.com/ambv/black) from 18.6b2 to 18.9b0. - [Release notes](https://github.com/ambv/black/releases) - [Commits](psf/black@18.6b2...18.9b0) Signed-off-by: dependabot[bot] <support@dependabot.com>
* Update responses from 0.10.1 to 0.10.2 * Remove biscuits...
* Update python-dateutil from 2.7.3 to 2.7.4 * Update python-dateutil from 2.7.3 to 2.7.4
Bumps [boto3](https://github.com/boto/boto3) from 1.9.31 to 1.9.32. - [Release notes](https://github.com/boto/boto3/releases) - [Changelog](https://github.com/boto/boto3/blob/develop/CHANGELOG.rst) - [Commits](boto/boto3@1.9.31...1.9.32) Signed-off-by: dependabot[bot] <support@dependabot.com>
Bumps [future](https://github.com/PythonCharmers/python-future) from 0.16.0 to 0.17.0. - [Release notes](https://github.com/PythonCharmers/python-future/releases) - [Changelog](https://github.com/PythonCharmers/python-future/blob/master/docs/changelog.rst) - [Commits](PythonCharmers/python-future@v0.16.0...v0.17.0) Signed-off-by: dependabot[bot] <support@dependabot.com>
Bumps [pycparser](https://github.com/eliben/pycparser) from 2.18 to 2.19. - [Release notes](https://github.com/eliben/pycparser/releases) - [Changelog](https://github.com/eliben/pycparser/blob/master/CHANGES) - [Commits](eliben/pycparser@release_v2.18...release_v2.19) Signed-off-by: dependabot[bot] <support@dependabot.com>
pypi#994 This lets users provision an API key, and then use that API key with forklift.legacy.file_upload. It uses macaroons so advanced users can further restrict usage of their API key.
- fix comment - flake8 compliance - satisfy DEPCHECKER - add alembic migration
Also fix missed lint.
I accidentally hosed this branch when trying to update it / resolve merge conflicts last night. See instead #4949. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#994
This lets users provision an API key, and then use that API key with
forklift.legacy.file_upload. It uses macaroons so advanced users can
further restrict usage of their API key.
This work was originally started at https://github.com/lukesneeringer/warehouse/tree/tokens at the 2018 US PyCon.
It adds a section on /manage/accounts where you can create a new token:
Then a splash shows up with your new API key (note that this key is just on my local dev instance, not a real production key):
And the key is listed on /manage/accounts:
You can then use the key with something like:
Macaroons allow you to further reduce the scope of the API key. For example:
... and then the key is scoped to uploading just that package.
There's many places this pull could go from here. There should probably be additional testing, particularly off the happy path. We could add a first party caveat to support the key expiring after a certain date. Make instead of
package
it should bepackages
so you can support restricting it to a set of packages? You wouldn't want to support multiplepackage
caveats on a Macaroon - otherwise someone who gets your Macaroon could just add another package, defeating your earlier restriction!Feedback welcome!